﻿/* =========================
   GLOBAL
========================= */
html, body {
    min-height: 100%;
}

body {
    margin: 0;
    background: #d8b382;
    font-family: 'QuranFont', serif;
    color: #111;
}

/* =========================
   FONTS
========================= */
/*@font-face {
    font-family: 'UthmanicHafs';
    src: url('/fonts/UthmanicHafs1BEx1Ver12.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}*/

@font-face {
    font-family: 'UthmanicHafs';
    src: url('../fonts/UthmanicHafs1BEx1Ver12.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* =========================
   HOME PAGE
========================= */
.legacy-home-page {
    width: 100%;
    min-height: 100vh;
    padding: 16px 18px 20px 18px;
    font-family: inherit;
    box-sizing: border-box;
}

/* 1 Juz column + 4 Sura columns */
.home-five-columns {
    display: grid;
    grid-template-columns: 150px repeat(4, minmax(0, 1fr));
    gap: 8px;
    align-items: start;
}

/* =========================
   PANELS
========================= */
.home-panel {
    background: linear-gradient(to bottom, #fffdf8, #f7edd8);
    border: 1px solid #b89263;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    min-width: 0;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

    .home-panel:hover {
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    }

.home-juz-panel {
    background: linear-gradient(to bottom, #f5f0df, #ece2c8);
    border: 1px solid #8f744f;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), 0 4px 12px rgba(0, 0, 0, 0.10);
    position: sticky;
    top: 12px;
}

.home-panel-title {
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    color: #3d2c1a;
    text-align: center;
    margin-bottom: 10px;
    padding: 4px 6px 8px 6px;
    border-bottom: 1px solid rgba(138, 106, 63, 0.45);
    letter-spacing: 0.2px;
}

.home-panel-title-empty {
    visibility: hidden;
}

/* =========================
   BUTTONS
========================= */
.legacy-box-btn {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid #b8a17a;
    background: linear-gradient(to bottom, #fffdfa, #f4ead5);
    color: #2b2117;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

    .legacy-box-btn:hover {
        background: linear-gradient(to bottom, #fffefc, #efe2c7);
        border-color: #8f744f;
        transform: translateY(-1px);
        box-shadow: 0 5px 12px rgba(0,0,0,0.10);
    }

    .legacy-box-btn:active {
        transform: scale(0.985);
        box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    }

.legacy-part-btn {
    background: linear-gradient(to bottom, #eef7e7, #dff0d2);
    border-color: #99bf86;
    color: #23301d;
    font-weight: 700;
}

    .legacy-part-btn:hover {
        background: linear-gradient(to bottom, #f3faee, #d6ebc8);
        border-color: #6d9960;
    }

.legacy-sura-btn {
    background: linear-gradient(to bottom, #fffdfa, #f6ecd8);
}

/* =========================
   DISPLAY PAGE
========================= */
.legacy-display-page {
    min-height: 100vh;
    background: #d8b382;
}

.legacy-display-content {
    padding: 28px 20px 42px 20px;
    box-sizing: border-box;
}

/* =========================
   HEADER / BANNER
========================= */
.quran-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 10px 18px;
    background: linear-gradient(to bottom, #fffefb, #f4ead7);
    border-bottom: 1px solid #c9ae86;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    font-family: inherit;
}

.header-left {
    justify-self: start;
}

.header-center {
    justify-self: center;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #3d2c1a;
    font-family: inherit;
}

.header-right {
    justify-self: end;
}

.quran-header .btn {
    border-radius: 999px;
    padding: 7px 15px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
}

/* =========================
   QURAN PAGE SHEET
========================= */
.legacy-pages-stack {
    display: flex;
    flex-direction: column;
    gap: 28px;
    align-items: center;
}

.legacy-quran-page-sheet {
    width: min(100%, 1000px);
    min-height: 78vh;
    background: #f7edd6;
    border: 2px solid #8a6a3f;
    border-radius: 10px;
    padding: 34px 42px 20px 42px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.legacy-quran-page-body {
    flex: 1;
    text-align: right;
    direction: rtl;
    font-family: 'UthmanicHafs', 'Amiri', 'Traditional Arabic', serif !important;
    font-size: 2.4rem;
    line-height: 2.1;
    color: #000;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 8px;
}

.legacy-ayah {
    display: block;
    width: max-content;
    min-width: 100%;
    margin-bottom: 10px;
    white-space: nowrap;
}

.ayah-text {
    font-family: 'UthmanicHafs', 'Amiri', 'Traditional Arabic', serif !important;
    white-space: nowrap;
    font-variant-ligatures: normal;
    font-feature-settings: "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
}

.legacy-ayah:nth-child(odd) .ayah-text {
    color: #000;
}

.legacy-ayah:nth-child(even) .ayah-text {
    color: #c1121f;
}

/* =========================
   PAGE FOOTER
========================= */
.legacy-page-footer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-top: 20px;
}

.legacy-page-number {
    min-width: 72px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'UthmanicHafs', 'Amiri', 'Traditional Arabic', serif;
    border-top: 1px solid #8a6a3f;
    padding-top: 8px;
    color: #3d2c1a;
}

/* =========================
   RESPONSIVE
========================= */
/* Keep 5 columns on most desktop/laptop widths */
@media (max-width: 1100px) {
    .home-five-columns {
        grid-template-columns: 145px repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .home-panel {
        padding: 10px;
    }

    .legacy-box-btn {
        font-size: 0.95rem;
        padding: 9px 8px;
    }

    .home-panel-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
}

/* Tablet */
@media (max-width: 850px) {
    .home-five-columns {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .home-juz-panel {
        position: static;
    }

    .legacy-home-page {
        padding: 12px;
    }
}

/* Smaller tablets / large phones */
@media (max-width: 768px) {
    .legacy-display-content {
        padding: 16px 8px 28px 8px;
    }

    .legacy-quran-page-sheet {
        padding: 20px 16px 16px 16px;
        min-height: auto;
    }

    .legacy-quran-page-body {
        font-size: 1.8rem;
        line-height: 1.9;
    }

    .header-center {
        font-size: 1.05rem;
    }

    .quran-header .btn {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}

/* Phones */
@media (max-width: 600px) {
    .home-five-columns {
        grid-template-columns: 1fr;
    }

    .legacy-box-btn {
        white-space: normal;
        font-size: 0.95rem;
    }

    .quran-header {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }

    .header-left,
    .header-center,
    .header-right {
        justify-self: center;
    }
}
/* Juz buttons ONLY */
.legacy-part-btn {
    background: linear-gradient(to bottom, #eef7e7, #dff0d2);
    border-color: #99bf86;
    color: #23301d;
    font-weight: 700;
    font-size: 0.9rem; /* smaller than sura */
    line-height: 1.2;
    white-space: normal; /* allow wrapping */
    overflow: visible;
    text-overflow: unset;
    padding: 8px 6px;
}




.legacy-quran-page-body {
    flex: 1;
    text-align: right;
    direction: rtl;
    font-family: 'UthmanicHafs', 'Amiri', 'Traditional Arabic', serif !important;
    font-size: 2.4rem;
    line-height: 2.1;
    color: #000;
    overflow-x: hidden;
    overflow-y: visible;
    white-space: normal;
    padding-bottom: 8px;
}

.legacy-ayah {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}

.aya-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    cursor: grab;
    direction: rtl;
    scrollbar-width: none;
}

    .aya-scroll:active {
        cursor: grabbing;
    }

    .aya-scroll.dragging {
        cursor: grabbing;
        user-select: none;
    }

    .aya-scroll::-webkit-scrollbar {
        display: none;
    }

    .aya-scroll::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.25);
        border-radius: 10px;
    }

.ayah-text {
    display: inline-block;
    font-family: 'UthmanicHafs', 'Amiri', 'Traditional Arabic', serif !important;
    white-space: nowrap;
    font-variant-ligatures: normal;
    font-feature-settings: "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
    padding-inline: 2px;
}
