/* ===========================
   Premium Glassmorphism Design
   =========================== */
:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-glass: rgba(15, 23, 42, 0.85);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    --backdrop-blur: blur(16px);
    
    --radius-full: 9999px;
    --radius-xl: 24px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg-dark); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; }

/* Dynamic Background */
.bg-decoration {
    position: fixed; inset: 0; z-index: -1;
    background: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
}

.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* ===========================
   Compact Search Bar
   =========================== */
.search-container {
    display: flex; align-items: center; justify-content: space-between; gap: 2rem;
    padding: 1rem 2rem;
    background: var(--bg-glass);
    backdrop-filter: var(--backdrop-blur);
    border: var(--glass-border);
    border-radius: var(--radius-full);
    margin-bottom: 2rem;
    box-shadow: var(--glass-shadow);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Centered State (Initial) */
.search-container.centered {
    position: fixed; top: 50%; left: 50%; width: 500px; max-width: 90%;
    transform: translate(-50%, -50%);
    flex-direction: column; padding: 3rem;
    border-radius: var(--radius-xl);
    gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon svg { width: 32px; height: 32px; }
.centered .logo-icon svg { width: 48px; height: 48px; }
.brand h1 { font-size: 1.5rem; font-weight: 800; background: var(--primary-gradient); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.centered .brand h1 { font-size: 2.5rem; }

.compact-form {
    display: flex; gap: 0.5rem; width: 100%; position: relative;
    background: rgba(255,255,255,0.05); padding: 0.5rem; border-radius: var(--radius-full);
    border: 1px solid rgba(255,255,255,0.1);
}

.compact-form input {
    flex: 1; background: transparent; border: none; color: white;
    padding: 0.75rem 1rem; font-size: 1.1rem; outline: none;
}

.compact-form button {
    background: var(--primary-gradient); border: none; width: 48px; height: 48px;
    border-radius: 50%; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s;
}
.compact-form button:hover { transform: scale(1.05); }

/* Validation Error Compact */
.compact-error { color: #f87171; font-size: 0.9rem; margin-top: 0.5rem; text-align: center; }

/* ===========================
   Hero Profile (Box Full PFP)
   =========================== */
.hero-profile {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 3rem;
    overflow: hidden;
    margin-bottom: 2rem;
    border: var(--glass-border);
    display: flex; align-items: center; gap: 3rem;
}

/* Abstract Blur Background based on PFP */
.hero-profile::before {
    content: ''; position: absolute; inset: 0; z-index: 0;
    background: var(--bg-dark); opacity: 0.8;
}

.pfp-box {
    position: relative; z-index: 1;
    width: 180px; height: 180px; flex-shrink: 0;
    border-radius: var(--radius-lg); /* Box shape mostly */
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 3px solid rgba(255,255,255,0.2);
}

.pfp-box img { width: 100%; height: 100%; object-fit: cover; }

.hero-info { position: relative; z-index: 1; flex: 1; }
.hero-info h2 { font-size: 3rem; font-weight: 800; line-height: 1.1; margin-bottom: 0.5rem; }
.hero-info .subtitle { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 1.5rem; }

.info-chips { display: flex; gap: 1rem; flex-wrap: wrap; }
.chip {
    padding: 0.5rem 1rem; background: rgba(255,255,255,0.1); border-radius: 8px;
    font-size: 0.95rem; display: flex; gap: 0.5rem; align-items: center;
}
.chip-id { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }

/* ===========================
   Dashboard Grid
   =========================== */
.content-grid { display: grid; grid-template-columns: 350px 1fr; gap: 2rem; }

/* Left Column (Stats & Chart) */
.aside-column { display: flex; flex-direction: column; gap: 1.5rem; }

.stats-grid-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat-item {
    background: var(--bg-card); padding: 1.5rem; border-radius: var(--radius-lg);
    border: var(--glass-border); text-align: center;
}
.stat-item h4 { color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-item .val { font-size: 1.8rem; font-weight: 800; color: white; }

/* Numeric Summary Grid */
.sem-summary-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.75rem;
}
.sem-summary-item {
    background: rgba(255,255,255,0.05); border-radius: 8px; padding: 0.75rem 0.5rem; text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
}
.sem-summary-item .lbl { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 2px; }
.sem-summary-item .val { font-weight: 700; font-size: 1.1rem; color: #fff; }

/* Right Column (Semesters) */
.semesters-list { display: flex; flex-direction: column; gap: 1.5rem; }

.sem-block {
    background: var(--bg-card); border-radius: var(--radius-lg); border: var(--glass-border);
    overflow: hidden;
}
.sem-header {
    padding: 1.25rem 2rem; background: rgba(255,255,255,0.03);
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}
.sem-header:hover { background: rgba(255,255,255,0.05); }
.sem-title { font-size: 1.1rem; font-weight: 700; color: white; }
.sem-meta { color: var(--text-secondary); font-size: 0.9rem; }
.sem-sgpa { 
    background: rgba(168, 85, 247, 0.15); color: #c084fc; padding: 4px 10px; border-radius: 6px; font-weight: 700; margin-left: 1rem; 
}

/* Table */
.sem-body { padding: 0 1rem; }  /* Removed active class handling specifically to just show always or refine via JS */
.results-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.results-table th, .results-table td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
.results-table th { color: var(--text-secondary); font-weight: 600; font-size: 0.85rem; }

.grade-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.grade-O { background: #34d399; box-shadow: 0 0 8px #34d399; }
.grade-A { background: #60a5fa; }
.grade-F { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* Responsive */
@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .hero-profile { flex-direction: column; text-align: center; padding: 2rem; }
    .search-container.centered { width: 95%; padding: 2rem; }
}

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeInUp 0.6s ease forwards; }
.fade-in-delay-1 { animation: fadeInUp 0.6s ease 0.1s forwards; opacity: 0; }
.fade-in-delay-2 { animation: fadeInUp 0.6s ease 0.2s forwards; opacity: 0; }

/* ===========================
   Health Check UI
   =========================== */
.health-check-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.health-check-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem 4rem;
    background: var(--bg-glass);
    border-radius: var(--radius-xl);
    border: var(--glass-border);
    backdrop-filter: var(--backdrop-blur);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    min-width: 400px;
    max-width: 90vw;
    animation: slideUp 0.4s ease;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.health-status {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.health-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Mini loader fallback (for simple states) */
.mini-loader {
    display: flex;
    justify-content: center;
    padding: 1rem;
}
