
/* =========================================================
   IQRANIX — PREMIUM QURAN READER
   Full-screen Mushaf-inspired design
========================================================= */

:root {
    --app-bg: #081a17;
    --gold: #c9a45c;
    --gold-light: #e4ca8e;
    --page-bg: #f8f0dc;
    --page-ink: #29271f;
    --page-border: #b89552;
    --arabic-font: "Amiri", serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: "DM Sans", sans-serif;
    background: var(--app-bg);
    color: white;
}

button,
select {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
}

[hidden] {
    display: none !important;
}

/* MAIN APPLICATION */

.reader-app {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(
            ellipse at 50% 35%,
            #18392c 0%,
            #0b211a 48%,
            #071510 100%
        );
}

/* HEADER */

.reader-header {
    height: 66px;
    min-height: 66px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(201, 164, 92, 0.17);
    background: rgba(5, 19, 15, 0.8);
}

.back-button,
.settings-button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--gold-light);
    background: rgba(201, 164, 92, 0.09);
    border: 1px solid rgba(201, 164, 92, 0.2);
    text-decoration: none;
}

.back-button span {
    font-family: Arial, sans-serif;
    font-size: 32px;
    line-height: 1;
    margin-top: -4px;
}

.settings-button {
    font-size: 20px;
}

.header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.brand-name {
    font-family: "Playfair Display", serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--gold-light);
}

.brand-subtitle {
    font-size: 8px;
    letter-spacing: 2.5px;
    color: #aab5a8;
}

/* SURAH AND JUZ NAVIGATION */

.reader-navigation {
    min-height: 58px;
    padding: 7px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid rgba(201, 164, 92, 0.12);
}

.navigation-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 105px;
}

.navigation-field label {
    font-size: 8px;
    letter-spacing: 1.8px;
    color: var(--gold);
    font-weight: 700;
}

.navigation-field select {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #f2e7cf;
    font-size: 12px;
    font-weight: 600;
}

.navigation-field select option {
    background: #10251d;
    color: white;
}

.navigation-divider {
    width: 1px;
    height: 30px;
    background: rgba(201, 164, 92, 0.3);
}

/* PAGE INFORMATION */

.page-information {
    height: 34px;
    min-height: 34px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.page-info-line {
    width: 36px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--gold)
    );
}

.page-info-line:last-child {
    transform: rotate(180deg);
}

.page-info-content {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 9px;
    letter-spacing: 1.3px;
    font-weight: 700;
    color: var(--gold-light);
}

.page-info-dot {
    font-size: 11px;
    color: var(--gold);
}

/* READING AREA */

.mushaf-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 5px 10px 7px;
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: relative;
    overflow: hidden;
    perspective: 1200px;
    touch-action: pan-y;
}

/* MUSHAF PAGE */

.mushaf-page {
    width: 100%;
    max-width: 570px;
    height: 100%;
    min-height: 0;
    position: relative;
    background: var(--page-bg);
    color: var(--page-ink);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(201, 164, 92, 0.3);
    overflow: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

.page-outer-border {
    position: absolute;
    inset: 6px;
    border: 2px solid var(--page-border);
    padding: 4px;
}

.page-inner-border {
    width: 100%;
    height: 100%;
    position: relative;
    border: 1px solid var(--page-border);
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* DECORATIVE CORNERS */

.page-corner {
    position: absolute;
    z-index: 3;
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    font-size: 21px;
    color: var(--page-border);
    line-height: 1;
    background: var(--page-bg);
}

.corner-top-left {
    top: -11px;
    left: -11px;
}

.corner-top-right {
    top: -11px;
    right: -11px;
}

.corner-bottom-left {
    bottom: -11px;
    left: -11px;
}

.corner-bottom-right {
    bottom: -11px;
    right: -11px;
}

/* PAGE HEADER */

.mushaf-page-header {
    min-height: 31px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-decoration-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--page-border),
        transparent
    );
}

.page-number-ornament {
    min-width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border: 1px solid var(--page-border);
    border-radius: 50%;
    color: var(--page-ink);
    font-family: var(--arabic-font);
    font-size: 14px;
}

/* SURAH HEADING */

