/* IVC Control Design System v2.0 - CONSOLIDATED */
/* Conceptual Foundation: Invisible Tech, Clinical Data, Predictive Flow */

:root {
    /* --- Foundation Colors --- */
    --ivc-primary: #6200EA;       /* Primary Action */
    --ivc-neon: #B388FF;          /* Halo/AI/Accent */
    --ivc-alert: #FF0055;         /* Critical/Error */
    --ivc-bg: #F4F6F9;            /* Vapor/Off-White Background */
    --ivc-obsidian: #120E16;      /* Deep Black/Text */
    
    /* Semantic Colors from Overrides */
    --clinical-white: #FFFFFF;
    --off-white: #F4F6F9;
    --deep-void: #311B92;         /* High Contrast Text */
    --lavender-grey: #D1C4E9;     /* Structural Borders */
    
    --text-primary: #311B92;      /* Main Text color for readability */
    --text-secondary: #655C80;    /* Muted Text */
    --text-data: #6200EA;         /* Data Numbers */
    
    /* --- Effects --- */
    --glass-bg: rgba(255, 255, 255, 0.70);
    --glass-panel: rgba(255, 255, 255, 0.60);
    --glass-modal: rgba(255, 255, 255, 0.90);
    
    --ivc-glass-border: rgba(98, 0, 234, 0.1); /* Unified border style */
    
    /* Shadows */
    --shadow-levitate: 0 10px 40px -10px rgba(98, 0, 234, 0.25);
    --shadow-focus: 0 0 20px rgba(179, 136, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(98, 0, 234, 0.10);
    --card-shadow: 0 10px 40px -10px rgba(98, 0, 234, 0.15);
}

/* --- 1. Global Reset & Typography --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@500;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--ivc-bg) !important;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 120px; /* Space for Dock */
}

/* Remove Bootstrap bg-light if applied elsewhere */
.bg-light {
    background-color: var(--ivc-bg) !important;
}

h1, h2, h3, h4, .ivc-header, .display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ivc-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

/* Data Numbers Hierarchy */
.data-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    color: var(--text-data);
    font-weight: 700;
    line-height: 1;
}

.data-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* --- 2. Glassmorphism Utilities & Cards --- */
.glass, .ivc-card, .IVC-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ivc-glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-levitate);
    padding: 24px;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.IVC-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 50px -10px rgba(98, 0, 234, 0.25);
}

.IVC-header {
    font-size: 1.25rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--ivc-bg); /* Using bg color for subtle separator */
    padding-bottom: 10px;
}

