/* Lab Builder Control Plane - Consolidated Styles */

/* ============================================
   0. Font Imports
   ============================================ */

/* NVIDIA Sans - self-hosted */
@font-face {
    font-family: 'NVIDIA Sans';
    src: url('/static/fonts/nvidiasans-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NVIDIA Sans';
    src: url('/static/fonts/nvidiasans-medium.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NVIDIA Sans';
    src: url('/static/fonts/nvidiasans-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* IBM Plex Mono - Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&display=swap');

/* ============================================
   1. CSS Variables / Theme
   ============================================ */
:root {
    /* NVIDIA Brand Palette — per nvidia-brand.md */
    --color-bg: #000000;
    --color-bg-secondary: #111111;
    --color-bg-tertiary: #1a1a1a;
    --color-border: #2a2a2a;
    --color-text: #FFFFFF;
    --color-text-muted: #C0C0C0;

    /* Single accent color - NVIDIA Green */
    --color-accent: #76B900;

    /* Action button colors */
    --color-primary: #76B900;
    --color-primary-hover: #5b8a00;
    --color-secondary: #6e7681;
    --color-secondary-hover: #848d97;
    --color-warning: #ffb300;
    --color-warning-hover: #e6a200;
    --color-danger: #ff5252;
    --color-danger-hover: #ff7070;

    /* Semantic status colors */
    --color-success: #76B900;        /* Use brand green for status pills — one green on screen */
    --color-info: #00b0ff;
    --color-status-warning: #ffb300;
    --color-status-danger: #ff5252;

    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
    --font-sans: 'NVIDIA Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 4px;
    --shadow: none;
}

/* ============================================
   2. Base / Reset
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   3. Layout
   ============================================ */

/* Header */
.header {
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-text .brand {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-muted);
}

.logo-text .product {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: 2rem;
}

.nav-tab {
    padding: 0.5rem 1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover {
    color: var(--color-text);
}

.nav-tab.active {
    color: #FFFFFF;
    border-bottom-color: var(--color-accent);
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name {
    color: var(--color-text-muted);
    font-size: 0.825rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border-bottom: 2px solid transparent;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.nav-link:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
}

.nav-link.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.nav-link svg {
    flex-shrink: 0;
    stroke: var(--color-text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    padding-bottom: 3.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.version-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.version-badge:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Sections */
.section {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
}

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

.section.collapsed .section-content { display: none; }

/* ============================================
   4. Components - Tables
   ============================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.table .actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-sm td, .table-sm th { 
    padding: 0.4rem 0.75rem; 
    font-size: 0.875rem; 
}

/* Student header with filter */
.student-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.student-header .sortable {
    cursor: pointer;
}

.student-header .sortable:hover {
    color: var(--color-accent);
}

/* Filter input */
.filter-input {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: var(--radius) !important;
    color: var(--color-text) !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.75rem !important;
    width: 100% !important;
    max-width: 110px !important;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.filter-input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

.filter-input:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.filter-input:focus {
    outline: none !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.2) !important;
}

/* ============================================
   Filter Row + Bar (full-width, above table)
   ============================================ */

.filter-row {
    margin-bottom: 0.75rem;
}

.filter-bar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.6rem 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease;
}

.filter-bar:focus-within {
    border-color: var(--color-accent);
}

.filter-search-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

/* Input inside the filter-bar: no own border, inherits bar context */
.filter-bar .filter-input {
    flex: 1;
    min-width: 140px;
    max-width: none !important;
    border: none !important;
    background: transparent !important;
    padding: 0.15rem 0.25rem !important;
    box-shadow: none !important;
}

.filter-bar .filter-input:focus {
    box-shadow: none !important;
    border: none !important;
}

/* Filter chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(118, 185, 0, 0.12);
    border: 1px solid rgba(118, 185, 0, 0.3);
    border-radius: 10px;
    font-size: 0.72rem;
    color: var(--color-text);
    white-space: nowrap;
}

.filter-chip .chip-label {
    font-size: 0.72rem;
}

.filter-chip .chip-remove {
    cursor: pointer;
    color: rgba(118, 185, 0, 0.6);
    font-size: 0.9rem;
    line-height: 1;
}

.filter-chip .chip-remove:hover {
    color: var(--color-accent);
}

/* Filter dropdown panel */
.filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    background: #1D1D1D;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    min-width: 220px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.filter-dropdown-header {
    padding: 8px 14px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
}

.filter-category {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--color-text);
}

.filter-category svg {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: color 0.15s;
}

.filter-category:hover {
    background: #2A2A2A;
    color: var(--color-accent);
}

.filter-category:hover svg {
    color: var(--color-accent);
}

/* Filter submenu panel */
.filter-submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 200;
    background: #1D1D1D;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.filter-submenu-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--color-text);
}

.filter-submenu-item:hover {
    background: #2A2A2A;
    color: var(--color-accent);
}

/* Custom checkboxes - match filter input aesthetic */
.student-checkbox,
#select-all {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.student-checkbox:hover,
#select-all:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.student-checkbox:checked,
#select-all:checked {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.student-checkbox:checked::after,
#select-all:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid rgba(255, 255, 255, 0.7);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Indeterminate state for select-all */
#select-all:indeterminate {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

#select-all:indeterminate::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 6px;
    width: 8px;
    height: 2px;
    background: rgba(255, 255, 255, 0.6);
}

.student-checkbox:focus,
#select-all:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* ============================================
   4. Components - Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Primary button - Green for positive/deploy actions */
.btn-primary {
    background: var(--color-primary);
    color: #000000;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    color: #000000;
}

/* Secondary button - Ghost style for neutral actions */
.btn-secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

/* Muted button - for less prominent actions like Clear */
.btn-muted {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-muted:hover:not(:disabled) {
    background: var(--color-border);
    color: var(--color-text);
}

/* Warning button - Ghost, colour on hover (destructive but recoverable) */
.btn-warning {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-warning:hover:not(:disabled) {
    background: rgba(255, 179, 0, 0.15);
    color: var(--color-warning);
    border-color: var(--color-warning);
}

/* Danger button - Ghost, colour on hover (permanent actions) */
.btn-danger {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 82, 82, 0.15);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* Info button - Ghost, colour on hover */
.btn-info {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-info:hover:not(:disabled) {
    background: rgba(0, 176, 255, 0.15);
    color: var(--color-info);
    border-color: var(--color-info);
}

/* All buttons when disabled - consistent muted appearance */
.btn:disabled,
.btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Success button (same as primary for consistency) */
.btn-success {
    background: var(--color-success);
    color: #000000;
}

.btn-success:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-with-icon { 
    display: inline-flex; 
    align-items: center; 
    gap: 0.4rem; 
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    min-width: auto;
    border-radius: 4px;
    vertical-align: middle;
}

.btn-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

.btn-outline-danger:hover:not(:disabled) {
    background: var(--color-danger);
    color: white;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: var(--color-text);
}

/* Refresh button - square icon */
.btn-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-refresh:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Refresh button spin animation */
.refresh-icon.spinning {
    animation: spin 0.8s linear infinite;
}

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

/* Copy button */
.btn-copy {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-copy:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-copy.copied {
    border-color: var(--color-success);
    color: var(--color-success);
}

/* Tooltip wrapper for disabled buttons */
.btn-tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.btn-tooltip-wrapper::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    font-size: 0.75rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 6px;
    width: max-content;
    max-width: 350px;
    text-align: center;
    line-height: 1.4;
}

.btn-tooltip-wrapper:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Arrow for tooltip */
.btn-tooltip-wrapper::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-border);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 1001;
    margin-bottom: 0;
}

.btn-tooltip-wrapper:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   4. Components - Badges
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(0, 200, 83, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(255, 179, 0, 0.15);
    color: var(--color-warning);
}

.badge-error {
    background: rgba(255, 82, 82, 0.15);
    color: var(--color-danger);
}

.badge-secondary {
    background: rgba(139, 148, 158, 0.2);
    color: var(--color-text-muted);
}

.badge-outline { 
    background: transparent; 
    border: 1px solid var(--color-border); 
    color: var(--color-text-muted); 
}

/* ============================================
   4. Components - Status Pills
   ============================================ */
.status-cell { 
    white-space: nowrap; 
    text-align: center; 
}

.status-pill {
    display: inline-block;
    position: relative;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    overflow: hidden;
    min-width: 90px;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Ready - brand green */
.status-ready {
    background: var(--color-success);
    color: #000000;
}

/* Not deployed - outline */
.status-none {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

/* Stopped */
.status-stopped {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

/* Building - info blue with pulse */
.status-building {
    background: var(--color-info);
    color: #000;
    animation: pulse-bg 1.5s ease-in-out infinite;
}

/* Resuming - info blue with pulse */
.status-resuming {
    background: var(--color-info);
    color: #000;
    animation: pulse-bg 1.5s ease-in-out infinite;
}

/* Stopping/Suspending - grey with pulse */
.status-stopping {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    animation: pulse-bg 1.5s ease-in-out infinite;
}

/* In-progress states - solid with pulse */
.status-deploying {
    background: var(--color-info);
    color: #000;
    animation: pulse-bg 1.5s ease-in-out infinite;
}

.status-destroying {
    background: var(--color-danger);
    color: #fff;
    animation: pulse-bg 1.5s ease-in-out infinite;
}

/* Failed - solid red */
.status-failed {
    background: var(--color-danger);
    color: #fff;
}

/* Run:AI Install Status Pills */
.status-installed {
    background: var(--color-success);
    color: #000000;
}

.status-not-installed {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.status-installing {
    background: var(--color-warning);
    color: #000;
    animation: pulse-bg 1.5s ease-in-out infinite;
}

.status-install-failed {
    background: var(--color-danger);
    color: #fff;
}

@keyframes pulse-bg {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   4. Components - Forms
   ============================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.form-group input,
.form-group select,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(118, 185, 0, 0.2);
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Input validation states */
.form-group input.input-valid {
    border-color: var(--color-success) !important;
    box-shadow: 0 0 0 2px rgba(35, 134, 54, 0.2) !important;
}

.form-group input.input-invalid {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 2px rgba(218, 54, 51, 0.2) !important;
}

.validation-feedback {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    min-height: 1.2em;
}

.validation-feedback.valid {
    color: var(--color-success);
}

.validation-feedback.invalid {
    color: var(--color-danger);
}

/* ============================================
   4. Components - Alerts
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

/* ============================================
   4. Components - Modals
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-width: 400px;
    max-width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.25rem;
}

/* Confirmation Modal */
.modal-confirm {
    max-width: 400px;
}

.modal-confirm .modal-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

.modal-confirm .modal-body {
    padding: 1.5rem 0;
}

.modal-confirm .modal-body p {
    margin: 0 0 0.5rem 0;
}

.modal-confirm .modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Notification Modal */
.modal-notification {
    max-width: 500px;
}

.modal-notification .modal-body {
    padding: 1rem 0;
}

.modal-notification .table {
    margin: 0;
}

.modal-notification .table td,
.modal-notification .table th {
    padding: 0.5rem;
}

.notification-error {
    color: var(--color-danger);
}

/* ============================================
   5. Dashboard-Specific Styles
   ============================================ */

/* Environment Banner */
.env-banner {
    background: linear-gradient(135deg, rgba(118, 185, 0, 0.1) 0%, rgba(42, 42, 42, 0.8) 100%);
    border: 1px solid rgba(118, 185, 0, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.env-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.env-primary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.env-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(118, 185, 0, 0.2);
    border-radius: var(--radius);
    color: #76B900;
}

.env-domain {
    font-size: 1.25rem;
    font-weight: 600;
    color: #FFFFFF;
}

.env-details {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.env-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #C0C0C0;
}

/* Environment badges - neutral, no colour coding */
.env-badge.aws-badge,
.env-badge.region-badge,
.env-badge.account-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-text-muted);
}

.env-badge.status-badge {
    background: rgba(118, 185, 0, 0.1);
    border-color: rgba(118, 185, 0, 0.3);
    color: #76B900;
}

.env-badge .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #76B900;
    animation: pulse-dot 2s ease-in-out infinite;
}

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

/* Action Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius);
    margin-top: 1rem;
    border: 1px solid var(--color-border);
}

.selected-count {
    font-weight: 500;
    color: var(--color-text-muted);
}

/* Actions Dropdown */
.action-dropdown {
    position: relative;
}

.action-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    min-width: 220px;
    z-index: 100;
    overflow: hidden;
}

.action-menu.open {
    display: block;
}

.action-menu-group {
    padding: 0.25rem 0;
}

.action-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 0.825rem;
    font-family: var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.action-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.action-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-item:disabled:hover {
    background: transparent;
}

.action-item-warning:hover:not(:disabled) {
    color: var(--color-warning);
}

.action-item-danger:hover:not(:disabled) {
    color: var(--color-danger);
}

.action-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Students Table Layout */
#students-table {
    table-layout: fixed;
    width: 100%;
}

/* Table column widths */
.checkbox-col { width: 40px; min-width: 40px; max-width: 40px; text-align: center !important; padding: 0.25rem !important; }
.student-col { text-align: left; width: 25%; }
.status-col { text-align: center !important; white-space: nowrap; width: 120px; min-width: 120px; }
.runai-col { text-align: center !important; white-space: nowrap; width: 130px; min-width: 130px; }
.created-col { text-align: center !important; white-space: nowrap; width: 140px; min-width: 140px; }
.age-col { text-align: center !important; white-space: nowrap; width: 80px; min-width: 80px; }
.cost-col { text-align: center !important; white-space: nowrap; width: 90px; min-width: 90px; }
td.status-cell { text-align: center !important; vertical-align: middle; }
td.runai-status-cell { text-align: center !important; vertical-align: middle; }
td.age-cell { text-align: center !important; vertical-align: middle; }
td.cost-cell { text-align: center !important; vertical-align: middle; }
.created-cell { text-align: center !important; vertical-align: middle; }
.created-display { font-size: 0.8rem; color: var(--color-text); }
.age-display { font-size: 0.8rem; color: var(--color-text-muted); }
.cost-display { font-size: 0.8rem; color: var(--color-text-muted); font-family: var(--font-mono); }

.student-name-cell {
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sortable columns */
th.sortable {
    cursor: pointer;
    user-select: none;
}
th.sortable:hover {
    color: var(--color-primary);
}
.sort-icon {
    font-size: 0.9rem;
    margin-left: 0.4rem;
    opacity: 0.7;
    font-weight: 600;
}
th.sortable:hover .sort-icon {
    opacity: 1;
    color: var(--color-accent);
}

/* Traffic Light Indicators for Run:AI Status */
.runai-status-cell { text-align: center; vertical-align: middle; }
.remove-col { vertical-align: middle; }

.traffic-light {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
}

.traffic-light.green {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}

.traffic-light.yellow {
    background: var(--color-warning);
    box-shadow: 0 0 6px var(--color-warning);
}

.traffic-light.red {
    background: var(--color-danger);
    box-shadow: 0 0 6px var(--color-danger);
}

.traffic-light.off {
    background: var(--color-bg-tertiary);
    border-color: var(--color-bg-tertiary);
    opacity: 0.5;
}

.traffic-light.grey {
    background: #6e7681;
    border-color: #6e7681;
}

.traffic-light.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Expand/Collapse for Student Details */
.expand-btn {
    background: none;
    border: none;
    padding: 0;
    margin-right: 0.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    vertical-align: middle;
}

.expand-btn .expand-icon { transition: transform 0.2s; }
.expand-btn.expanded .expand-icon { transform: rotate(90deg); }

.student-details { background: var(--color-bg-secondary); }

.details-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.details-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    font-size: 0.875rem;
}

.vscode-password-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-display {
    background: var(--color-bg);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-accent);
    border: 1px solid var(--color-border);
}

.error-message { color: var(--color-danger); grid-column: 1 / -1; }

.quick-links { display: flex; gap: 0.5rem; }

/* Quick Link buttons - prominent outlined style with NVIDIA green */
.btn-quick-link {
    background: rgba(118, 185, 0, 0.1);
    color: #76B900;
    border: 1px solid rgba(118, 185, 0, 0.4);
}

.btn-quick-link:hover:not(:disabled):not(.btn-disabled) {
    background: rgba(118, 185, 0, 0.2);
    color: #76B900;
    border-color: #76B900;
}

.btn-quick-link.btn-disabled {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Health Status Grid */
.health-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.health-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--color-bg-tertiary);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: help;
}

.health-item[title] {
    position: relative;
}

.health-item:hover {
    background: var(--color-border);
}

.health-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.health-indicator.health-healthy {
    background: var(--color-success);
    box-shadow: 0 0 4px var(--color-success);
}

.health-indicator.health-unhealthy {
    background: var(--color-danger);
    box-shadow: 0 0 4px var(--color-danger);
}

.health-indicator.health-pending {
    background: var(--color-warning);
}

.health-indicator.health-missing {
    background: #6e7681;
}

.health-indicator.health-not_installed {
    background: #6e7681;
}

.health-label {
    color: var(--color-text-muted);
}

.health-timestamp {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Logs Panel */
.logs-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-bg);
}

.logs-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 0;
}

