/**
 * DomainUI Auctions - Enhanced Theme System with Light/Dark Mode
 * Professional domain auction platform styling
 */

/* Default Theme (Dark Mode) */
:root,
[data-theme="dark"] {
    /* Teal/Turquoise Color Scheme */
    --primary-teal: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #06b6d4;
    --secondary-teal: #14b8a6;
    --accent-orange: #f97316;
    --accent-orange-dark: #ea580c;
    
    /* Background Gradients */
    --bg-gradient-main: linear-gradient(135deg, #0f766e 0%, #0891b2 50%, #06b6d4 100%);
    --bg-gradient-alt: linear-gradient(135deg, #14b8a6 0%, #0891b2 100%);
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Dark Theme Colors */
    --dark-bg: #0f172a;
    --dark-card: #1e293b;
    --dark-border: #334155;
    --dark-text: #f1f5f9;
    --dark-text-muted: #94a3b8;
    
    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-bg-dark: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-border-dark: rgba(51, 65, 85, 0.6);
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-gradient-main);
    min-height: 100vh;
    color: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--white);
}

h1 { font-size: 1.1rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.95rem; }
h4 { font-size: 0.85rem; }
h5 { font-size: 0.8rem; }
h6 { font-size: 0.75rem; }

p {
    color: var(--dark-text-muted);
    margin-bottom: var(--space-4);
}

a {
    color: var(--accent-orange);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-orange-dark);
}

/* Layout Containers */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-md {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-lg {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* Header */
.header {
    background: var(--glass-bg-dark);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border-dark);
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.logo:hover {
    color: var(--white);
}

.nav-links {
    display: flex;
    gap: var(--space-6);
    align-items: center;
}

.nav-link {
    color: var(--dark-text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav-link:hover {
    color: var(--white);
    background: var(--glass-bg);
}

.nav-link.active {
    color: var(--white);
    background: var(--glass-bg);
}

/* Cards and Containers */
.card {
    background: var(--glass-bg-dark);
    border: 1px solid var(--glass-border-dark);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.card-sm {
    padding: var(--space-4);
}

.card-lg {
    padding: var(--space-8);
}

.glass-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    backdrop-filter: blur(20px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
}

.btn-primary {
    background: var(--accent-orange);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--accent-orange-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    color: var(--white);
}

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

.btn-secondary:hover {
    background: var(--glass-bg-dark);
    color: var(--white);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-light);
    border: 1px solid var(--primary-light);
}

.btn-outline:hover {
    background: var(--primary-light);
    color: var(--white);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1.125rem;
}

.btn-xl {
    padding: var(--space-5) var(--space-10);
    font-size: 1.25rem;
}

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

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

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-auto-lg {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Tables */
.table-container {
    background: var(--glass-bg-dark);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-dark);
    box-shadow: var(--shadow-lg);
}

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

.table th {
    background: var(--dark-card);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--white);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--dark-border);
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--glass-border-dark);
    color: var(--dark-text-muted);
    font-size: 0.8rem;
}

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

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

/* Forms */
.form-group {
    margin-bottom: var(--space-6);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--white);
    font-size: 0.75rem;
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--glass-border-dark);
    border-radius: var(--radius);
    background: var(--glass-bg-dark);
    color: var(--white);
    font-size: 1rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

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

.form-control:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* Badges and Tags */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-xl);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--accent-orange);
    color: var(--white);
}

.badge-secondary {
    background: var(--primary-teal);
    color: var(--white);
}

.badge-success {
    background: #059669;
    color: var(--white);
}

.badge-warning {
    background: #d97706;
    color: var(--white);
}

.badge-danger {
    background: #dc2626;
    color: var(--white);
}

/* Alerts */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-6);
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.3);
    color: #34d399;
}

.alert-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.3);
    color: #fbbf24;
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: #67e8f9;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.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-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

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

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.6s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 var(--space-4);
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-3);
    }
    
    .nav-links {
        display: none;
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .grid-auto {
        grid-template-columns: 1fr;
    }
    
    h1 { font-size: 1rem; }
    h2 { font-size: 0.95rem; }
    h3 { font-size: 0.9rem; }
    
    .btn-xl {
        padding: var(--space-4) var(--space-6);
        font-size: 1rem;
    }
    
    .card {
        padding: var(--space-4);
    }
    
    .table th,
    .table td {
        padding: var(--space-2) var(--space-3);
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-2);
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: var(--space-4);
    }
    
    .logo {
        font-size: 1rem;
    }
    
    h1 { font-size: 0.95rem; }
    
    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: 0.7rem;
    }
}

