/* ============================================================
 * MuroJa'ah — assets/css/style.css
 * Global styles + komponen utama
 * Mood: minimalis premium, biru soft, typography-driven
 * Mobile-optimized untuk semua ukuran HP.
 * ============================================================ */

/* ============================================================
 *  RESET & BASE
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;                    /* cegah horizontal scroll di mobile */
    min-height: 100vh;
    min-height: 100svh;                    /* small viewport untuk mobile chrome */
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* Cegah iOS Safari zoom saat focus input (font >=16px) */
@media (max-width: 768px) {
    input, textarea, select { font-size: 16px !important; }
}

/* ============================================================
 *  CSS VARIABLES (palet + tokens)
 * ============================================================ */
:root {
    --primary:        #1E88E5;
    --primary-dark:   #1565C0;
    --primary-light:  #E3F2FD;
    --accent:         #FFB300;
    --accent-soft:    #FFF3CD;
    --success:        #10B981;
    --danger:         #EF4444;
    --warning:        #F59E0B;
    --text:           #0F172A;
    --text-soft:      #64748B;
    --text-mute:      #94A3B8;
    --bg:             #F8FAFC;
    --surface:        #FFFFFF;
    --border:         #E2E8F0;
    --shadow-sm:      0 1px 2px rgba(15,23,42,.05);
    --shadow:         0 4px 14px rgba(30,136,229,.08);
    --shadow-lg:      0 12px 32px rgba(15,23,42,.10);
    --radius:         14px;
    --radius-sm:      10px;
    --radius-lg:      20px;
    --nav-h:          64px;
    --container:      1140px;
}

/* ============================================================
 *  TYPOGRAPHY
 * ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 .5em;
    letter-spacing: -.01em;
}
h1 { font-size: clamp(1.5rem, 4vw + .25rem, 2.75rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.375rem, 2vw + .5rem, 2rem); letter-spacing: -.015em; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
p  { margin: 0 0 1em; color: var(--text-soft); }
strong { font-weight: 600; color: var(--text); }
small  { font-size: .875em; color: var(--text-mute); }

/* Font Arab — switchable via body class */
.font-arab-amiri        .ayat-arab, .font-arab-amiri        .arab-text { font-family: 'Amiri', 'Scheherazade New', serif; }
.font-arab-scheherazade .ayat-arab, .font-arab-scheherazade .arab-text { font-family: 'Scheherazade New', 'Amiri', serif; }
.font-arab-lateef       .ayat-arab, .font-arab-lateef       .arab-text { font-family: 'Lateef', 'Amiri', serif; }
.font-arab-noto-naskh   .ayat-arab, .font-arab-noto-naskh   .arab-text { font-family: 'Noto Naskh Arabic', 'Amiri', serif; }
.font-arab-uthmanic     .ayat-arab, .font-arab-uthmanic     .arab-text { font-family: 'KFGQPC Uthmanic Hafs', 'Amiri', serif; }

.ayat-arab, .arab-text {
    direction: rtl;
    text-align: right;
    line-height: 2.2;
    font-size: 1.75rem;
}

/* ============================================================
 *  LAYOUT
 * ============================================================ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
.main { min-height: calc(100vh - var(--nav-h) - 200px); padding-top: var(--nav-h); }
.section { padding: 3rem 0; }
@media (max-width: 640px) {
    .section { padding: 2rem 0; }
    .container { padding: 0 1rem; }
}
@media (max-width: 380px) {
    .container { padding: 0 .875rem; }
}

/* ============================================================
 *  NAVBAR
 * ============================================================ */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
.nav-inner { display: flex; align-items: center; height: 100%; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); font-size: 1.125rem; }
.brand-icon { width: 32px; height: 32px; flex: 0 0 auto; }
.brand:hover { color: var(--primary-dark); }

.nav-links { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav-link {
    padding: .5rem .875rem;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-weight: 500;
    font-size: .9375rem;
    transition: all .2s;
}
.nav-link:hover, .nav-link.active { background: var(--primary-light); color: var(--primary); }
.nav-link.active { font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: .5rem; }

/* Hamburger */
.nav-toggle {
    display: none;
    width: 44px; height: 44px;          /* ukuran touch-friendly */
    background: transparent; border: 0;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.nav-toggle:active { background: var(--primary-light); }
.nav-toggle span {
    display: block;
    width: 22px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s, opacity .2s;
    pointer-events: none;               /* span tidak menerima click */
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.4);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
    z-index: 90;
}
.nav-backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-actions { margin-left: auto; gap: .25rem; }
    /* Login button tetap muncul di mobile (dipindah ke kanan, sebelum hamburger) */
    .nav-actions .btn { font-size: .8125rem; padding: .375rem .625rem; }

    .nav-links {
        position: fixed; top: var(--nav-h); right: 0;
        width: min(80vw, 320px); height: calc(100vh - var(--nav-h));
        background: var(--surface);
        flex-direction: column; align-items: stretch; gap: 0;
        padding: 1rem;
        transform: translateX(100%);
        transition: transform .3s ease;
        box-shadow: var(--shadow-lg);
        margin-left: 0;
        overflow-y: auto;
        z-index: 95;
    }
    .nav-links.open { transform: translateX(0); }
    .nav-link { padding: .875rem 1rem; font-size: 1rem; }
}

@media (max-width: 380px) {
    .brand-text { font-size: 1rem; }
    .nav-actions .btn { font-size: .75rem; padding: .3rem .5rem; }
}