.log-tab {
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.log-tab:hover {
    color: var(--color-text);
    background: rgba(255,255,255,0.05);
}

.log-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    background: rgba(118, 185, 0, 0.1);
}

.log-follow-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
}

.log-follow-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.log-follow-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #000;
}

.log-follow-btn .follow-label {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.log-refresh-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.log-refresh-btn:hover {
    color: var(--color-primary);
}

.logs-viewer-container {
    height: 250px;
    overflow: auto;
    position: relative;
}

.logs-viewer-content {
    margin: 0;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    color: #C0C0C0;
    min-height: 100%;
}

.logs-viewer-content.loading {
    color: var(--color-text-muted);
    font-style: italic;
}

.actions { white-space: nowrap; }

/* Recent activity section — fills remaining viewport space */
.main-content > section:last-of-type {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.main-content > section:last-of-type > .section-content {
    flex: 1;
    min-height: 0;
}

/* Scrollable recent activity */
.activity-scroll {
    max-height: none;
    overflow-y: auto;
    flex: 1;
    min-height: 120px;
}
.activity-scroll::-webkit-scrollbar {
    width: 6px;
}
.activity-scroll::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}
.activity-scroll::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}
.activity-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ============================================
   6. Login Page
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-secondary) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-box {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.75rem;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
}

