:root {
    --bg: #0b0e14;
    --card-bg: rgba(255, 255, 255, 0.05);
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary: #06b6d4;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --glass-border: rgba(255, 255, 255, 0.1);
    --sidebar-w: 260px;
}

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

body {
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Background Effects */
body::before, body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    z-index: -1;
    filter: blur(140px);
    opacity: 0.15;
}

body::before {
    background: var(--primary);
    top: -200px;
    right: -100px;
}

body::after {
    background: var(--secondary);
    bottom: -200px;
    left: -100px;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: rgba(11, 14, 20, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2.5rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4rem;
    padding-left: 0.5rem;
    color: white;
}

.logo img { 
    width: 36px; 
    filter: drop-shadow(0 0 8px var(--primary-glow)); 
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 1rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-dim);
    text-decoration: none;
    padding: 14px 20px;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.nav-links li.active a {
    background: rgba(79, 70, 229, 0.15);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(5px);
}

.nav-links a img { 
    width: 24px; 
    height: 24px;
    filter: brightness(0) invert(0.8); 
    transition: 0.3s;
}

.nav-links li.active a img, .nav-links a:hover img {
    filter: brightness(0) invert(1) drop-shadow(0 0 5px var(--primary-glow));
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem 4rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
}

header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
header p { color: var(--text-dim); }

.status-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Glass Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: 0.3s;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.filters-section {
    margin-bottom: 2rem;
}

.filter-card {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
}

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

.filter-group label { font-size: 0.9rem; color: var(--text-dim); }

/* Custom Dropdowns */
.custom-dropdown {
    position: relative;
    user-select: none;
}

.dropdown-selected {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 14px 20px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
}

.dropdown-selected::after {
    content: '';
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-size: contain;
    transition: 0.3s;
}

.custom-dropdown.active .dropdown-selected::after {
    transform: rotate(180deg);
}

.custom-dropdown.active .dropdown-selected {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.custom-dropdown.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.custom-dropdown.active .dropdown-options-container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-options-container {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: #111827;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}

.dropdown-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 16px;
    color: white;
    font-size: 0.9rem;
    outline: none;
}

.dropdown-options {
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-option {
    padding: 12px 20px;
    color: var(--text-dim);
    cursor: pointer;
    transition: 0.2s;
}

.dropdown-option:hover {
    background: var(--primary);
    color: white;
}

.dropdown-option.selected {
    background: rgba(79, 70, 229, 0.2);
    color: white;
}

/* Scrollbar Style */
.dropdown-options::-webkit-scrollbar { width: 6px; }
.dropdown-options::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 20px var(--primary-glow);
    transition: 0.3s;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.secondary-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--text-dim);
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem;
}

.chart-card {
    grid-row: span 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 400px;
}

.chart-card canvas {
    max-width: 350px !important;
    max-height: 350px !important;
}

.stat-card {
    grid-row: span 1;
    text-align: center;
}

.score-display {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(to bottom, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 1rem 0;
}

.list-card {
    margin-bottom: 1.5rem;
}

.list-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.list-card h3 img { width: 20px; }

.list-card.match h3 { color: var(--accent-green); }
.list-card.missing h3 { color: var(--accent-red); }
.list-card.outdated h3 { color: var(--accent-orange); }

.list-card ul {
    list-style: none;
}

.list-card li {
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.recommend-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(6, 182, 212, 0.1));
}

.recommend-card p {
    line-height: 1.6;
    color: #cbd5e1;
}

/* Deep Analysis Layout & Restoration */
.rationale-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.4;
    margin-top: 0.5rem;
    font-style: italic;
}

.forecast-badge {
    display: inline-block;
    margin-top: 1rem;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.forecast-badge::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

.forecast-high { color: var(--accent-green); border-color: var(--accent-green); }
.forecast-medium { color: var(--accent-orange); border-color: var(--accent-orange); }
.forecast-low { color: var(--accent-red); border-color: var(--accent-red); }

.full-width-card {
    grid-column: span 2;
}

.trends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.trend-item {
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.2);
    padding: 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.trend-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    opacity: 0;
    z-index: -1;
    transition: 0.4s;
}

.trend-item:hover::before { opacity: 0.1; }
.trend-item:hover { transform: scale(1.02); }

#missing-categorized h4 {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1.5rem 0 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 4px;
}

#missing-categorized h4:first-of-type { margin-top: 0; }

.recommendation-item {
    padding: 12px;
    border-left: 3px solid var(--primary);
    background: rgba(255,255,255,0.02);
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-main);
    border-radius: 4px 12px 12px 4px;
}

/* Premium Aesthetic Enhancements */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: fadeInUp 0.6s ease forwards;
}

.score-display {
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.list-card li {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 0 solid var(--primary);
}

.list-card li:hover {
    transform: translateX(8px);
    background: rgba(255, 255, 255, 0.06);
    border-left-width: 4px;
}

.list-card.match li:hover { border-color: var(--accent-green); }
.list-card.missing li:hover { border-color: var(--accent-red); }
.list-card.outdated li:hover { border-color: var(--accent-orange); }

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

@keyframes shine {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

/* History / Reports Styles */
.history-card {
    padding: 2rem;
}

.history-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.history-header h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.history-header p { color: var(--text-dim); font-size: 0.9rem; }

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.history-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
}

.history-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    font-size: 0.95rem;
}

.history-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    transition: 0.3s;
    text-decoration: none;
    display: inline-block;
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none; }
