/* ============================================
   gear.casa - Premium Storage Price Comparison
   ============================================ */

/* Custom Brand Colors & Design System */
:root {
    /* Brand Colors - Dark Mode */
    --bg-primary: #0a0e17;
    --bg-secondary: #141b2d;
    --bg-tertiary: #1e2740;
    --bg-hover: #2a3654;
    
    --text-primary: #e8edf5;
    --text-secondary: #a8b3cf;
    --text-tertiary: #6b7a99;
    
    --border-color: #2a3654;
    --border-hover: #3d4d6e;
    
    /* Brand Accent - Vibrant Blue/Purple Gradient */
    --accent-primary: #4a7cff;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #4a7cff 0%, #7c3aed 100%);
    
    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(74, 124, 255, 0.3);
    
    /* 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);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Light Mode Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --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 32px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 0 20px rgba(74, 124, 255, 0.2);
}

/* ============================================
   Base Styles
   ============================================ */

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

html {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

/* ============================================
   Top Navigation Bar
   ============================================ */

.top-nav {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

/* Theme Toggle Button */
.theme-toggle {
    padding: 12px 24px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-base);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}

.theme-toggle:active {
    transform: scale(0.98);
}

/* ============================================
   Hero Section - Premium Branding
   ============================================ */

.hero {
    text-align: center;
    padding: 32px 20px 24px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: var(--accent-gradient);
    opacity: 0.06;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.hero h1 {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    position: relative;
    animation: fadeInUp 0.6s ease-out;
    text-shadow: 0 2px 20px rgba(74, 124, 255, 0.3);
}

.hero p {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Header - Category Pages
   ============================================ */

header {
    margin-bottom: 20px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

header:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Category Grid - Premium Cards
   ============================================ */

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.category-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    color: var(--text-primary);
    display: block;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.category-card:hover::before {
    opacity: 1;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--accent-primary);
}

.category-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    transition: color var(--transition-base);
}

.category-card:hover h2 {
    color: var(--accent-secondary);
}

.category-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.category-stats {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
}

/* ============================================
   Filters - Premium Dropdown Design
   ============================================ */

.filters {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dropdown Filter Styles */
.filter-dropdown {
    position: relative;
}

.filter-dropdown-button {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.filter-dropdown-button:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}

.filter-dropdown-button .arrow {
    transition: transform var(--transition-base);
    font-size: 12px;
    color: var(--text-tertiary);
}

.filter-dropdown-button.open .arrow {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.filter-dropdown-button .selected-count {
    background: var(--accent-gradient);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(74, 124, 255, 0.3);
}

.checkbox-group {
    display: none;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
    margin-top: -1px;
}

.checkbox-group.open {
    display: flex;
    animation: slideDown 0.2s ease-out;
}

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

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.checkbox-item:hover {
    background: var(--bg-hover);
}

.checkbox-item input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--accent-primary);
}

.checkbox-item label {
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
    user-select: none;
}

/* Number Input Styles */
.filter-group input[type="number"] {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.filter-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}

/* Button Styles */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 124, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 124, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* ============================================
   Table - Premium Data Display
   ============================================ */

.loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    color: var(--error);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-weight: 500;
}

.record-count {
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

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

thead {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    min-width: 100px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

th.sortable:hover {
    background: var(--bg-hover);
}

th.resizing {
    user-select: none;
}

/* Column Resizer */
.column-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
    transition: background var(--transition-fast);
}

.column-resizer:hover,
.column-resizer.resizing {
    background: var(--accent-primary);
}

.sort-indicator {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    color: var(--accent-primary);
}

th.sort-asc .sort-indicator::after {
    content: '▲';
}

th.sort-desc .sort-indicator::after {
    content: '▼';
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

td {
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-validated {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-unvalidated {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-incomplete {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.condition-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.condition-new {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.condition-used {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.amazon-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
}

.amazon-link::after {
    content: '→';
    margin-left: 4px;
    transition: transform var(--transition-fast);
    display: inline-block;
}

.amazon-link:hover {
    color: var(--accent-secondary);
}

.amazon-link:hover::after {
    transform: translateX(4px);
}

/* Amazon Icon Link - First Column */
.amazon-cell {
    text-align: center;
    width: 45px;
    padding: 8px 6px !important;
}

.amazon-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 18px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    cursor: pointer;
}

.amazon-icon-link:hover {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.amazon-icon-link:active {
    transform: scale(0.95);
}

th[data-field="amazonUrl"] {
    width: 45px;
    min-width: 45px;
    text-align: center;
    padding: 8px 6px !important;
}

/* ============================================
   Sidebar Layout
   ============================================ */

/* Sidebar Toggle Button */
.sidebar-toggle {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(74, 124, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 124, 255, 0.4);
}

.sidebar-toggle:active {
    transform: translateY(0);
}

.sidebar-toggle .hamburger {
    font-size: 18px;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-content {
    padding: 0;
}

.sidebar-section {
    border-bottom: 1px solid var(--border-color);
    padding: 24px;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-content {
    transition: margin-left var(--transition-base);
}

.main-content.sidebar-open {
    margin-left: 380px;
}

/* ============================================
   Column Manager (in Sidebar)
   ============================================ */

.column-manager-hint {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 0 0 16px 0;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.column-list {
    max-height: none;
    overflow-y: visible;
}

.column-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: move;
    transition: all var(--transition-fast);
    user-select: none;
}

.column-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.column-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.column-item.drag-over {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}

.drag-handle {
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: grab;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.column-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-primary);
    flex-shrink: 0;
}

.column-item label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.column-item.disabled {
    opacity: 0.5;
}

.column-item.disabled label {
    color: var(--text-tertiary);
}

.column-manager-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.column-manager-actions .btn-secondary {
    width: 100%;
}

/* ============================================
   Responsive Design
   ============================================ */

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

@media (min-width: 768px) and (max-width: 1199px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        max-width: 380px;
    }
    
    .main-content.sidebar-open {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    .hero h1 {
        font-size: 40px;
    }
    
    .hero p {
        font-size: 16px;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .top-nav {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .sidebar-toggle {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .sidebar-toggle .label {
        display: none;
    }
    
    .theme-toggle {
        padding: 10px 16px;
        font-size: 13px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
        min-width: 600px;
    }

    th, td {
        padding: 12px 16px;
    }
    
    header h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .category-card {
        padding: 24px;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}
