/* 
 * BabyNameArena - Custom Design System
 * Bold, memorable, human.
 */

/* ============================================================================
   CSS VARIABLES - Theme System
   ============================================================================ */
:root {
    /* Brand Colors (can be overridden by user themes) */
    --primary: #E879F9;
    --primary-dark: #C026D3;
    --primary-light: #FAE8FF;
    --secondary: #38BDF8;
    --secondary-dark: #0284C7;
    --secondary-light: #E0F2FE;
    --accent: #FCD34D;
    --accent-dark: #F59E0B;
    
    /* Neutrals */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg-body: #FAFBFC;
    --bg-surface: #FFFFFF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* Semantic */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    
    /* Typography */
    --font-display: 'Lexend', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    
    /* Spacing (8px base grid) */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 32px;
    --space-xl: 48px;
    --space-2xl: 64px;
    --space-3xl: 96px;
    
    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
    --shadow-glow-primary: 0 0 24px rgba(232, 121, 249, 0.4);
    --shadow-glow-secondary: 0 0 24px rgba(56, 189, 248, 0.4);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
}

h1 { font-size: 56px; font-weight: 700; }
h2 { font-size: 40px; }
h3 { font-size: 28px; }
h4 { font-size: 22px; }
h5 { font-size: 18px; }
h6 { font-size: 16px; font-weight: 600; }

p { margin: 0; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-dark); }

strong { font-weight: 600; }

/* Lists */
ul, ol { list-style-position: inside; }

/* ============================================================================
   LAYOUT
   ============================================================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-narrow {
    max-width: 800px;
}

.container-wide {
    max-width: 1400px;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Spacing */
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
.py-2xl { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }

.px-md { padding-left: var(--space-md); padding-right: var(--space-md); }
.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }

/* ============================================================================
   NAVBAR
   ============================================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 var(--space-md);
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-fast);
}

.navbar-brand:hover {
    transform: translateY(-1px);
}

.navbar-brand .icon {
    font-size: 24px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar-link {
    color: white;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.navbar-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Main Content Offset */
body {
    padding-top: 64px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    min-height: 44px;
}

.btn:active {
    transform: translateY(0) !important;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow-primary);
    color: white;
}

/* Secondary Button */
.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-surface);
    border-color: var(--text-secondary);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

/* Danger Button */
.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* Size Variants */
.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
    min-height: 56px;
}

.btn-xl {
    padding: 20px 40px;
    font-size: 20px;
    font-weight: 700;
    min-height: 64px;
    border-radius: var(--radius-lg);
}

/* Full Width */
.btn-full {
    width: 100%;
}

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

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

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

.card-interactive {
    cursor: pointer;
    user-select: none;
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-interactive:active {
    transform: scale(0.98);
}

.card-header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.form-hint {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    transition: all var(--transition-fast);
    min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

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

.form-error {
    border-color: var(--error);
}

.form-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-error-message {
    color: var(--error);
    font-size: 14px;
    margin-top: var(--space-xs);
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
}

.form-checkbox input,
.form-radio input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ============================================================================
   TAGS & BADGES
   ============================================================================ */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--border-light);
    color: var(--text-secondary);
}

.tag-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.tag-secondary {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.tag-success {
    background: #D1FAE5;
    color: #065F46;
}

.tag-warning {
    background: #FEF3C7;
    color: #92400E;
}

.tag-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: var(--border-light);
    color: var(--text-primary);
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.table tr:last-child td {
    border-bottom: none;
}

.table-hover tr:hover td {
    background: var(--bg-body);
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-white { color: white; }

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cursor-pointer { cursor: pointer; }

/* Visibility */
.hide-mobile { display: block; }
.show-mobile { display: none; }

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes flash {
    0%, 100% { background-color: transparent; }
    50% { background-color: var(--primary-light); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.animate-fade-in {
    animation: fadeIn var(--transition-base);
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 36px; }
    h2 { font-size: 28px; }
    h3 { font-size: 22px; }
    h4 { font-size: 18px; }
    
    /* Spacing */
    .container {
        padding: 0 var(--space-sm);
    }
    
    /* Grid - Stack on mobile */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    /* Navbar */
    .navbar-inner {
        padding: 0 var(--space-sm);
    }
    
    .navbar-brand {
        font-size: 18px;
    }
    
    .navbar-menu {
        gap: var(--space-xs);
    }
    
    .navbar-link {
        font-size: 14px;
        padding: var(--space-xs);
    }
    
    /* Buttons */
    .btn-xl {
        padding: 16px 32px;
        font-size: 18px;
        min-height: 56px;
    }
    
    /* Cards */
    .card {
        padding: var(--space-md);
    }
    
    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    /* Hide/Show */
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
    
    /* Tables - Force mobile view */
    .table {
        display: block;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody {
        display: block;
    }
    
    .table tr {
        display: block;
        margin-bottom: var(--space-md);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: var(--space-sm);
    }
    
    .table td {
        display: flex;
        justify-content: space-between;
        padding: var(--space-xs) 0;
        border: none;
        text-align: right !important;
    }
    
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        text-align: left;
    }
}

@media (max-width: 480px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* ============================================================================
   LOADING & EMPTY STATES
   ============================================================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */
.notification {
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: start;
    gap: var(--space-sm);
}

.notification-info {
    background: var(--secondary-light);
    color: var(--secondary-dark);
    border-left: 4px solid var(--secondary);
}

.notification-success {
    background: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success);
}

.notification-warning {
    background: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning);
}

.notification-error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--error);
}