/* --- 3. Buttons & Inputs --- */
.btn-ivc, .btn-primary {
    background: linear-gradient(135deg, var(--ivc-primary) 0%, var(--ivc-neon) 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    box-shadow: 0 4px 15px rgba(98, 0, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-ivc:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(98, 0, 234, 0.4);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--lavender-grey);
    text-transform: uppercase;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

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

input.ivc-input {
    background: var(--ivc-bg);
    border: none;
    border-bottom: 2px solid var(--lavender-grey);
    padding: 15px;
    border-radius: 8px 8px 0 0;
    width: 100%;
    transition: border-color 0.3s;
    font-family: 'Inter', sans-serif;
}

input.ivc-input:focus {
    outline: none;
    border-color: var(--ivc-primary);
    background: white;
}

/* --- 4. Dock & Omnibar Architecture --- */

/* The Dock (Solid Glass Container) */
.ivc-dock {
    position: fixed;
    bottom: 20px;
    left: 5%;
    width: 90%;
    
    background: rgba(255, 255, 255, 0.85); /* Increased opacity */
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    
    border: 1px solid var(--ivc-glass-border);
    border-radius: 50px;
    
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 20px;
    z-index: 1000;
    box-shadow: var(--shadow-levitate);
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--ivc-obsidian);
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.dock-item.active, .dock-item:hover {
    opacity: 1;
    color: var(--ivc-primary);
    transform: translateY(-2px);
}

.dock-item svg {
    margin-bottom: 4px;
    stroke-width: 2;
}

/* The Omnibar */
.omnibar-container {
    position: relative;
    width: 60px; 
    height: 60px;
    margin-top: -30px; /* Pull up */
}

.omnibar-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ivc-bg);
    border: 2px solid var(--ivc-neon);
    box-shadow: 0 0 15px var(--ivc-neon);
    
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.omnibar-input {
    display: none;
    border: none;
    background: transparent;
    width: 100%;
    height: 100%;
    font-size: 1rem;
    color: var(--ivc-primary);
    font-family: 'Space Grotesk', sans-serif;
    outline: none;
    margin-left: 10px;
}

.omnibar-btn.expanded {
    width: 400px;
    border-radius: 30px;
    padding-left: 20px;
    padding-right: 20px;
    justify-content: flex-start;
    border-color: var(--ivc-neon);
    background: rgba(255, 255, 255, 0.95);
}

.omnibar-btn.expanded .omnibar-input {
    display: block;
}

/* Animations */
@keyframes pulse-listening {
    0% { box-shadow: 0 0 15px var(--ivc-neon); transform: translate(-50%, -50%) scale(1); }
    50% { box-shadow: 0 0 25px var(--ivc-neon), 0 0 50px var(--ivc-primary); transform: translate(-50%, -50%) scale(1.1); }
    100% { box-shadow: 0 0 15px var(--ivc-neon); transform: translate(-50%, -50%) scale(1); }
}

@keyframes pulse-thinking {
    0% { border-color: var(--ivc-neon); transform: translate(-50%, -50%) rotate(0deg); }
    100% { border-color: var(--ivc-alert); transform: translate(-50%, -50%) rotate(360deg); }
}

.omnibar-listening {
    animation: pulse-listening 2s infinite ease-in-out;
}

.omnibar-thinking {
    animation: pulse-thinking 1.5s infinite linear;
}

/* --- 5. Profile & Layout Grid --- */
.IVC-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.profile-pic-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: var(--off-white);
    background-size: cover;
    background-position: center;
    border: 3px solid var(--ivc-primary);
    box-shadow: var(--shadow-levitate);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.profile-upload-label {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--ivc-primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.profile-upload-label:hover {
    transform: scale(1.1);
}

.profile-upload-input {
    display: none;
}

.profile-info {
    list-style: none;
    font-size: 1rem;
    color: var(--text-primary);
    padding-left: 0;
}

.connection-list {
    list-style: none;
    padding: 0;
}

.profile-link {
    background: none;
    border: none;
    color: var(--ivc-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    text-decoration: none;
}

.profile-link:hover {
    text-decoration: underline;
}

/* --- 6. Modal Fixes (Critical) --- */
/* Reset body to prevent locking issues */
body {
    transform: none !important;
    filter: none !important;
}

.modal, .modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10050 !important;
    pointer-events: none !important; /* Allow clicking through when hidden */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* When active */
.modal.show, 
.modal-overlay[style*="display: block"], 
.modal-overlay[style*="display: flex"] {
    pointer-events: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.modal-backdrop {
    position: fixed !important;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 10040 !important;
    background-color: rgba(0, 0, 0, 0.5) !important; /* Darker backdrop */
    pointer-events: auto !important;
}

.modal-dialog, .modal-content {
    pointer-events: auto !important;
    margin: 1.75rem auto;
    z-index: 10060 !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--ivc-neon);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(98, 0, 234, 0.3);
}


/* --- 7. Miller Columns (Navigation) --- */
.miller-container {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    height: calc(100vh - 120px); 
    width: 100%;
    background: var(--ivc-bg);
    scroll-behavior: smooth;
}

.miller-col {
    min-width: 350px;
    max-width: 350px;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid var(--lavender-grey);
    background: var(--clinical-white);
    flex-shrink: 0;
    padding: 20px;
    transition: background 0.3s;
}

.miller-item {
    display: block;
    padding: 15px;
    border-bottom: 1px solid var(--ivc-bg);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s, padding-left 0.2s;
    cursor: pointer;
    border-radius: 8px;
}

.miller-item:hover, .miller-item.active {
    background: var(--ivc-bg);
    padding-left: 20px;
    color: var(--ivc-primary);
}

.miller-item .count-badge {
    float: right;
    background: var(--lavender-grey);
    color: var(--ivc-primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* --- 8. Biometric & Heatmap Elements --- */
.biometric-halo {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.halo-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    background: #eee;
}

.halo-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    animation: rotate-halo 10s linear infinite;
}

.halo-ring {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
}

.halo-grade-high { stroke: var(--ivc-primary); }
.halo-grade-low { stroke: var(--ivc-alert); stroke-dasharray: 4, 4; }
.halo-grade-mid { stroke: var(--ivc-neon); }

@keyframes rotate-halo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Heatmap */
.heatmap-container-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 15px;
    padding: 24px;
}

.student-presence-node {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.status-present {
    background: white;
    border: 2px solid var(--ivc-primary);
    color: var(--ivc-primary);
    box-shadow: 0 0 10px rgba(98, 0, 234, 0.2);
}

.status-absent {
    background: #f5f5f5;
    border: 2px solid #ccc;
    color: #999;
    opacity: 0.3;
}

.student-presence-node:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* --- Responsive --- */
@media (max-width: 992px) {
    body {
        padding-bottom: 110px !important; 
    }
    
    .IVC-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
    
    .profile-pic-container {
        width: 120px;
        height: 120px;
    }
    
    .profile-pic {
        width: 120px;
        height: 120px;
    }
}
