@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
    --bg-dark: #080d1a;
    --bg-darker: #050810;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --gold: #d4a853;
    --gold-light: #f0c97a;
    --gold-dim: rgba(212, 168, 83, 0.2);
    --green: #2ecc71;
    --green-dark: #27ae60;
    --green-dim: rgba(46, 204, 113, 0.15);
    --red: #e74c3c;
    --red-dim: rgba(231, 76, 60, 0.15);
    --yellow: #f39c12;
    --yellow-dim: rgba(243, 156, 18, 0.15);
    --text-primary: #f0ead6;
    --text-secondary: #a8b4c4;
    --text-muted: #5a6a7a;
    --glass-border: rgba(212, 168, 83, 0.15);
    --glass-border-hover: rgba(212, 168, 83, 0.4);
    --shadow-gold: 0 0 30px rgba(212, 168, 83, 0.15);
    --shadow-green: 0 0 20px rgba(46, 204, 113, 0.3);
    --z-toast: 2000;
    --z-modal: 2500;
    --z-navbar: 1000;
}

html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.65;
    font-size: 16px;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-wrap: pretty;
}

/* Accessibility: skip link + focus */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--gold);
    color: #080d1a;
    padding: 0.6rem 1rem;
    border-radius: 0 0 10px 0;
    font-weight: 700;
    z-index: 3000;
}
.skip-link:focus {
    left: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.juz-card:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

/* Star background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 160px 120px, #ffffff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: twinkle 5s infinite linear;
    z-index: -1;
    opacity: 0.3;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.4px; }
h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.3px; }
h4 { font-size: 1.15rem; font-weight: 600; }

.arabic {
    font-family: 'Amiri', serif;
    font-size: 2.2rem;
    line-height: 1.8;
    text-align: center;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(212, 168, 83, 0.3);
    margin-bottom: 1.25rem;
}

/* Gradient Text Utilities */
.text-gradient-gold {
    background: linear-gradient(135deg, #f0c97a 0%, #d4a853 50%, #b8860b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Tabular Numbers for Stat Counts */
.stat-num, .timer-display, #selection-count, #khotmil-percent-text {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-variant-numeric: tabular-nums;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 4px 15px var(--gold-dim);
}

input[aria-invalid="true"] {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red);
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.field-error {
    font-size: 0.82rem;
    color: #ff9d8a;
    margin-top: 0.35rem;
    min-height: 1.1em;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.05rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
}

.password-toggle:hover {
    color: var(--gold);
}

/* Skeleton loading */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    min-height: 120px;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.12), transparent);
    animation: shimmer 1.4s infinite;
}

.empty-state {
    text-align: center;
    padding: 2rem 1.25rem;
    border: 1px dashed var(--glass-border-hover);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 200ms ease, background 200ms ease, border-color 200ms ease;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    text-decoration: none;
    min-height: 44px;
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--bg-darker);
    box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 168, 83, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--gold);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--gold);
}

.btn-success {
    background: var(--green);
    color: white;
    box-shadow: var(--shadow-green);
}

.btn-success:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Utilities */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.w-100 { width: 100%; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}
