/* ═══════════════════════════════════════════════════════
   Hadith Image Maker — app.css
   Design system matched to hijri.mzift.com
   Author: Muhammad Zaigham - MZift.com
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Reset ──────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── Design Tokens ──────────────────────────────────── */
:root {
    /* Primary (teal-green, matches hijri site) */
    --primary-50:  #ecfdf5;
    --primary-100: #d1fae5;
    --primary-200: #a7f3d0;
    --primary-300: #6ee7b7;
    --primary-400: #34d399;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065f46;
    --primary-900: #064e3b;

    /* Accent (amber/gold) */
    --accent-300: #fcd34d;
    --accent-400: #fbbf24;
    --accent-500: #f59e0b;
    --accent-600: #d97706;

    /* Surfaces — Light */
    --bg-body:     #f8f6f1;
    --bg-glass:    rgba(255, 255, 255, 0.72);
    --bg-glass-hover: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(0, 0, 0, 0.06);
    --border-light: rgba(0, 0, 0, 0.08);

    /* Text — Light (WCAG AA 4.5:1 on #f8f6f1) */
    --text-primary:   #111827;  /* 15.4:1 ✓ */
    --text-secondary: #374151;  /* 10.1:1 ✓ */
    --text-tertiary:  #6b7280;  /*  5.0:1 ✓ */
    --text-muted:     #9ca3af;  /*  3.0:1 — decorative only, not for readable text */

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg:  0 8px 30px rgba(0,0,0,0.08);
    --shadow-glow: 0 0 20px rgba(16,185,129,0.15);
    --shadow-glass: 0 8px 32px rgba(0,0,0,0.06);

    /* Radius */
    --radius-md:  0.75rem;
    --radius-lg:  1rem;
    --radius-xl:  1.25rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-4xl: 2.5rem;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* ─── Dark Mode ──────────────────────────────────────── */
.dark {
    --bg-body:     #0c0f14;
    --bg-glass:    rgba(17, 24, 39, 0.72);
    --bg-glass-hover: rgba(17, 24, 39, 0.85);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.08);

    --text-primary:   #f9fafb;  /* 18.3:1 ✓ */
    --text-secondary: #d1d5db;  /* 12.5:1 ✓ */
    --text-tertiary:  #9ca3af;  /*  7.2:1 ✓ */
    --text-muted:     #6b7280;  /*  4.1:1 — decorative only */

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg:  0 8px 30px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(16,185,129,0.2);
    --shadow-glass: 0 8px 32px rgba(0,0,0,0.2);
}

/* ─── Base ───────────────────────────────────────────── */
html {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ─── Glass Morphism ─────────────────────────────────── */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

/* ─── Background Patterns ────────────────────────────── */
.pattern-islamic {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L30 60M0 30L60 30M0 0L60 60M60 0L0 60' stroke='%2310b981' stroke-width='0.3' fill='none' opacity='0.15'/%3E%3C/svg%3E");
    background-size: 60px 60px;
}

.dark .pattern-islamic {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L30 60M0 30L60 30M0 0L60 60M60 0L0 60' stroke='%2310b981' stroke-width='0.3' fill='none' opacity='0.06'/%3E%3C/svg%3E");
}

.pattern-geometric {
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 0L40 20L20 40L0 20Z' stroke='%2310b981' stroke-width='0.3' fill='none' opacity='0.1'/%3E%3C/svg%3E");
    background-size: 40px 40px;
}

.dark .pattern-geometric {
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 0L40 20L20 40L0 20Z' stroke='%2310b981' stroke-width='0.3' fill='none' opacity='0.04'/%3E%3C/svg%3E");
}

/* ─── Text Gradient ──────────────────────────────────── */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Border Gradient ────────────────────────────────── */
.border-gradient {
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    padding: 1px;
    border-radius: var(--radius-4xl);
}

.border-gradient > * {
    border-radius: calc(var(--radius-4xl) - 1px);
}

/* ─── Card Hover ─────────────────────────────────────── */
.card-hover {
    transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ─── Glow Shadow ────────────────────────────────────── */
.shadow-glow {
    box-shadow: var(--shadow-glow);
}

/* ─── Layout ─────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 64rem; /* 1024px, matches hijri's max-w-5xl */
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (min-width: 1024px) {
    .container { padding: 0 2rem; }
}

/* ─── Navigation ─────────────────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border-glass);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4.5rem;
    padding: 0;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo img {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
}

.nav-logo span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
}

.nav-link:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.nav-divider {
    width: 1px;
    height: 1.5rem;
    background: var(--border-light);
    margin: 0 0.5rem;
}

/* ─── Theme Toggle ───────────────────────────────────── */
.theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
}

.theme-toggle:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Light mode: show moon icon */
.icon-sun { display: none; }
.icon-moon { display: block; }
.dark .icon-sun { display: block; }
.dark .icon-moon { display: none; }

/* ─── Mobile Menu ────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-xl);
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
}

.mobile-menu-btn:hover {
    background: var(--border-light);
}

.mobile-menu-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.nav-desktop-links { display: flex; align-items: center; gap: 0.25rem; }

@media (max-width: 640px) {
    .nav-desktop-links { display: none; }
    .mobile-menu-btn { display: flex; }
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms var(--ease), visibility 300ms;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Drawer */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 18rem;
    z-index: 9999;
    background: var(--bg-body);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 300ms var(--ease);
}

.mobile-drawer.active {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.mobile-drawer-close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--border-light);
    cursor: pointer;
    color: var(--text-tertiary);
}

