@font-face {
    font-family: 'KFGQPC';
    src: url('../fonts/KfgqpcHafsUthmanicScriptRegular-1jGEe.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'AmiriQuran';
    src: url('../fonts/Amiri-Regular.ttf') format('truetype');
    font-display: swap;
}

:root {
    --bg-dark: #021a25;
    --bg-dark-2: #072a38;
    --cyan: #33b8de;
    --cyan-soft: #58cceb;
    --ink: #f7fdff;
    --muted: #bfdbe4;
    --line: rgba(78, 196, 226, .24);
    --card: rgba(0, 14, 23, .68);
    --card-border: rgba(78, 196, 226, .20);
    --gold: #e0eef4;

    --admin-bg: #09151d;
    --admin-card: rgba(10, 25, 35, .92);
    --admin-line: rgba(104, 157, 180, .22);
    --admin-ink: #e8f6fb;
    --admin-muted: #9bc5d4;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    direction: rtl;
    font-family: 'KFGQPC', 'AmiriQuran', 'Amiri', Tahoma, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.container { max-width: 1180px; margin: 0 auto; padding: 24px; }
.muted { color: var(--admin-muted); }
.empty { padding: 28px; text-align: center; }
.footer-space { height: 34px; }

/* buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: .18s ease;
    cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(180deg, #1f98c0, #137fa4); color: #fff; box-shadow: var(--shadow); }
.btn-light { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.btn-warning { background: #f0ad4e; color: #2a1d00; }
.btn-danger { background: #c62828; color: #fff; }
.btn-success { background: #1d9b52; color: #fff; }
.btn-secondary { background: #54616a; color: #fff; }
.btn-theme-login {
    background: linear-gradient(180deg, #0fa4c8, #0c7ea0);
    color: #fff;
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(12, 126, 160, .35);
}

/* public home */
.public-theme-body {
    background-image: linear-gradient(180deg, rgba(1,14,23,.96), rgba(2,24,37,.98)), url('../../background.png');
    background-position: center top;
    background-size: cover;
    background-repeat: no-repeat;

    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(27, 172, 214, .08), transparent 22%),
        linear-gradient(180deg, rgba(1,14,23,.96), rgba(2,24,37,.98)),
        url('../img/laylat_theme_reference.png') center top / cover fixed no-repeat;
}
.hero-theme {
    position: relative;
    min-height: 420px;
    border-bottom: 1px solid rgba(78,196,226,.2);
    overflow: hidden;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(1,14,23,.55));
}
.hero-content {
    position: relative;
    z-index: 1;
    padding-top: 36px;
    padding-bottom: 50px;
}
.hero-topline {
    width: fit-content;
    margin-inline-start: auto;
    font-size: 64px;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0,0,0,.55);
    line-height: 1;
}
.hero-intro {
    max-width: 520px;
    margin-inline-start: auto;
    margin-top: 12px;
    color: #d9eef5;
    line-height: 1.9;
    font-size: 18px;
    text-shadow: 0 2px 12px rgba(0,0,0,.45);
}
.hero-brand-row {
    display: grid;
    grid-template-columns: 1fr 230px;
    gap: 28px;
    align-items: end;
    margin-top: 36px;
}
.hero-title-block { text-align: center; }
.hero-title {
    margin: 0;
    color: #fff;
    font-size: 70px;
    line-height: 1.25;
    text-shadow: 0 4px 20px rgba(0,0,0,.45);
}
.hero-subtitle {
    margin: 18px 0 0;
    color: #ebf9ff;
    font-size: 22px;
    line-height: 1.8;
    text-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.hero-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-logo {
    width: 220px;
    filter: drop-shadow(0 6px 18px rgba(0,0,0,.35));
}

.schedule-container { padding-top: 24px; padding-bottom: 36px; }
.schedule-panel {
    background: rgba(0, 12, 19, .52);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 24px 22px 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
}
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.schedule-row {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 22px;
    align-items: center;
}
.schedule-row:hover .schedule-bar {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #42c6e8, #28aad0);
}
.schedule-label {
    color: #fff;
    font-size: 30px;
    line-height: 1.3;
    text-align: right;
    white-space: nowrap;
    text-shadow: 0 3px 14px rgba(0,0,0,.45);
}
.schedule-bar-wrap { min-width: 0; }
.schedule-bar {
    min-height: 52px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--cyan-soft), var(--cyan));
    box-shadow: 0 10px 24px rgba(36, 175, 213, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    transition: .18s ease;
}
.schedule-bar-text {
    color: #f7feff;
    font-size: 34px;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,.22);
}
.public-login-row {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}
.schedule-empty {
    color: #fff;
    background: rgba(0,0,0,.18);
    border: 1px dashed rgba(255,255,255,.18);
    border-radius: 18px;
}

