@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #3b82f6;
    --text-main: #0f172a;
    --text-dim: #64748b;
    --text-on-dark: #ffffff;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --border: rgba(226, 232, 240, 0.8);
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f8fafc;
    --item-bg: #f8fafc;
    --sidebar-w: 280px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.06);
}

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

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

/* Sidebar */
.sidebar {
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2.5rem;
    position: fixed;
    top: 0;
    left: 0;
    height: auto;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2rem;
}

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

.university-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
}

.university-logo {
    height: 40px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
}

.university-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: block;
    letter-spacing: -0.2px;
}

.university-city {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: block;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-links li.active a {
    color: var(--primary);
    font-weight: 600;
}

.nav-links a:hover {
    color: var(--primary-hover);
}

.nav-links a img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.header-badges {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.version-badge {
    background: var(--item-bg);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* Main Content */
.main-content {
    margin-top: 80px;
    flex: 1;
    padding: 3rem 4rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

header {
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-dim);
    font-size: 1.05rem;
    max-width: 700px;
    line-height: 1.6;
}

/* Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.5s ease forwards;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
}

/* Filters */
.filters-section {
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 100;
}

.filter-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    padding: 2rem;
    position: relative;
    z-index: 100;
    overflow: visible;
}

.filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 100;
}

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

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

.dropdown-selected {
    background: var(--item-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 14px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-selected-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-selected::after {
    content: '';
    width: 16px;
    height: 16px;
    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='%2364748b' 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: transform 0.3s;
}

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

.custom-dropdown.active .dropdown-selected {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.custom-dropdown.active {
    z-index: 1000;
}

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

.dropdown-options-container {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--dropdown-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

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

.dropdown-search {
    width: 100%;
    background: #ffffff;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

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

.dropdown-option {
    padding: 12px 20px;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.1s;
}

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

/* Buttons */
.primary-btn {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--text-dim);
}

.secondary-btn {
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.full-width-card {
    grid-column: 1 / -1;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Typography in Cards */
.glass-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.glass-card h3 img {
    width: 22px;
}

/* Stat Card */
.stat-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-display {
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -2px;
    margin: 1rem 0 0.5rem;
    line-height: 1;
}

.score-1000-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-high { color: var(--accent-green); background: rgba(16, 185, 129, 0.1); }
.score-medium { color: var(--accent-orange); background: rgba(245, 158, 11, 0.1); }
.score-low { color: var(--accent-red); background: rgba(239, 68, 68, 0.1); }
.score-error { color: var(--accent-red); background: rgba(239, 68, 68, 0.1); }

.rationale-text {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.forecast-badge {
    margin-top: 1.5rem;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--item-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
}
.forecast-high { color: var(--accent-green); border-color: rgba(16, 185, 129, 0.2); background: rgba(16, 185, 129, 0.05); }
.forecast-medium { color: var(--accent-orange); border-color: rgba(245, 158, 11, 0.2); background: rgba(245, 158, 11, 0.05); }
.forecast-low { color: var(--accent-red); border-color: rgba(239, 68, 68, 0.2); background: rgba(239, 68, 68, 0.05); }

/* Score Breakdown */
.score-bars-container {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.score-bar-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
}

.score-bar-track {
    height: 10px;
    background: var(--item-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.score-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease;
}

.score-bar-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
    min-width: 40px;
}

#breakdown-skills, #breakdown-market, #breakdown-trends, #breakdown-modernity, #breakdown-region {
    display: grid;
    grid-template-columns: 1fr 2fr 45px;
    align-items: center;
    gap: 12px;
}

/* Lists */
.list-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-card li {
    padding: 14px 16px;
    background: var(--item-bg);
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text-main);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.list-card li:hover {
    border-color: #cbd5e1;
    transform: translateX(4px);
}

/* Trends */
.trends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.trend-item {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.trend-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

/* Categorized Missing */
#missing-categorized h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    margin: 1.5rem 0 0.8rem;
    font-weight: 600;
}
#missing-categorized h4:first-child { margin-top: 0; }

/* Recommendations */
.recommendation-item {
    padding: 16px 20px;
    border-left: 4px solid var(--primary);
    background: var(--item-bg);
    border-radius: 0 12px 12px 0;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

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

.history-table td {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-main);
}

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

.action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    margin-right: 8px;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Chart Canvas */
.chart-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    grid-column: 1 / -1;
}
.chart-card canvas {
    max-width: 500px !important;
    max-height: 320px !important;
    width: 100% !important;
}

/* Loader */
#loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(244, 247, 249, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

#loader.hidden { display: none !important; }

.loader-content {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.loader-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.loader-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.loader-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: all 0.3s;
}

.loader-step.active { color: var(--primary); }
.loader-step.done { color: var(--accent-green); }

.step-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--item-bg);
    font-size: 0.7rem;
}
.loader-step.active .step-icon { background: rgba(37, 99, 235, 0.1); color: var(--primary); }
.loader-step.done .step-icon { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }

/* Toasts */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 20px;
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #3b82f6; }

/* Utilities */
.hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Error State */
.error-state {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    margin-top: 1rem;
}
.error-text { color: var(--accent-red); font-size: 0.9rem; line-height: 1.5; }
.error-icon { font-size: 1.2rem; }

/* Responsive */
@media (max-width: 1200px) {
    .grid-layout { grid-template-columns: 1fr 1fr; }
    .full-width-card { grid-column: span 2; }
    .main-content { padding: 2rem; }
}

@media (max-width: 992px) {
    .grid-layout { grid-template-columns: 1fr; }
    .full-width-card, .column { grid-column: span 1; }
    .filter-card { flex-direction: column; align-items: stretch; }
}

@media (max-width: 768px) {
    .sidebar {
        padding: 1rem;
        flex-direction: row;
        overflow-x: auto;
    }
    .university-city { display: none; }
    .main-content { margin-top: 70px; padding: 1.5rem; }
}