/* Light Mode Theme */
[data-theme="light"] {
    /* Light Mode Color Scheme */
    --primary-teal: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #06b6d4;
    --secondary-teal: #14b8a6;
    --accent-orange: #f97316;
    --accent-orange-dark: #ea580c;
    
    /* Light Background Gradients */
    --bg-gradient-main: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    --bg-gradient-alt: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    
    /* Light Neutral Colors */
    --white: #1e293b;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    
    /* Light Theme Colors */
    --dark-bg: #ffffff;
    --dark-card: #ffffff;
    --dark-border: #e2e8f0;
    --dark-text: #1e293b;
    --dark-text-muted: #64748b;
    
    /* Light Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-bg-dark: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(203, 213, 225, 0.5);
    --glass-border-dark: rgba(148, 163, 184, 0.3);
    
    /* Light Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* COMPREHENSIVE LIGHT MODE FIXES FOR TILE HEADERS AND SIDEBAR STATS */

/* Fix ALL tile headers in light mode */
[data-theme="light"] .table-header,
[data-theme="light"] .category-header,
[data-theme="light"] .new-section-header,
[data-theme="light"] .sold-section-header,
[data-theme="light"] .not-sold-header,
[data-theme="light"] .portfolio-header {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    border-bottom: 1px solid #cbd5e1 !important;
}

/* Fix section titles in light mode */
[data-theme="light"] .section-title,
[data-theme="light"] .state-title {
    color: #1e293b !important;
}

/* Fix all main content text in light mode */
[data-theme="light"] .domain-name,
[data-theme="light"] .sold-domain-name,
[data-theme="light"] .domain-row,
[data-theme="light"] .new-section-item,
[data-theme="light"] .sold-item,
[data-theme="light"] .latest-sold-item,
[data-theme="light"] .top-sales-item,
[data-theme="light"] .not-sold-item,
[data-theme="light"] .portfolio-item {
    color: #1e293b !important;
}

/* Fix paragraphs and descriptions */
[data-theme="light"] .state-description,
[data-theme="light"] p {
    color: #64748b !important;
}

/* Fix category pills in light mode */
[data-theme="light"] .category-pill {
    color: #64748b !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .category-pill:hover,
[data-theme="light"] .category-pill.active {
    color: #1e293b !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Fix tab buttons in light mode */
[data-theme="light"] .tab-btn {
    color: #64748b !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .tab-btn.active,
[data-theme="light"] .tab-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

/* Fix toggle buttons in light mode */
[data-theme="light"] .toggle-btn {
    color: #64748b !important;
    background: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="light"] .toggle-btn:hover,
[data-theme="light"] .toggle-btn.active {
    background: var(--primary) !important;
    color: white !important;
}

/* Fix secondary text elements */
[data-theme="light"] .sold-time,
[data-theme="light"] .sold-month,
[data-theme="light"] .not-sold-status,
[data-theme="light"] .reserve-status,
[data-theme="light"] .bid-status,
[data-theme="light"] .owner-link {
    color: #64748b !important;
}

[data-theme="light"] .owner-link:hover {
    color: #1e293b !important;
}

/* CRITICAL: Fix sidebar stats tiles to maintain dark theme in light mode */
[data-theme="light"] .sidebar-section .header-stat {
    /* Keep dark gradient background for contrast */
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%) !important;
    border: 1px solid #475569 !important;
    /* Ensure white text remains visible */
}

[data-theme="light"] .sidebar-section .header-stat span:first-child {
    color: white !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

[data-theme="light"] .sidebar-section .header-stat span:last-child {
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .sidebar-section .header-stat strong {
    color: white !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="light"] .sidebar-section .header-stat:hover {
    background: linear-gradient(145deg, #334155 0%, #475569 100%) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}

/* Fix table containers in light mode */
[data-theme="light"] .table-container,
[data-theme="light"] .state-container,
[data-theme="light"] .new-section,
[data-theme="light"] .sold-section,
[data-theme="light"] .category-list {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #e2e8f0 !important;
}

/* Fix domain rows hover in light mode */
[data-theme="light"] .domain-row:hover,
[data-theme="light"] .new-section-item:hover,
[data-theme="light"] .sold-item:hover {
    background: rgba(59, 130, 246, 0.05) !important;
}

/* Fix price and accent colors to remain visible */
[data-theme="light"] .domain-price,
[data-theme="light"] .sold-price {
    color: var(--accent-orange) !important;
}

/* Fix bid count badges */
[data-theme="light"] .bid-count {
    background: var(--primary) !important;
    color: white !important;
}

[data-theme="light"] .bid-count.no-bids {
    background: #64748b !important;
    color: white !important;
}

/* Fix forms in light mode */
[data-theme="light"] .search-input {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .search-input::placeholder {
    color: #94a3b8 !important;
}

[data-theme="light"] .search-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Fix buttons to maintain proper contrast */
[data-theme="light"] .btn-primary {
    background: var(--accent-orange) !important;
    color: white !important;
}

[data-theme="light"] .btn-secondary {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 1) !important;
    color: #1e293b !important;
}

/* Fix card backgrounds in light mode */
[data-theme="light"] .card,
[data-theme="light"] .glass-container {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
}

/* Ensure alerts remain readable */
[data-theme="light"] .alert-success {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #059669 !important;
}

[data-theme="light"] .alert-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #d97706 !important;
}

[data-theme="light"] .alert-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #dc2626 !important;
}

/* Theme Transition */
*,
*::before,
*::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header,
    .nav-links,
    .btn {
        display: none;
    }
    
    .card {
        border: 1px solid #e5e7eb;
        background: white;
        box-shadow: none;
    }
}