/* admin + forms + login */
.admin-body,
body:not(.public-theme-body) {
    background:
        radial-gradient(circle at top, rgba(51,184,222,.08), transparent 22%),
        linear-gradient(180deg, #07131b 0%, #0d202b 100%);
    color: var(--admin-ink);
}
.topbar,
.admin-topbar {
    background: rgba(4, 16, 24, .88);
    border-bottom: 1px solid var(--admin-line);
    position: relative;
    z-index: 2;
}
.topbar-inner { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.brand h1 { margin: 0; font-size: 32px; color: #fff; }
.brand p { margin: 8px 0 0; color: var(--admin-muted); font-size: 16px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.action-stack { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-chip {
    background: rgba(51,184,222,.12);
    border: 1px solid rgba(51,184,222,.2);
    color: #d8f7ff;
    padding: 10px 14px;
    border-radius: 999px;
}

.card,
.admin-card,
.mushaf-shell {
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.card-body { padding: 24px; }
.section-title,
.card h2,
.login-title {
    margin: 0 0 18px;
    text-align: center;
    font-size: 42px;
    color: #fff;
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--admin-line);
    text-align: right;
    color: #eef9fc;
}
th { color: #9fd7e8; font-size: 17px; }
tr:hover td { background: rgba(51,184,222,.05); }
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 14px;
}
.badge-quran { background: rgba(51,184,222,.15); color: #9feaff; border: 1px solid rgba(51,184,222,.2); }
.badge-text { background: rgba(255,255,255,.07); color: #fff; border: 1px solid rgba(255,255,255,.1); }
.badge-enabled { background: rgba(29,155,82,.18); color: #9df0bf; border: 1px solid rgba(29,155,82,.28); }
.badge-disabled { background: rgba(198,40,40,.18); color: #ffb0b0; border: 1px solid rgba(198,40,40,.28); }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; }
.action-cell { min-width: 210px; }

label { font-weight: 700; color: #d8f2f9; }
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    border: 1px solid rgba(89, 164, 191, .28);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255,255,255,.06);
    color: #fff;
}
textarea { min-height: 260px; resize: vertical; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full { grid-column: 1 / -1; }
.grid-form,
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 18px; }
.narrow-container { max-width: 680px; margin: auto; }
.center { text-align: center; }
.center-actions { justify-content: center; }
.alert-danger,
.alert-success {
    padding: 14px 16px;
    border-radius: 14px;
    margin: 0 0 16px;
}
.alert-danger { background: rgba(198,40,40,.14); color: #ffd5d5; border: 1px solid rgba(198,40,40,.25); }
.alert-success { background: rgba(31,122,62,.14); color: #d8ffe4; border: 1px solid rgba(31,122,62,.22); }

/* view page */
.mushaf-shell {
    max-width: 1020px;
    margin: 28px auto 0;
    overflow: hidden;
}
.mushaf-header {
    text-align: center;
    padding: 28px 24px 8px;
    border-bottom: 1px solid rgba(51,184,222,.12);
}
.surah-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #3fc4e7, #2baace);
    color: #fff;
    margin-bottom: 14px;
}
.bismillah, .surah-title, .quran-text, .content-plain {
    font-family: 'KFGQPC', 'AmiriQuran', 'Amiri', serif;
}
.bismillah { color: #fff; font-size: 54px; line-height: 1.8; }
.surah-title { color: #fff; font-size: 46px; line-height: 1.7; margin: 0; }
.surah-meta, .meta-chip { color: #d2ecf4; }
.meta-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.meta-chip {
    border: 1px solid rgba(51,184,222,.2);
    background: rgba(255,255,255,.05);
    padding: 8px 12px;
    border-radius: 999px;
}
.mushaf-content { padding: 18px 34px 38px; text-align: center; }
.quran-text { color: #f9ffff; font-size: 44px; line-height: 2.15; word-spacing: .08em; }
.content-plain { color: #eefaff; white-space: pre-wrap; line-height: 2.2; font-size: 26px; }
.ayah-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 46px;
    margin: 0 8px;
    border-radius: 999px;
    background: rgba(51,184,222,.14);
    border: 1px solid rgba(51,184,222,.3);
    color: #aef2ff;
    font-size: 23px;
    vertical-align: middle;
}
.tw-green { color: #68e083; }
.tw-red { color: #ff8282; }
.tw-blue { color: #7ab4ff; }
.tw-gold { color: #ffd36a; }

@media (max-width: 980px) {
    .hero-brand-row { grid-template-columns: 1fr; }
    .hero-logo-wrap { order: -1; }
    .hero-topline { margin-inline: auto; font-size: 48px; }
    .hero-intro { margin-inline: auto; text-align: center; }
    .hero-title { font-size: 52px; }
    .hero-subtitle { font-size: 20px; }
    .schedule-row { grid-template-columns: 170px 1fr; gap: 16px; }
    .schedule-label { font-size: 24px; }
    .schedule-bar-text { font-size: 28px; }
    .grid-form, .form-grid, .form-options { grid-template-columns: 1fr; }
    .topbar-inner { flex-direction: column; align-items: stretch; }
    .actions { justify-content: center; }
}

@media (max-width: 700px) {
    .container { padding: 16px; }
    .hero-theme { min-height: 360px; }
    .hero-content { padding-top: 26px; padding-bottom: 32px; }
    .hero-topline { font-size: 40px; }
    .hero-intro { font-size: 16px; }
    .hero-logo { width: 150px; }
    .hero-title { font-size: 38px; }
    .hero-subtitle { font-size: 18px; }
    .schedule-panel { padding: 16px 14px 22px; }
    .schedule-row { grid-template-columns: 1fr; gap: 10px; }
    .schedule-label { text-align: center; font-size: 22px; }
    .schedule-bar { min-height: 58px; padding: 8px 14px; }
    .schedule-bar-text { font-size: 27px; }
    .section-title, .card h2, .login-title { font-size: 32px; }
    .brand h1 { font-size: 24px; line-height: 1.7; text-align: center; }
    .brand p { text-align: center; }
    .actions > .btn { width: 100%; }
    .mushaf-header { padding: 22px 14px 8px; }
    .surah-title { font-size: 32px; }
    .bismillah { font-size: 38px; }
    .mushaf-content { padding: 16px 14px 26px; }
    .quran-text { font-size: 30px; line-height: 2.2; }
    .content-plain { font-size: 22px; }
}


/* main page header/footer images only */
.main-page-media {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 18px 16px;
}
.main-header-image { padding-top: 26px; padding-bottom: 8px; }
.main-footer-image { padding-top: 14px; padding-bottom: 30px; }
.main-page-media img {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
}
.main-page-banner { max-width: 1100px; }
.main-page-qr { max-width: 980px; }

@media (max-width: 700px) {
    .main-page-media { padding-inline: 10px; }
    .main-header-image { padding-top: 14px; padding-bottom: 2px; }
    .main-footer-image { padding-top: 10px; padding-bottom: 20px; }
}

.visitor-counter{
    width: fit-content;
    margin: 30px auto 20px;
    padding: 10px 22px;
    border-radius: 999px;
    background: rgba(63, 188, 232, 0.16);
    border: 1px solid rgba(63, 188, 232, 0.40);
    color: #ffffff;
    font-size: 22px;
    line-height: 1.6;
    text-align: center;
    box-shadow: 0 0 18px rgba(0,0,0,.18);
}

/* ===== iPhone Safari fix for content view ===== */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    height: auto !important;
    min-height: 100vh;
    min-height: 100svh;
    min-height: -webkit-fill-available;
}

.view-page,
.content-page,
.page-view,
.mushaf-shell,
.main-content,
.view-container,
.content-container {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
}

/* important for Safari */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }

    .view-page,
    .content-page,
    .page-view,
    .main-content,
    .view-container,
    .content-container {
        min-height: auto !important;
        height: auto !important;
    }
}

/* prevent fixed footer/header from covering content */
.fixed-footer,
.qr-footer,
.main-footer,
.page-footer,
.fixed-bottom,
.bottom-bar {
    position: static !important;
}

/* if you use hero/content wrappers */
.hero,
.hero-section,
.top-section,
.content-section {
    height: auto !important;
    min-height: auto !important;
}
