:root {
    /* Base Themes - Dark */
    --bg-page: #09090b; /* Zinc 950 */
    --bg-panel: rgba(24, 24, 27, 0.7); /* Zinc 900 Glass */
    --bg-surface: #27272a; /* Zinc 800 */
    --bg-hover: #3f3f46;
    
    --text-primary: #fafafa;
    --text-muted: #a1a1aa;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5;
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.15);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    
    --info: #0ea5e9;
    --info-light: rgba(14, 165, 233, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;
}

[data-theme="light"] {
    --bg-page: #f4f4f5; /* Zinc 100 */
    --bg-panel: rgba(255, 255, 255, 0.8);
    --bg-surface: #e4e4e7;
    --bg-hover: #d4d4d8;
    
    --text-primary: #09090b;
    --text-muted: #52525b;
    
    --border-color: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.2);
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

/* Utilities */
.font-mono { font-family: var(--font-mono); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

.bg-error-light { background-color: var(--error-light); color: var(--error); }
.bg-warning-light { background-color: var(--warning-light); color: var(--warning); }
.bg-primary-light { background-color: var(--primary); color: white; }
.bg-info-light { background-color: var(--info-light); color: var(--info); }

/* Layout */
.app-layout {
    width: 100%;
    max-width: 1400px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    border-radius: var(--radius-md);
    display: flex; justify-content: center; align-items: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.logo-icon i { width: 22px; height: 22px; }

.brand-text h1 { font-size: 1.25rem; font-weight: 700; background: linear-gradient(to right, var(--primary), var(--info)); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.subtitle { font-size: 0.8rem; color: var(--text-muted); font-weight: 500;}

.header-actions {
    display: flex; align-items: center; gap: 0.5rem;
}

/* Base Inputs & Buttons */
.btn {
    display: inline-flex; justify-content: center; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem; font-weight: 600; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; transition: all 0.2s;
}
.btn i { width: 16px; height: 16px; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--info)); color: white; border: none; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); }
.icon-btn {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); border: none; background: transparent; color: var(--text-muted);
    cursor: pointer; transition: 0.2s;
}
.icon-btn:hover { background: var(--bg-surface); color: var(--text-primary); }

.form-input, .form-select {
    background: var(--bg-page); color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 0.5rem 0.8rem; font-family: inherit; font-size: 0.85rem; outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--primary); }
.form-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Workspace */
.workspace {
    display: flex; flex-direction: column; gap: 1.5rem; flex: 1; overflow: hidden;
}

/* Panels */
.panel {
    background: var(--bg-panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); display: flex; flex-direction: column; overflow: hidden;
}

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); background: var(--bg-surface);
}
.panel-header h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.panel-header h2 i { color: var(--primary); width: 18px; height: 18px; }

.header-controls { display: flex; gap: 0.5rem; }

/* Input Section */
.input-panel { flex-shrink: 0; }
.input-container { padding: 1rem; background: var(--bg-page); }
textarea#cookie-input {
    width: 100%; min-height: 120px; max-height: 300px; resize: vertical;
    background: transparent; color: var(--text-primary); border: none;
    font-family: var(--font-mono); font-size: 0.85rem; outline: none; line-height: 1.6;
}
textarea#cookie-input::placeholder { color: var(--text-muted); opacity: 0.5; }

.panel-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); background: var(--bg-surface);
}
.parsing-hints { display: flex; gap: 0.5rem; }
.hint-badge {
    background: var(--bg-page); border: 1px solid var(--border-color); color: var(--text-muted);
    font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); font-weight: 500;
}

/* Metrics Row */
.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; flex-shrink: 0; }
.metric-card {
    background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-md);
}
.metric-icon {
    width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.metric-icon i { width: 24px; height: 24px; }
.metric-content { display: flex; flex-direction: column; }
.metric-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.metric-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; margin-top: 0.2rem;}

/* Grid / Results Section */
.results-panel { flex: 1; min-height: 0; }
.filter-controls { display: flex; gap: 0.5rem; }

.grid-container { flex: 1; overflow: auto; position: relative; background: var(--bg-page); }

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: var(--text-muted); padding: 3rem; text-align: center;
}
.huge-icon { width: 64px; height: 64px; opacity: 0.2; margin-bottom: 1.5rem; }
.empty-state h3 { font-size: 1.2rem; color: var(--text-primary); margin-bottom: 0.5rem; }

.table-wrapper { width: 100%; overflow: auto; min-height: 100%; display: block; }
.grid-table {
    width: 100%; border-collapse: collapse; min-width: 1000px;
}
.grid-table th {
    position: sticky; top: 0; background: var(--bg-surface); color: var(--text-muted);
    font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border-strong); z-index: 10;
}
.grid-table td {
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem; color: var(--text-primary); vertical-align: middle;
}
.grid-table tr:hover { background: var(--bg-hover); cursor: pointer; }

/* Status Badges */
.status-pill {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem;
    border-radius: 99px; font-size: 0.75rem; font-weight: 600; width: max-content;
}
.status-pill i { width: 12px; height: 12px; }

/* Details Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 1000;
    display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s forwards; }

.modal {
    width: 100%; max-width: 450px; background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.5rem; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.modal-lg { max-width: 600px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color);}
.modal-header h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.modal-close { margin-top: -0.5rem; margin-right: -0.5rem; }

.detail-row { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1rem; }
.detail-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.detail-value { font-family: var(--font-mono); font-size: 0.85rem; padding: 0.5rem; background: var(--bg-page); border: 1px solid var(--border-color); border-radius: var(--radius-sm); word-break: break-all; }

/* Export Dropdown */
.export-dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 5px); right: 0; background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 100;
    display: none; flex-direction: column; padding: 0.5rem; min-width: 150px;
}
.dropdown-menu.show { display: flex; }
.menu-item {
    background: transparent; border: none; font-family: inherit; font-size: 0.85rem;
    color: var(--text-primary); text-align: left; padding: 0.5rem; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 0.5rem; cursor: pointer; transition: 0.2s;
}
.menu-item:hover { background: var(--bg-hover); }

/* Toast */
.toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--text-primary); color: var(--bg-page); padding: 0.75rem 1.5rem; border-radius: 99px;
    font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-md); z-index: 2000;
    opacity: 0; transition: all 0.3s; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

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