@import url('https://fonts.googleapis.com/css2?family=Amiri+Quran&family=Amiri:wght@400;700&display=swap');

:root {
    --bg: #f6efe4;
    --paper: #fffaf1;
    --ink: #211a15;
    --muted: #6b5b4b;
    --line: #3a3028;
    --soft-line: #d8c9b6;
    --accent: #6f3f1e;
    --accent-dark: #462612;
    --done: #1f7a45;
    --danger: #9f2f2f;
    --shadow: 0 18px 60px rgba(35, 25, 15, .12);
}

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 20% 0%, rgba(111, 63, 30, .10), transparent 32rem),
        linear-gradient(135deg, #f8f1e7 0%, #efe0cd 100%);
    min-height: 100vh;
}

.page-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 22px 14px 36px;
}

.hero {
    position: relative;
    text-align: center;
    padding: 28px 18px 20px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -1px;
}

.hero p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.hero-badge {
    position: absolute;
    top: 12px;
    left: 20px;
    border: 2px solid var(--line);
    border-radius: 16px;
    padding: 9px 16px;
    font-weight: 800;
    color: var(--accent-dark);
    background: rgba(255, 250, 241, .72);
}

.main-card {
    background: rgba(255, 250, 241, .94);
    border: 2px solid var(--line);
    box-shadow: var(--shadow);
    padding: 18px;
}

.visitor-card {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.name-form,
.progress-box,
.restore-box {
    background: #fffdf8;
    border: 1px solid var(--soft-line);
    border-radius: 14px;
    padding: 14px;
}

.name-form label {
    display: block;
    font-weight: 800;
    margin-bottom: 8px;
}

.name-row {
    display: flex;
    gap: 10px;
}

input[type="text"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--soft-line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}

button {
    border: 0;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 0 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

button:hover {
    background: var(--accent-dark);
}

.progress-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-text {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
}

.progress-text strong {
    color: var(--accent-dark);
    font-size: 1.15rem;
}

.progress-bar {
    height: 16px;
    background: #eadbc8;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--soft-line);
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--done), #64a36f);
    transition: width .25s ease;
}

.restore-box {
    grid-column: 1 / -1;
}

.restore-box summary {
    cursor: pointer;
    font-weight: 800;
}

.restore-box p {
    margin: 10px 0;
    color: var(--muted);
}

.save-status {
    min-height: 28px;
    text-align: center;
    font-weight: 800;
    margin: 4px 0 8px;
}

.save-status.saving { color: var(--accent); }
.save-status.success { color: var(--done); }
.save-status.error { color: var(--danger); }

.desktop-table-wrap {
    overflow-x: auto;
    border: 2px solid var(--line);
    background: #fffdf8;
}

.activity-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 860px;
}

.activity-table th,
.activity-table td {
    border: 1px solid var(--line);
    text-align: center;
    vertical-align: middle;
    height: 64px;
    padding: 8px;
}

.activity-table thead th {
    background: #eadbc8;
    color: var(--ink);
    font-size: 1.02rem;
    line-height: 1.55;
}

.activity-table tbody th.day-cell {
    width: 120px;
    font-size: 1.25rem;
    background: #fbf2e5;
    white-space: nowrap;
}

.check-holder {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    cursor: pointer;
}