/* ============================================
   7. Logs Page
   ============================================ */
.logs-page .page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.log-controls {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.log-container {
    background: #000;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
}

.log-placeholder,
.log-loading,
.log-error {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
}

.log-error {
    color: var(--color-danger);
}

.log-events {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
}

.log-event {
    padding: 0.25rem 1rem;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
}

.log-event:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-time {
    color: var(--color-text-muted);
    margin-right: 1rem;
}

.log-message {
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============================================
   8. Utility Classes
   ============================================ */
.text-muted {
    color: var(--color-text-muted);
}

.text-center {
    text-align: center;
}

.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }

/* ============================================
   8b. Pagination
   ============================================ */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-page {
    font-size: 0.8rem;
    min-width: 80px;
    text-align: center;
}

.pagination-info {
    min-width: 160px;
}

.page-size-select {
    background: #1D1D1D;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
}

.page-size-select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* ============================================
   9. Placeholder Pages
   ============================================ */

.placeholder-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 0;
}

.placeholder-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.placeholder-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 1.5rem;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card.muted {
    opacity: 0.5;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #FFFFFF;
    font-family: var(--font-mono);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.feature-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.feature-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.settings-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.settings-info-item {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.settings-info-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-info-value {
    font-size: 0.9375rem;
    color: #FFFFFF;
}

.settings-info-value code {
    font-family: var(--font-mono);
    background: var(--color-bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 2px;
}

/* ============================================
   10. Responsive
   ============================================ */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        min-width: unset;
        margin: 1rem;
    }
}