/* ============================================================
 *  BUTTONS
 * ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .75rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 0; background: transparent;
    font-weight: 600; font-size: .9375rem; line-height: 1;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); color: #fff; }
.btn-ghost  { background: var(--primary-light); color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #DC2626; color: #fff; }
.btn-sm { padding: .5rem .875rem; font-size: .875rem; }
.btn-lg { padding: 1rem 1.75rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

.icon-btn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; color: var(--text-soft);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: all .2s;
    -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary); }
.icon-btn:active { background: var(--primary-light); }

/* ============================================================
 *  CARDS
 * ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
@media (max-width: 480px) {
    .card { padding: 1rem; }
}
.card-hover { transition: transform .2s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ============================================================
 *  FORMS
 * ============================================================ */
.form-group { margin-bottom: 1.25rem; }
.label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 500;
    font-size: .875rem;
    color: var(--text);
}
.input, .textarea, .select {
    width: 100%;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,136,229,.15);
}
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }
.textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.form-error { color: var(--danger); font-size: .8125rem; margin-top: .375rem; }
.form-help  { color: var(--text-mute); font-size: .8125rem; margin-top: .375rem; }

/* PIN input */
.pin-input {
    display: flex; gap: .5rem; justify-content: center;
    flex-wrap: nowrap;
}
.pin-input input {
    width: 48px; height: 56px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 1.5rem; font-weight: 600;
    background: var(--surface);
    color: var(--text);
    transition: all .2s;
}
.pin-input input:focus {
    outline: 0; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,136,229,.15);
}
.pin-input input.filled { background: var(--primary-light); border-color: var(--primary); }
@media (max-width: 380px) {
    .pin-input { gap: .375rem; }
    .pin-input input { width: 40px; height: 48px; font-size: 1.25rem; }
}

/* ============================================================
 *  HERO
 * ============================================================ */
.hero {
    padding: 4rem 0 3rem;
    text-align: center;
}
.hero-tagline {
    font-size: 1.125rem;
    color: var(--text-soft);
    max-width: 560px;
    margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
@media (max-width: 480px) {
    .hero { padding: 2.5rem 0 2rem; }
    .hero-tagline { font-size: 1rem; margin-bottom: 1.5rem; }
    .hero-actions .btn-lg { padding: .75rem 1.25rem; font-size: .9375rem; }
}

/* ============================================================
 *  FOOTER
 * ============================================================ */
.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 2.5rem 0 1.5rem;
    margin-top: 4rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 2rem;
    align-items: start;
}
.footer-brand .footer-name { font-weight: 700; font-size: 1.125rem; color: var(--text); margin-bottom: .25rem; }
.footer-brand .footer-tagline { color: var(--text-soft); font-size: .9375rem; }
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { color: var(--text-soft); font-size: .9375rem; }
.footer-links a:hover { color: var(--primary); }
.footer-meta { text-align: right; color: var(--text-mute); font-size: .8125rem; }
.footer-version { margin-top: .25rem; }
@media (max-width: 640px) {
    .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .footer-meta { text-align: left; }
    .footer { padding: 2rem 0 1.25rem; margin-top: 2.5rem; }
}

/* ============================================================
 *  MODAL
 * ============================================================ */
.modal {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
    padding: 1rem;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    transform: scale(.95); transition: transform .25s;
    box-shadow: var(--shadow-lg);
}
.modal.show .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-title  { font-size: 1.25rem; font-weight: 600; margin: 0; }
.modal-close  {
    font-size: 1.5rem; background: transparent; border: 0;
    color: var(--text-mute); cursor: pointer;
    line-height: 1; padding: .25rem .5rem;
    -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { color: var(--text); }
@media (max-width: 480px) {
    .modal-content { padding: 1.25rem; border-radius: var(--radius); }
    .modal-title { font-size: 1.125rem; }
}

/* ============================================================
 *  ALERTS / TOAST
 * ============================================================ */
.alert {
    padding: .875rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9375rem;
    display: flex; align-items: flex-start; gap: .5rem;
}
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #BFDBFE; }

/* ============================================================
 *  BADGES
 * ============================================================ */
.badge {
    display: inline-block;
    padding: .25rem .625rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-mute    { background: var(--bg); color: var(--text-soft); }

/* ============================================================
 *  UTILITY CLASSES
 * ============================================================ */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-soft    { color: var(--text-soft); }
.text-mute    { color: var(--text-mute); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.mt-0 { margin-top: 0; }       .mt-1 { margin-top: .5rem; }   .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }  .mt-4 { margin-top: 2rem; }    .mt-5 { margin-top: 3rem; }
.mb-0 { margin-bottom: 0; }    .mb-1 { margin-bottom: .5rem; }.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }.mb-4 { margin-bottom: 2rem; }.mb-5 { margin-bottom: 3rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.flex          { display: flex; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.grid    { display: grid; }
.grid-2  { grid-template-columns: repeat(2, 1fr); }
.grid-3  { grid-template-columns: repeat(3, 1fr); }
.grid-4  { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ============================================================
 *  ANIMATIONS (CSS fallback)
 * ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .4s ease forwards; }

.loader {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 1rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skip to content (a11y) */
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--primary); color: #fff;
    padding: .5rem 1rem; z-index: 999;
}
.skip-link:focus { left: 0; }
