/*
 * HEIRA Unified Dashboard & Cockpit Stylesheet
 * Centralized from web/user/remote.php and other dashboard elements.
 */

/* Main Layout & Windows Frame */
.remote-window-layout {
    display: flex;
    gap: 20px;
}
.remote-window-container {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #0d1620, stop:1 #05080c);
    background-color: #070B0E;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 192, 0.2);
    box-shadow: 0 12px 30px rgba(0, 212, 192, 0.05);
    overflow: hidden;
    margin-bottom: 20px;
    font-family: 'Segoe UI', 'Outfit', 'Inter', sans-serif;
}
.window-header {
    background-color: #0E161C;
    border-bottom: 1px solid #1c2e3f;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.window-dots {
    display: flex;
    gap: 6px;
}
.window-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.window-dots .close-dot { background: #FF5F56; }
.window-dots .min-dot { background: #FFBD2E; }
.window-dots .max-dot { background: #27C93F; }

/* Top Telemetry Notch Bar */
.telemetry-notch-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 12px 16px;
    gap: 8px;
    flex-wrap: wrap;
}
.notch-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: bold;
    color: #E2E8F0;
}
.notch-item span.val-cyan { color: #00D4C0; }
.notch-item span.val-purple { color: #A78BFA; }
.notch-item span.val-green { color: #34D399; }
.notch-item span.val-success { color: #00FF88; }
.notch-item span.val-amber { color: #FFB300; }

.notch-item .bar-container {
    width: 40px;
    height: 4px;
    background: #121D25;
    border-radius: 2px;
    overflow: hidden;
}
.notch-item .bar-container div {
    height: 100%;
    transition: width 0.4s;
}

/* Mode Navigation Toolbar */
.mode-navbar {
    background-color: #080d14;
    border-bottom: 1px solid #131d2a;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mode-nav-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #cbd5e0;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 11.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.mode-nav-btn svg {
    width: 16px;
    height: 16px;
}
.mode-nav-btn:hover {
    background-color: #101a24;
    border-color: #1a2b3c;
    color: #00D4C0;
}
.mode-nav-btn.active {
    background-color: rgba(0, 212, 192, 0.1);
    border-color: #00D4C0;
    color: #00D4C0;
}

/* Main Stack Layout */
.mode-viewport {
    padding: 16px;
    min-height: 460px;
}
.viewport-panel {
    display: none;
}
.viewport-panel.active {
    display: block;
}

/* Chat / IDE Split Layout */
.chat-ide-split {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    align-items: start;
}
.chat-card {
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 420px;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background-color: #05080c;
    border-radius: 6px;
    border: 1px solid #131d2a;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-input-row {
    display: flex;
    gap: 6px;
}
.chat-input-row textarea {
    flex: 1;
    background-color: #05080c;
    border: 1px solid #1e2d38;
    border-radius: 6px;
    color: #f7fafc;
    padding: 6px 10px;
    font-size: 11px;
    resize: none;
    height: 38px;
    font-family: inherit;
}
.chat-input-row textarea:focus {
    border-color: #00D4C0;
    outline: none;
}
.chat-input-row button {
    background-color: #00D4C0;
    border: none;
    border-radius: 6px;
    color: #05080c;
    padding: 0 14px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}
.chat-input-row button:hover {
    background-color: #00ff88;
}

/* Message Bubbles */
.chat-bubble {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    max-width: 85%;
    line-height: 1.4;
}
.chat-bubble.user {
    background-color: rgba(0, 212, 192, 0.1);
    border: 1px solid #00D4C0;
    color: #00D4C0;
    align-self: flex-end;
}
.chat-bubble.ai {
    background-color: #101a24;
    border: 1px solid #1e2d38;
    color: #cbd5e0;
    align-self: flex-start;
}

/* Smart Board Layout */
.smart-board-card {
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 12px;
    padding: 12px;
    height: 420px;
    display: flex;
    flex-direction: column;
}
.smart-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid #1c2e3f;
    padding-bottom: 6px;
    overflow-x: auto;
    white-space: nowrap;
}
.smart-tab-btn {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}
.smart-tab-btn:hover {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.02);
}
.smart-tab-btn.active {
    color: #00D4C0;
    background: rgba(0, 212, 192, 0.08);
}
.smart-viewport {
    flex: 1;
    overflow-y: auto;
    padding-top: 12px;
}
.smart-tab-content {
    display: none;
    height: 100%;
}
.smart-tab-content.active {
    display: block;
}

/* Course Cards */
.courses-grid-layout {
    display: grid;
    grid-template-columns: 180px 180px 1fr;
    gap: 12px;
    height: 100%;
}
.course-card-btn {
    background: #05080c;
    border: 1px solid #131d2a;
    border-radius: 8px;
    padding: 10px;
    color: #cbd5e0;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}
.course-card-btn:hover {
    border-color: #00D4C0;
    background: #090d14;
}
.course-card-btn.active {
    border-color: #00D4C0;
    background: rgba(0, 212, 192, 0.05);
}
.module-list-item {
    background: #05080c;
    border: 1px solid #131d2a;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    font-size: 10.5px;
}
.module-list-item:hover {
    border-color: #00D4C0;
    color: #f8fafc;
}
.module-list-item.active {
    border-color: #00D4C0;
    background: rgba(0, 212, 192, 0.05);
    color: #00D4C0;
    font-weight: bold;
}

/* Flip Card Animation */
.flip-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.flip-card {
    background-color: transparent;
    height: 110px;
    perspective: 1000px;
    cursor: pointer;
}
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    border: 1px solid #131d2a;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.flip-card-front {
    background-color: #05080c;
    color: #00D4C0;
}
.flip-card-back {
    background-color: #090d14;
    color: #00FF88;
    transform: rotateY(180deg);
}

/* Autonomous Cockpit Styles */
.cockpit-grid {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 16px;
    align-items: start;
}
.cockpit-sidebar {
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cockpit-sub-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: #64748b;
    font-weight: 500;
    font-size: 10.5px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cockpit-sub-btn:hover {
    background-color: rgba(15, 23, 42, 0.8);
    color: #cbd5e1;
    border-left: 3px solid #334155;
}
.cockpit-sub-btn.active {
    color: #00D4C0;
    border-left: 3px solid #00D4C0;
    background-color: rgba(0, 212, 192, 0.05);
}
.cockpit-main {
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 12px;
    padding: 14px;
    height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Settings Modular Layout */
.settings-grid {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 16px;
}
.settings-sidebar {
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.settings-sidebar-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748b;
    font-weight: bold;
    font-size: 10.5px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.settings-sidebar-btn:hover {
    background-color: #101a24;
    color: #cbd5e1;
}
.settings-sidebar-btn.active {
    color: #00D4C0;
    background-color: rgba(0, 212, 192, 0.08);
}
.settings-content-card {
    background-color: #0b1219;
    border: 1px solid #1a2b3c;
    border-radius: 12px;
    padding: 16px;
    height: 420px;
    overflow-y: auto;
}

/* Forms and inputs */
.form-control {
    background-color: #05080c;
    border: 1px solid #1e2d38;
    border-radius: 6px;
    color: #f7fafc;
    padding: 6px 10px;
    font-size: 11px;
    width: 100%;
}
.form-control:focus {
    border-color: #00D4C0;
    outline: none;
}
.btn {
    background-color: #101a24;
    border: 1px solid #203548;
    color: #cbd5e0;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
}
.btn:hover {
    background-color: #182837;
    border-color: #00ff88;
    color: #00ff88;
}
.btn-accent {
    background: linear-gradient(135deg, #00D4C0 0%, #00B3A1 100%) !important;
    color: #060d14 !important;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
    border: none !important;
    border-radius: 10px !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    box-shadow: 0 4px 15px rgba(0, 212, 192, 0.35) !important;
}
.btn-accent:hover {
    background: linear-gradient(135deg, #00F0E0 0%, #00C4B2 100%) !important;
    color: #04080e !important;
    box-shadow: 0 6px 22px rgba(0, 212, 192, 0.55) !important;
}
.btn-danger {
    background: rgba(255, 51, 68, 0.12) !important;
    border: 1px solid rgba(255, 51, 68, 0.35) !important;
    color: #ff4d5e !important;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
    font-weight: 700 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}
.btn-danger:hover {
    background: #ff3344 !important;
    color: #FFF !important;
    border-color: #ff3344 !important;
    box-shadow: 0 4px 15px rgba(255, 51, 68, 0.4) !important;
}

/* Key Inspector Controls */
.api-key-row {
    background: #05080c;
    border: 1px solid #131d2a;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}
.api-key-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.action-icon {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.action-icon:hover {
    background: rgba(255,255,255,0.05);
}
.action-icon svg {
    width: 14px;
    height: 14px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #1c2e3a;
    transition: .4s;
    border-radius: 16px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 10px; width: 10px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #00D4C0;
}
input:checked + .slider:before {
    transform: translateX(12px);
}

/* Custom Yes/No confirmation dialog */
.custom-popup {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.custom-popup.active {
    display: flex;
}
.custom-popup-content {
    background: #0b1219;
    border: 2px solid #00D4C0;
    border-radius: 12px;
    padding: 20px;
    width: 320px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 212, 192, 0.4);
}
.custom-popup-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

/* Console logs box */
.console-logs-card {
    background:#070B0E;
    border:1px solid #1c2e3f;
    border-radius:8px;
    padding:12px;
}
.console-logs-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-bottom:1px solid #1c2e3f;
    padding-bottom:6px;
    margin-bottom:8px;
}
.console-output-pre {
    height:110px;
    overflow-y:auto;
    font-family:'Consolas', monospace;
    font-size:11px;
    color:#00FF88;
    background:#05080c;
    padding:8px 12px;
    border-radius:6px;
    line-height:1.4;
    white-space:pre-wrap;
    margin:0;
}

/* Security and 2FA Specific Card Styles */
.card {
    background-color: #121A22;
    border: 1px solid #1E2D38;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1E2D38;
    padding-bottom: 14px;
    margin-bottom: 20px;
}
.badge-active { background-color: rgba(0,212,192,0.15); color: #00D4C0; border: 1px solid #00D4C0; }
.badge-inactive { background-color: rgba(255,77,77,0.15); color: #FF4D4D; border: 1px solid #FF4D4D; }

.flashcards-layout-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 14px;
}
.cockpit-inner-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 12px;
}

/* ── Dashboard Responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
    .dashboard-layout {
        flex-direction: column;
    }
    .telemetry-notch-bar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 10px;
    }
    .notch-item {
        font-size: 10px;
    }
    .action-grid, .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .courses-grid-layout {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
        gap: 12px;
    }
    .remote-window-container {
        border-radius: 8px;
        margin-bottom: 12px;
    }
    .window-header {
        padding: 8px 12px;
        flex-wrap: wrap;
    }
    .telemetry-notch-bar {
        margin: 8px 10px;
        padding: 6px 8px;
        gap: 4px;
    }
    .notch-item {
        font-size: 9px;
        gap: 4px;
    }
    .notch-item .bar-container {
        width: 30px;
    }
    .action-grid, .quick-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .console-output-pre {
        height: 80px;
        font-size: 10px;
    }
    .card {
        padding: 14px;
        border-radius: 8px;
        margin-bottom: 14px;
    }
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Cockpit, Settings, and Course layout responsive collapse */
    .cockpit-grid, .settings-grid, .courses-grid-layout, .flashcards-layout-grid, .cockpit-inner-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .cockpit-main {
        height: auto !important;
        min-height: 380px;
    }
    .settings-sidebar, .cockpit-sidebar {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 8px !important;
    }
    .settings-sidebar button, .cockpit-sidebar button, .settings-sidebar a, .cockpit-sidebar a, .cockpit-sub-btn {
        width: auto !important;
        flex: 1 1 auto !important;
        text-align: center !important;
        justify-content: center !important;
        font-size: 10px !important;
        padding: 6px 8px !important;
    }
}

@media (max-width: 480px) {
    .telemetry-notch-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .window-header {
        padding: 6px 8px;
    }
    .card {
        padding: 10px;
    }
}