.surah-heading {
    min-height: 37px;
    margin: 4px 0;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-top: 1px solid var(--page-border);
    border-bottom: 1px solid var(--page-border);
    color: var(--page-ink);
    font-family: var(--arabic-font);
    font-size: clamp(16px, 4.5vw, 22px);
    font-weight: 700;
    text-align: center;
}

.surah-heading-decoration {
    color: var(--page-border);
    font-size: 15px;
}

/* BASMALAH */

.basm alah {
    display: none;
}

.basm alah {
    text-align: center;
}

.basm alah {
    color: var(--page-ink);
}

.basm alah {
    font-family: var(--arabic-font);
}

.basm alah {
    font-size: 23px;
}

.basm alah {
    line-height: 1.8;
}

.basm alah {
    padding: 5px 0;
}

.basm alah {
    direction: rtl;
}

.basm alah {
    white-space: nowrap;
}

.basm alah {
    overflow: hidden;
}

.basm alah {
    text-overflow: clip;
}

.basm alah {
    margin: 0 auto;
}

.basm alah {
    max-width: 100%;
}

.basm alah {
    flex-shrink: 0;
}

/* Correct HTML class: basmalah */

.basmalah {
    flex-shrink: 0;
    padding: 4px 0;
    color: var(--page-ink);
    font-family: var(--arabic-font);
    font-size: clamp(19px, 5vw, 24px);
    line-height: 1.7;
    text-align: center;
    direction: rtl;
    white-space: nowrap;
}

/* QURAN TEXT */

.mushaf-text {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    direction: rtl;
    text-align: justify;
    color: var(--page-ink);
    font-family: var(--arabic-font);
    font-size: clamp(17px, 4.8vw, 24px);
    font-weight: 700;
    line-height: 2.05;
    word-spacing: 1px;
    overflow-wrap: normal;
    unicode-bidi: plaintext;
}

.mushaf-text .ayah {
    display: inline;
    white-space: normal;
}

.ayah-number {
    display: inline-block;
    margin: 0 3px;
    color: var(--page-border);
    font-family: var(--arabic-font);
    font-size: 0.85em;
    white-space: nowrap;
}

.quran-placeholder {
    text-align: center;
    font-size: 36px;
    color: var(--page-border);
}

/* PAGE FOOTER */

.mushaf-page-footer {
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--page-border);
    font-family: var(--arabic-font);
    font-size: 12px;
    font-weight: 700;
}

.footer-decoration {
    width: 27px;
    height: 1px;
    background: var(--page-border);
}

/* PAGE CONTROLS */

.reader-controls {
    height: 66px;
    min-height: 66px;
    padding: 5px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(5, 19, 15, 0.95);
    border-top: 1px solid rgba(201, 164, 92, 0.2);
}

.page-turn-button {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(201, 164, 92, 0.1);
    border: 1px solid rgba(201, 164, 92, 0.35);
    color: var(--gold-light);
    transition: background 0.2s ease;
}

.page-turn-button:active {
    background: rgba(201, 164, 92, 0.28);
}

.page-turn-button span {
    font-size: 32px;
    line-height: 1;
    margin-top: -5px;
}

.page-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.page-counter-label {
    color: #9da99e;
    font-size: 8px;
    letter-spacing: 2px;
}

.page-counter > div {
    color: var(--gold-light);
    font-family: "Playfair Display", serif;
    font-size: 18px;
    font-weight: 600;
}

.counter-divider {
    color: #78877a;
    margin: 0 5px;
    font-size: 13px;
}

/* LOADING STATE */

.reader-loading {
    position: absolute;
    inset: 5px 10px 7px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--page-bg);
    color: var(--page-ink);
    font-family: var(--arabic-font);
    font-size: 16px;
}

.loading-ornament {
    color: var(--gold-dark);
    font-size: 40px;
    animation: loadingRotate 4s linear infinite;
}

@keyframes loadingRotate {
    to {
        transform: rotate(360deg);
    }
}

/* ERROR STATE */

.reader-error {
    position: absolute;
    inset: 5px 10px 7px;
    z-index: 12;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 13px;
    padding: 20px;
    background: var(--page-bg);
    color: var(--page-ink);
    text-align: center;
}

.error-symbol {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--gold-dark);
    border-radius: 50%;
    color: var(--gold-dark);
    font-size: 22px;
}

.reader-error p {
    font-size: 13px;
}