.mobile-drawer-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--duration) var(--ease);
}

.mobile-nav-link:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.mobile-nav-link svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ─── Section Styling ────────────────────────────────── */
.section {
    margin-bottom: 4rem;
}

.section-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: var(--radius-4xl);
    border: 1px solid var(--border-glass);
    padding: 2rem 2.5rem;
}

@media (max-width: 640px) {
    .section-card { padding: 1.5rem; border-radius: var(--radius-3xl); }
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ─── Form Controls ──────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.6rem 0.85rem;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    -webkit-appearance: none;
}

.form-textarea {
    min-height: 7.5rem;
    resize: vertical;
    line-height: 1.75;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-select { cursor: pointer; }

/* ─── Grid Helpers ───────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }

@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; }
}

/* ─── Pill Buttons ───────────────────────────────────── */
.pill-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.pill {
    padding: 0.4rem 0.85rem;
    min-height: 2.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pill:hover {
    border-color: var(--primary-400);
    color: var(--text-secondary);
}

.pill.active {
    background: var(--primary-600);
    color: #fff;
    border-color: var(--primary-600);
}

/* ─── Palette Swatches ───────────────────────────────── */
.palette-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-top: 0.4rem;
    margin-bottom: 0.15rem;
}

.palette-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.palette-btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color var(--duration) var(--ease), transform 150ms var(--ease);
    flex-shrink: 0;
}

.palette-btn:hover { transform: scale(1.12); }

.palette-btn.active {
    border-color: var(--primary-500);
    transform: scale(1.12);
    box-shadow: var(--shadow-glow);
}

.palette-btn .sw-t,
.palette-btn .sw-b {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
}

.palette-btn .sw-t { top: 0; }
.palette-btn .sw-b { bottom: 0; }

/* ─── Primary Button ────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.75rem;
    background: var(--primary-600);
    color: #fff;
    border: none;
    border-radius: var(--radius-2xl);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* ─── Secondary / Share Buttons ──────────────────────── */
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-2xl);
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--duration) var(--ease);
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-share svg {
    width: 1.15rem;
    height: 1.15rem;
}

.btn-share.whatsapp  { background: #25D366; }
.btn-share.whatsapp:hover { background: #20bd5a; }
.btn-share.facebook  { background: #1877F2; }
.btn-share.facebook:hover { background: #166fe5; }
.btn-share.x-twitter { background: #000; }
.dark .btn-share.x-twitter { background: #fff; color: #000; }
.btn-share.x-twitter:hover { background: #1a1a1a; }
.dark .btn-share.x-twitter:hover { background: #e5e5e5; }
.btn-share.telegram  { background: #0088cc; }
.btn-share.telegram:hover { background: #007ab8; }
.btn-share.linkedin  { background: #0A66C2; }
.btn-share.linkedin:hover { background: #095196; }
.btn-share.copy-link { background: #6b7280; }
.dark .btn-share.copy-link { background: #4b5563; }
.btn-share.copy-link:hover { background: #555; }

.btn-share .btn-label { display: none; }
@media (min-width: 640px) { .btn-share .btn-label { display: inline; } }

/* ─── Footer ─────────────────────────────────────────── */
.site-footer {
    position: relative;
    border-top: 1px solid var(--border-glass);
    margin-top: auto;
}

.footer-cta {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-glass);
}

.footer-cta-card {
    text-align: center;
}

.footer-cta-icon {
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-3xl);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-glow);
}

.footer-cta-icon svg {
    width: 1.75rem;
    height: 1.75rem;
    color: #fff;
}

.footer-cta h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.footer-cta-hadith {
    color: var(--text-tertiary);
    max-width: 28rem;
    margin: 0 auto 2rem;
    font-size: 0.9rem;
    font-style: italic;
}

.footer-share-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.footer-links {
    padding: 2.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .footer-links {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-brand img {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
}

.footer-brand-name {
    font-weight: 700;
    color: var(--text-primary);
}

.footer-copyright {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-nav a {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    transition: color var(--duration) var(--ease);
}

.footer-nav a:hover {
    color: var(--primary-500);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-glass);
    text-align: center;
}

.footer-bottom p {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.footer-dot {
    margin: 0 0.5rem;
    opacity: 0.5;
}

/* ─── SEO Content Sections ───────────────────────────── */
.seo-section h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-glass);
}

.seo-section h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.seo-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 0.925rem;
}

.seo-section a {
    color: var(--primary-600);
    transition: color var(--duration) var(--ease);
}

.seo-section a:hover {
    text-decoration: underline;
}

/* ─── FAQ Accordion ──────────────────────────────────── */
.faq-item {
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    overflow: hidden;
}

.faq-item + .faq-item { margin-top: 0.6rem; }

.faq-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.faq-toggle h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.faq-toggle .faq-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: transform var(--duration) var(--ease);
}

.faq-item.open .faq-toggle .faq-icon {
    transform: rotate(180deg);
}

.faq-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms var(--ease);
}

.faq-item.open .faq-body {
    max-height: 20rem;
}

.faq-body-inner {
    padding: 0 1.5rem 1.25rem;
}

.faq-body-inner p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(1.5rem); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 600ms var(--ease) both;
}

.animate-slide-up {
    animation: slideUp 600ms var(--ease) both;
}

/* ─── Utility ────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.dim-text {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
}

/* ─── Toast Notification ─────────────────────────────── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-2xl);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 300ms var(--ease);
}

.toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
