/* ============================================
   EID CARD - STYLES
   ============================================ */

:root {
    --primary: #c8a45c;
    --primary-light: #e8d5a0;
    --primary-dark: #9e7d3a;
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-elevated: #1a1a25;
    --text: #f0ede6;
    --text-secondary: #8a8a9a;
    --border: rgba(200, 164, 92, 0.15);
    --glow: rgba(200, 164, 92, 0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
}

@font-face {
    font-family: 'DTHULUTH';
    src: url('fonts/DTHULUTH-II-1.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 3px; }

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

/* Particles */
#particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* Animations */
@keyframes fadeDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 20px var(--glow), 0 0 40px rgba(200, 164, 92, 0.1); } 50% { box-shadow: 0 0 30px var(--glow), 0 0 60px rgba(200, 164, 92, 0.2); } }
@keyframes scrollWheel { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-down { animation: fadeDown 0.8s ease forwards; }
.animate-fade-up { animation: fadeUp 0.8s ease forwards; opacity: 0; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

/* ============================================
   HERO
   ============================================ */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    padding: 40px 24px;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(200, 164, 92, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(200, 164, 92, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(200, 164, 92, 0.04) 0%, transparent 50%);
    z-index: 1;
}

.hero-content { position: relative; z-index: 2; max-width: 700px; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 50px;
    background: rgba(200, 164, 92, 0.1);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--primary-light);
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 20px;
}

.title-line { display: block; }

.title-gradient {
    background: linear-gradient(135deg, var(--primary), var(--primary-light), var(--primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s ease-in-out infinite;
}

.hero-desc { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 40px; max-width: 500px; margin-inline: auto; }

.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 60px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #0a0a0f; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--glow); }
.btn-glow { animation: glow 3s ease-in-out infinite; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: rgba(200, 164, 92, 0.1); border-color: var(--primary); }
.btn-full { width: 100%; justify-content: center; }

/* Stats */
.hero-stats { display: flex; align-items: center; justify-content: center; gap: 32px; }
.stat { text-align: center; }
.stat-number { display: block; font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-plus { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* Scroll Indicator */
.scroll-indicator { position: absolute; bottom: 40px; z-index: 2; }
.mouse { width: 24px; height: 38px; border: 2px solid var(--text-secondary); border-radius: 12px; display: flex; justify-content: center; padding-top: 8px; opacity: 0.5; }
.wheel { width: 3px; height: 8px; background: var(--text-secondary); border-radius: 2px; animation: scrollWheel 1.5s ease-in-out infinite; }

/* ============================================
   TEMPLATES SECTION
   ============================================ */
.templates-section { padding: 80px 0 100px; position: relative; z-index: 1; }

.section-header { text-align: center; margin-bottom: 48px; }

.section-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    background: rgba(200, 164, 92, 0.1);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.section-title { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; margin-bottom: 12px; }
.section-desc { color: var(--text-secondary); font-size: 1.1rem; }

/* Occasion Tabs */
.occasion-tabs { display: flex; gap: 12px; justify-content: center; margin-bottom: 48px; flex-wrap: wrap; }

.occasion-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.occasion-tab:hover:not(.disabled) { border-color: var(--primary); color: var(--text); }
.occasion-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--bg); border-color: transparent; font-weight: 600; }
.occasion-tab.disabled { opacity: 0.4; cursor: not-allowed; }
.tab-icon { font-size: 1.2rem; }

/* Template Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.template-card {
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    animation: slideIn 0.5s ease forwards;
    opacity: 0;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.template-card:nth-child(1) { animation-delay: 0s; }
.template-card:nth-child(2) { animation-delay: 0.05s; }
.template-card:nth-child(3) { animation-delay: 0.1s; }
.template-card:nth-child(4) { animation-delay: 0.15s; }
.template-card:nth-child(5) { animation-delay: 0.2s; }
.template-card:nth-child(6) { animation-delay: 0.25s; }
.template-card:nth-child(7) { animation-delay: 0.3s; }
.template-card:nth-child(8) { animation-delay: 0.35s; }
.template-card:nth-child(9) { animation-delay: 0.4s; }
.template-card:nth-child(10) { animation-delay: 0.45s; }

.template-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.template-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.template-card-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: var(--transition);
}

.template-card:hover .template-card-name { opacity: 1; }

.template-card-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeUp 0.3s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.modal-close:hover { color: var(--text); border-color: var(--primary); }

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
}

.modal-preview {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    border-radius: var(--radius) 0 0 var(--radius);
}

.card-preview-container {
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.card-preview-container canvas { width: 100%; height: 100%; display: block; }

.modal-controls { padding: 40px 32px; }
.modal-controls h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 24px; }
.modal-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

/* Input */
.control-group { margin-bottom: 20px; position: relative; }
.control-group label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

.input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(200, 164, 92, 0.1); }
.input::placeholder { color: var(--text-secondary); opacity: 0.5; }

.char-count {
    position: absolute;
    bottom: 12px;
    left: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* ============================================
   FOOTER
   ============================================ */
.footer { padding: 40px 0; text-align: center; position: relative; z-index: 1; border-top: 1px solid var(--border); }
.footer-content p { color: var(--text-secondary); font-size: 0.9rem; }

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast-icon { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.toast-text { font-size: 0.9rem; font-weight: 500; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .modal-body { grid-template-columns: 1fr; }
    .modal-preview { border-radius: var(--radius) var(--radius) 0 0; min-height: 300px; }
    .templates-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .hero-stats { gap: 20px; }
    .stat-number { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .hero-actions { flex-direction: column; align-items: center; }
    .btn { width: 100%; justify-content: center; }
    .templates-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