.reader-error button {
    padding: 10px 22px;
    border-radius: 20px;
    background: #173c2c;
    color: white;
}

/* SETTINGS OVERLAY */

.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: 0.25s ease;
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    width: 100%;
    max-width: 450px;
    padding: 24px 20px 30px;
    border-radius: 22px;
    background: #10271e;
    border: 1px solid rgba(201, 164, 92, 0.35);
    transform: translateY(30px);
    transition: transform 0.25s ease;
}

.settings-overlay.open .settings-panel {
    transform: translateY(0);
}

.settings-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-eyebrow {
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--gold);
}

.settings-heading h2 {
    margin-top: 5px;
    font-family: "Playfair Display", serif;
    font-size: 21px;
    color: #f4e8cd;
}

.close-settings {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    color: white;
    background: rgba(255, 255, 255, 0.08);
    font-size: 23px;
}

.settings-description {
    margin: 15px 0 20px;
    font-size: 12px;
    color: #aeb9ad;
}

.page-colour-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.colour-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 9px 4px;
    border-radius: 12px;
    color: #e6e5d9;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid transparent;
    font-size: 10px;
}

.colour-option.active {
    border-color: var(--gold);
    background: rgba(201, 164, 92, 0.12);
}

.colour-preview {
    width: 38px;
    height: 48px;
    border-radius: 4px;
    border: 2px solid var(--gold-dark);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.cream-preview {
    background: #f8f0dc;
}

.white-preview {
    background: #ffffff;
}

.green-preview {
    background: #e4eee0;
}

.dark-preview {
    background: #202923;
}

/* PAGE COLOUR THEMES */

.mushaf-page[data-theme="cream"] {
    --page-bg: #f8f0dc;
    --page-ink: #29271f;
    --page-border: #b89552;
}

.mushaf-page[data-theme="white"] {
    --page-bg: #ffffff;
    --page-ink: #202020;
    --page-border: #a98a4e;
}

.mushaf-page[data-theme="green"] {
    --page-bg: #e4eee0;
    --page-ink: #24372b;
    --page-border: #839b70;
}

.mushaf-page[data-theme="dark"] {
    --page-bg: #202923;
    --page-ink: #f2e9d6;
    --page-border: #b99a5c;
}

.mushaf-page[data-theme="dark"] .page-corner {
    background: #202923;
}

/* TOAST */

.reader-toast {
    position: fixed;
    z-index: 80;
    bottom: 80px;
    left: 50%;
    transform: translate(-50%, 15px);
    padding: 10px 17px;
    border-radius: 30px;
    background: #d4b878;
    color: #17251d;
    font-size: 11px;
    font-weight: 700;
    opacity: 0;
    visibility: hidden;
    transition: 0.25s ease;
    white-space: nowrap;
}

.reader-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* SMALL MOBILE SCREENS */

@media (max-width: 380px) {
    .reader-header {
        height: 58px;
        min-height: 58px;
        padding: 0 12px;
    }

    .reader-navigation {
        min-height: 52px;
        gap: 17px;
        padding: 6px 12px;
    }

    .page-information {
        height: 29px;
        min-height: 29px;
    }

    .mushaf-container {
        padding: 3px 6px 5px;
    }

    .page-outer-border {
        inset: 4px;
        padding: 3px;
    }

    .page-inner-border {
        padding: 7px;
    }

    .mushaf-text {
        font-size: 17px;
        line-height: 1.95;
    }

    .reader-controls {
        height: 60px;
        min-height: 60px;
        padding: 4px 20px;
    }

    .page-turn-button {
        width: 39px;
        height: 39px;
    }
}

/* LANDSCAPE SCREENS */

@media (orientation: landscape) and (max-height: 500px) {
    .reader-header {
        height: 43px;
        min-height: 43px;
    }

    .reader-navigation {
        min-height: 38px;
    }

    .page-information {
        height: 23px;
        min-height: 23px;
    }

    .reader-controls {
        height: 45px;
        min-height: 45px;
    }

    .mushaf-text {
        font-size: 17px;
        line-height: 1.65;
    }

    .surah-heading {
        min-height: 25px;
        margin: 2px 0;
        padding: 2px;
    }

    .basmalah {
        font-size: 17px;
        padding: 2px 0;
    }
}