.check-holder input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check-holder span,
.mobile-activity-row input {
    width: 31px;
    height: 31px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.check-holder input:checked + span {
    background: var(--done);
    border-color: var(--done);
    position: relative;
}

.check-holder input:checked + span::after {
    content: "✓";
    color: #fff;
    font-size: 26px;
    font-weight: 900;
    line-height: 27px;
}

.mobile-days {
    display: none;
}

.footer-dua {
    text-align: center;
    color: var(--muted);
    margin-top: 22px;
    line-height: 1.9;
    font-weight: 700;
}

@media (max-width: 760px) {
    .page-shell {
        padding: 10px 8px 26px;
    }

    .hero {
        padding-top: 58px;
    }

    .hero-badge {
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        padding: 7px 14px;
    }

    .main-card {
        border-width: 1px;
        padding: 10px;
    }

    .visitor-card {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .name-row {
        flex-direction: column;
    }

    button {
        width: 100%;
        min-height: 44px;
    }

    .desktop-table-wrap {
        display: none;
    }

    .mobile-days {
        display: grid;
        gap: 12px;
    }

    .day-card {
        background: #fffdf8;
        border: 1px solid var(--soft-line);
        border-radius: 16px;
        overflow: hidden;
    }

    .day-card h2 {
        margin: 0;
        padding: 13px 16px;
        background: #eadbc8;
        font-size: 1.25rem;
        border-bottom: 1px solid var(--soft-line);
    }

    .mobile-activity-list {
        display: grid;
    }

    .mobile-activity-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
        border-bottom: 1px solid #eee0d0;
        font-size: 1.03rem;
        font-weight: 700;
    }

    .mobile-activity-row:last-child {
        border-bottom: 0;
    }

    .mobile-activity-row input {
        appearance: none;
        flex: 0 0 31px;
        cursor: pointer;
    }

    .mobile-activity-row input:checked {
        background: var(--done);
        border-color: var(--done);
        background-image: linear-gradient(45deg, transparent 54%, #fff 54%), linear-gradient(-45deg, transparent 50%, #fff 50%);
        background-size: 9px 16px, 18px 9px;
        background-position: 16px 7px, 4px 14px;
        background-repeat: no-repeat;
    }
}

@media print {
    body {
        background: #fff;
    }
    .page-shell {
        width: 100%;
        padding: 0;
    }
    .main-card {
        box-shadow: none;
        border-color: #000;
    }
    .visitor-card,
    .save-status,
    .mobile-days {
        display: none !important;
    }
    .desktop-table-wrap {
        display: block !important;
        overflow: visible;
    }
    .activity-table {
        min-width: 0;
    }
}

/* Reading pages + Quran font */
.read-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    font-size: .98rem;
    box-shadow: 0 8px 18px rgba(70, 38, 18, .13);
}

.read-action:hover {
    background: var(--accent-dark);
}

.read-action.is-done {
    background: var(--done);
}

.read-done-badge {
    display: block;
    margin-top: 6px;
    color: var(--done);
    font-weight: 900;
    font-size: .92rem;
}

.back-link,
.secondary-link {
    color: var(--accent-dark);
    font-weight: 900;
    text-decoration: none;
}

.back-link:hover,
.secondary-link:hover {
    text-decoration: underline;
}

.reading-shell {
    max-width: 980px;
}

.reading-hero {
    padding-top: 54px;
}

.reading-hero .back-link {
    position: absolute;
    top: 16px;
    right: 18px;
    background: rgba(255, 250, 241, .84);
    border: 1px solid var(--soft-line);
    border-radius: 999px;
    padding: 9px 14px;
}

.reading-card {
    padding: clamp(14px, 3vw, 28px);
}

.reading-top-note {
    background: #fffdf8;
    border: 1px solid var(--soft-line);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
    color: var(--muted);
    font-weight: 800;
    line-height: 1.8;
}

.already-done {
    display: inline-block;
    margin-inline-start: 8px;
    color: var(--done);
}

.reading-content {
    background: #fffdf8;
    border: 1px solid var(--soft-line);
    border-radius: 18px;
    padding: clamp(18px, 4vw, 34px);
    line-height: 2.45;
    color: var(--ink);
    text-align: justify;
}

.quran-text {
    font-family: 'Amiri Quran', 'Amiri', 'Scheherazade New', serif;
    font-size: clamp(1.55rem, 4.7vw, 2.45rem);
    line-height: 2.45;
    text-align: center;
}

.quran-text p {
    margin: 0 0 1.15em;
}

.dua-text {
    font-family: 'Amiri', 'Tahoma', Arial, sans-serif;
    font-size: clamp(1.2rem, 3.5vw, 1.75rem);
    line-height: 2.25;
}

.content-placeholder {
    text-align: center;
}

.content-placeholder h2 {
    margin-top: 0;
    color: var(--accent-dark);
}

.content-placeholder pre {
    direction: ltr;
    display: inline-block;
    background: #f3eadc;
    border: 1px solid var(--soft-line);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 1rem;
    white-space: normal;
}

.complete-reading-form {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 14px;
    background: rgba(255, 250, 241, .96);
    border: 1px solid var(--soft-line);
    border-radius: 18px;
    box-shadow: 0 -8px 30px rgba(35, 25, 15, .08);
}

.complete-reading-btn {
    min-height: 52px;
    padding: 0 28px;
    font-size: 1.05rem;
}

@media (max-width: 760px) {
    .read-action {
        min-width: 88px;
        min-height: 38px;
        padding: 8px 13px;
    }

    .reading-hero .back-link {
        right: 50%;
        transform: translateX(50%);
        top: 8px;
    }

    .reading-top-note,
    .reading-content {
        border-radius: 14px;
    }

    .complete-reading-form {
        border-radius: 14px 14px 0 0;
        margin-left: -10px;
        margin-right: -10px;
        margin-bottom: -10px;
    }
}
