:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --dark: #0f172a;
    --light: #f8fafc;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 16px; padding-bottom: 100px; }

/* ========== NAVIGATION ========== */
.mobile-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
}

.nav-brand { font-weight: 800; font-size: 1.35rem; color: var(--primary); letter-spacing: -0.5px; }

.hamburger {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--dark);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hamburger:hover, .hamburger:focus { background: var(--light); color: var(--primary); outline: 2px solid var(--primary-light); }

.nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: var(--shadow-lg);
    list-style: none;
    padding: 12px;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 99;
}

.nav-menu.active { display: block; animation: slideDown 0.2s ease; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-menu a:hover, .nav-menu a:focus { background: #f1f5f9; color: var(--primary); outline: none; }

/* ========== CARDS ========== */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

.card-title { font-size: 1.25rem; font-weight: 700; color: var(--dark); line-height: 1.3; }

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-new { background: var(--danger); color: white; animation: pulse-badge 2s infinite; }
.badge-paid { background: var(--success); color: white; }
.badge-free { background: var(--warning); color: white; }
.badge-locked { background: var(--gray); color: white; }
.badge-primary { background: var(--primary); color: white; }
.badge-secondary { background: var(--secondary); color: white; }

@keyframes pulse-badge {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-decoration: none;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}

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

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-primary:focus { outline: 3px solid var(--primary-light); outline-offset: 2px; }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover:not(:disabled) { background: #db2777; transform: translateY(-2px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; transform: translateY(-2px); }

.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-sm { padding: 9px 16px; font-size: 0.875rem; }
.btn-lg { padding: 16px 32px; font-size: 1.125rem; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 20px; position: relative; }

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: var(--gray);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background: white;
    color: var(--dark);
}

.form-input:hover { border-color: #cbd5e1; }
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.form-input::placeholder { color: #94a3b8; }

.form-input:disabled { background: #f1f5f9; cursor: not-allowed; }

textarea.form-input { min-height: 100px; resize: vertical; }

select.form-input { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 44px; }

/* Honeypot field - hidden from humans */
.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

/* ========== GRID ========== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }

/* ========== TEMPLATE GALLERY ========== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.template-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    background: #f1f5f9;
    aspect-ratio: 1;
}

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

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition);
}

.template-item:hover img { transform: scale(1.03); }

.template-item.selected {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.template-item.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.template-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 24px 10px 10px;
    font-size: 0.8rem;
    text-align: center;
    font-weight: 500;
}

/* ========== ALERTS ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.alert-success { background: #ecfdf5; color: #065f46; border-color: var(--success); }
.alert-error { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-color: var(--warning); }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }

/* ========== EVENT LIST ========== */
.event-item { display: flex; flex-direction: column; gap: 16px; }

.event-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: 4px;
}

.event-meta span { display: flex; align-items: center; gap: 5px; }

.event-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.event-actions .btn { flex: 1; min-width: 100px; }

/* ========== STATS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    padding: 24px 16px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

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

.stat-value { font-size: 2.25rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--gray); margin-top: 8px; font-weight: 500; }

/* ========== UPLOAD ZONE ========== */
.upload-zone {
    border: 3px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8fafc;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: #eef2ff;
    transform: scale(1.01);
}

.upload-zone i { font-size: 3rem; color: var(--gray); margin-bottom: 16px; display: block; transition: var(--transition); }
.upload-zone:hover i { color: var(--primary); transform: scale(1.1); }

/* ========== CUSTOMER VIEW ========== */
.customer-header {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: 0 0 var(--radius) var(--radius);
    margin: -16px -16px 28px -16px;
    position: relative;
    overflow: hidden;
}

.customer-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.customer-header h1 { font-size: 1.75rem; margin-bottom: 8px; font-weight: 800; position: relative; }
.customer-header p { font-size: 1rem; opacity: 0.9; position: relative; }

/* Brand logo on customer page */
.brand-logo {
    max-width: 200px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Contact bar on customer page */
.contact-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
    font-size: 0.875rem;
    opacity: 0.9;
}

.contact-bar a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.contact-bar a:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.password-form { max-width: 420px; margin: 40px auto; }

/* ========== PRICING ========== */
.pricing-card {
    text-align: center;
    padding: 40px 28px;
    border: 3px solid var(--primary);
    position: relative;
    background: linear-gradient(135deg, white 0%, #f8fafc 100%);
}

.pricing-price { font-size: 3.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.pricing-price span { font-size: 1rem; color: var(--gray); font-weight: 400; display: block; margin-top: 4px; }

.pricing-features { list-style: none; margin: 28px 0; text-align: left; }
.pricing-features li { padding: 12px 0; border-bottom: 1px solid var(--gray-light); display: flex; align-items: center; gap: 10px; }
.pricing-features li::before { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: var(--success); }

/* ========== SELECTIONS ========== */
.selection-item {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

.selection-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }

.selection-item img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }

.selection-info { flex: 1; min-width: 0; }
.selection-info h4 { font-size: 0.9rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selection-info p { font-size: 0.8rem; color: var(--gray); }

/* ========== LANDING / HERO ========== */
.hero { text-align: center; padding: 60px 20px 48px; }
.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero p { font-size: 1.125rem; color: var(--gray); max-width: 560px; margin: 0 auto 32px; line-height: 1.6; }

.feature-card { text-align: center; padding: 32px 24px; transition: var(--transition); }
.feature-card:hover { transform: translateY(-4px); }
.feature-card .icon-wrap { font-size: 2.5rem; margin-bottom: 16px; display: inline-block; padding: 16px; border-radius: var(--radius); background: #f1f5f9; }
.feature-card h3 { font-size: 1.125rem; margin-bottom: 8px; }
.feature-card p { color: var(--gray); font-size: 0.9rem; line-height: 1.5; }

/* ========== ADMIN TABLE ========== */
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.admin-table th, .admin-table td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--gray-light); }
.admin-table th { font-weight: 600; color: var(--gray); background: #f8fafc; position: sticky; top: 0; }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table td { transition: background 0.15s; }

/* ========== COPY LINK ========== */
.copy-group { display: flex; gap: 8px; }
.copy-group .form-input { flex: 1; font-size: 0.875rem; }
.copy-group .btn { width: auto; padding: 14px 18px; flex-shrink: 0; }

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--dark);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    font-weight: 500;
    font-size: 0.95rem;
    max-width: 90vw;
    text-align: center;
}

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

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal.active { display: flex; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-light); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray); padding: 4px; border-radius: var(--radius-sm); transition: var(--transition); }
.modal-close:hover { color: var(--danger); background: #fef2f2; }

/* ========== BRANDING SETTINGS ========== */
.brand-preview {
    padding: 32px 24px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 24px;
    color: white;
    position: relative;
    overflow: hidden;
}

.brand-preview::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.brand-preview h3 { position: relative; font-size: 1.5rem; margin-bottom: 8px; }
.brand-preview p { position: relative; opacity: 0.9; }

.color-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    position: relative;
}

.color-option:hover { transform: scale(1.1); }
.color-option.selected { border-color: var(--dark); box-shadow: 0 0 0 2px white, 0 0 0 4px var(--dark); }
.color-option.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.logo-preview {
    width: 100%;
    max-width: 250px;
    max-height: 120px;
    object-fit: contain;
    margin: 0 auto 16px;
    display: block;
    border-radius: var(--radius-sm);
    background: white;
    padding: 12px;
}

/* ========== UTILITIES ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.hidden { display: none !important; }
.full-width { width: 100%; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.text-sm { font-size: 0.875rem; }
.text-gray { color: var(--gray); }
.font-bold { font-weight: 700; }

/* ========== RESPONSIVE ========== */
@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .template-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .color-options { grid-template-columns: repeat(10, 1fr); }
}

@media (min-width: 768px) {
    .container { padding: 32px; padding-bottom: 60px; }
    .event-item { flex-direction: row; align-items: center; }
    .event-actions { flex-wrap: nowrap; }
    .btn { width: auto; }
    .nav-menu {
        display: flex !important;
        position: static;
        box-shadow: none;
        padding: 0;
        gap: 4px;
        background: transparent;
    }
    .hamburger { display: none; }
    .mobile-nav { justify-content: space-between; padding: 14px 32px; }
    .customer-header { margin: -32px -32px 32px -32px; border-radius: 0 0 var(--radius) var(--radius); padding: 64px 32px; }
    .customer-header h1 { font-size: 2.25rem; }
    .hero h1 { font-size: 3.5rem; }
    .template-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .brand-logo { max-width: 250px; max-height: 100px; }
}

@media (min-width: 1024px) {
    .template-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
