@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');
:root { --primary: #002d72; --accent: #00aeef; --bg: #f3f4f6; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); margin: 0; padding: 0; font-size: 13px; }
.nav { background: var(--primary); color: white; padding: 0 30px; height: 60px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.nav-content { display: flex; align-items: center; gap: 15px; }
.nav-right-section { display: flex; align-items: center; gap: 15px; }
.nav-sep { opacity: 0.5; }
.nav-logout { color: white; text-decoration: none; font-weight: 600; }
.beacon-container { width: 12px; height: 12px; position: relative; cursor: pointer; display: inline-block; margin-left:10px; }
.beacon-dot { width: 10px; height: 10px; background-color: #22c55e; border-radius: 50%; box-shadow: 0 0 8px #22c55e; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }
.lab-timer { font-family: 'Courier New', monospace; font-weight: 700; color: #fbbf24; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: 4px; margin-right: 15px; border: 1px solid rgba(255,255,255,0.1); }
.container { max-width: 1200px; margin: 15px auto; padding: 0 15px 100px 15px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 10px; background: white; padding: 10px 30px; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); align-items: center; }
.search-bar { flex-grow: 1; padding: 8px; border-radius: 4px; border: 1px solid #ddd; outline: none; }
.service-section { background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); margin-bottom: 8px; overflow: hidden; }
.service-header { background: #e0e7ff; padding: 10px 15px; cursor: pointer; font-weight: 700; color: var(--primary); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #c7d2fe; }
.service-count { font-size: 10px; }
.service-body { display: block; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 8px; border-bottom: 1px solid #f3f4f6; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; text-align: left; vertical-align: middle; }
th { color: #6b7280; border-bottom: 1px solid #e5e7eb; font-size: 11px; background: #fafafa; }
.col-device { width: 20%; }
.col-port { width: 10%; }
.col-mapping { width: 15%; }
.col-traffic { width: 15%; }
.col-actions { min-width: 220px; } /* Use min-width for actions to ensure buttons fit */
.th-std, .td-std { padding: 12px; border-bottom: 1px solid #e2e8f0; } /* General table cell styling */
.th-std { background: #f8fafc; color: #475569; border-bottom: 2px solid #e2e8f0; }
.port-wrapper { display: flex; align-items: center; gap: 8px; }
.port-number { font-weight: bold; color: #64748b; }
.mapping-code { color: #059669; background: #ecfdf5; border: 1px solid #6ee7b7; padding: 2px 5px; border-radius: 4px; font-size: 11px; }
.mapping-none { color: #94a3b8; font-size: 11px; }
.sparkline-container { display: flex; align-items: flex-end; height: 20px; gap: 1px; }
.spark-bar { width: 3px; background-color: #0ea5e9; }
.action-group { display: flex; gap: 5px; }
.btn { padding: 5px 10px; border-radius: 4px; text-decoration: none; font-weight: 600; font-size: 11px; border: none; cursor: pointer; display: inline-flex; align-items: center; }
.btn-primary { background: var(--primary); color: white; }
.btn-edit { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.btn-launch { background-color: #002d72; color: white; border: none; padding: 6px 12px; border-radius: 4px; font-size: 11px; font-weight: bold; cursor: pointer; }
.btn-connect { background-color: #002d72; color: white; border: none; padding: 6px 12px; text-decoration: none; border-radius: 4px; font-size: 11px; font-weight: bold; display: inline-block; text-align: center; }
.btn-stop-link { background-color: #ef4444; color: white; border: none; padding: 6px 12px; text-decoration: none; border-radius: 4px; font-size: 11px; font-weight: bold; display: inline-block; text-align: center; }
.btn-edit-link { background-color: #002d72; color: white; border: none; padding: 6px 12px; border-radius: 4px; font-size: 11px; font-weight: bold; cursor: pointer; }
.btn-icon { padding: 0 !important; width: 28px; height: 28px; display: inline-flex !important; align-items: center; justify-content: center; border-radius: 6px; transition: all 0.2s ease; }
.btn-icon:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); filter: brightness(1.1); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-radkit-settings { background-color: #002d72; color: white; }
.btn-admin-panel { margin-right: 10px; }
.btn-clear { background: #ef4444; color: white; border: none; }
.btn-sm { padding: 5px 10px; font-size: 11px; min-width: 90px; justify-content: center; }
.btn-secondary { background-color: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; margin-right: 5px; }
.btn-stop { color: #b91c1c; background: #fee2e2; }
.method-tag { background: #f0f7ff; color: #0056b3; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.status-cert { background: #dcfce7; color: #166534; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.status-sso { background: #fee2e2; color: #991b1b; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.expiry-timer { background: #fff1f2; color: #be123c; padding: 3px 8px; border-radius: 4px; font-weight: 700; font-size: 10px; border: 1px solid #fecdd3; }
.log-drawer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; z-index: 2000; border-top: 1px solid #ddd; }
.log-header { background: #f8fafc; color: var(--primary); padding: 6px 20px; cursor: pointer; display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; }
.log-header.flash-bg { animation: flashBg 0.5s ease-in-out; }
.log-content { height: 120px; overflow-y: auto; padding: 10px; font-family: monospace; color: #475569; display: none; background: #fdfdfd; white-space: pre-wrap; font-size: 11px; }
.modal-backdrop { display:none; position:fixed; z-index:5000; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.6); backdrop-filter:blur(2px); }
.modal-box { background:white; margin:15% auto; padding:25px; border-radius:12px; width:350px; text-align:center; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2); }
.modal-box-sm { width: 450px; }
.modal-box-md { width: 500px; }
.modal-box-lg { width: 700px; }
.modal-title { color: var(--primary); margin: 0 0 15px 0; margin-top: 0; }
.modal-subtitle { font-size: 12px; color: #64748b; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.modal-actions-right { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-group { text-align: left; margin-bottom: 15px; }
.form-label { font-size: 11px; font-weight: bold; color: #64748b; display: block; margin-bottom: 5px; }
.form-input { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.form-input-lg { padding: 10px; margin-bottom: 15px; } /* box-sizing already on .form-input */
.json-textarea { width: 100%; height: 400px; font-family: monospace; font-size: 12px; border: 1px solid #ddd; border-radius: 8px; padding: 10px; box-sizing: border-box; }
.service-json-textarea { height: 350px; }
.sso-auth-button { display:block; background:var(--primary); color:white; padding:15px; margin:20px auto; width:60%; text-decoration:none; font-weight:bold; border-radius:30px; border: 2px solid var(--accent); text-align:center; }
.checkbox-group { margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.checkbox-label { font-size: 12px; color: #334155; }
@keyframes flashBg { 0% { background-color: #f8fafc; } 50% { background-color: #bfdbfe; } 100% { background-color: #f8fafc; } }

/* Loading Screen */
.loading-container { display: flex; justify-content: center; align-items: center; min-height: 80vh; width: 100%; }
.loading-box { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 100%; max-width: 600px; text-align: center; }
.loading-title { color: var(--primary); font-weight: 700; }
.loading-subtitle { color: #64748b; margin-bottom: 25px; }
.loading-logs { background: #1e293b; color: #38bdf8; padding: 15px; border-radius: 8px; font-family: monospace; text-align: left; height: 250px; overflow-y: auto; font-size: 11px; white-space: pre-wrap; border: 1px solid #334155; }
.loading-status { margin-top: 25px; }

/* Sync Indicator */
.sync-indicator { margin-left: auto; padding: 8px; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.sync-syncing { background: #fef3c7; color: #d97706; }
.sync-active { background: #dcfce7; color: #166534; }
.sync-icon { font-size: 16px; }

/* Login */
.login-card { max-width: 450px; margin: 50px auto; text-align: center; background: white; padding: 30px; border-radius: 12px; border-top: 5px solid var(--primary); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.login-title { color: var(--primary); margin-top: 0; }
.login-msg { color: red; font-size: 11px; }
.login-input { width: 100%; padding: 10px; margin: 5px 0; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.login-label { font-size: 11px; color: #64748b; margin-top: 10px; display: block; text-align: left; }
.login-file { margin-bottom: 10px; font-size: 11px; width: 100%; }
.btn-login { width: 100%; padding: 12px; }

/* Admin & Radkit */
.page-header { justify-content: space-between; width: 100%; box-sizing: border-box; }
.page-title { margin: 0; color: var(--primary); }
.content-box { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-top: 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 20px; }
.section-title { margin: 0; color: #64748b; }
.table-header-row { background: #f8fafc; text-align: left; }
.badge { padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; }
.badge-admin { background: #dcfce7; color: #166534; }
.badge-user { background: #f1f5f9; color: #475569; }
.badge-online { background: #dcfce7; color: #166534; }
.badge-offline { background: #f1f5f9; color: #94a3b8; }
.config-active { color: var(--primary); }
.config-empty { color: #ccc; }
.global-actions-title { margin-top: 30px; color: #64748b; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.global-actions-container { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.file-input-hidden { display: none; }
.form-inline { display: inline; }
.empty-row { padding: 20px; text-align: center; color: #94a3b8; }
.fingerprint { font-size: 11px; color: #64748b; }
.fingerprint-none { color: #ccc; }

/* Admin Columns & Utilities */
.col-admin-email { width: 20%; }
.col-admin-role { width: 10%; }
.col-admin-status { width: 10%; }
.col-admin-time { width: 10%; }
.col-admin-session { width: 20%; }
.col-admin-actions { width: 30%; } /* Increased to fit 3 buttons */

/* Lab Assignment Columns */
.col-lab-user { width: 20%; }
.col-lab-device { width: 20%; }
.col-lab-port { width: 10%; }
.col-lab-actions { width: 30%; text-align: center; }

/* Radkit Settings Table Columns */
.col-radkit-alias { width: 25%; }
.col-radkit-id { width: 30%; }
.col-radkit-fingerprint { width: 25%; }
.col-radkit-actions { width: 20%; }
.btn-danger { background-color: #ef4444; color: white; border: none; }
.btn-slate { background-color: #64748b; color: white; border: none; }
.text-muted-sm { font-size: 11px; color: #64748b; }
.table-spacing { margin-bottom: 30px; }
.table-spacing th:last-child, .table-spacing td:last-child { padding-right: 0; }
.btn-validate { background: #fef3c7; }
.log-action { cursor: pointer; font-weight: 600; font-size: 11px; padding: 4px 8px; border-radius: 4px; background: rgba(0,0,0,0.05); color: var(--primary); transition: background 0.2s; }
.log-action:hover { background: rgba(0,0,0,0.1); }
.log-actions-group { display: flex; align-items: center; gap: 15px; }
.log-action-toggle { margin-left: 15px; cursor: pointer; }
.ml-auto { margin-left: auto; }
.admin-live-timer { font-family: 'Courier New', monospace; font-weight: 700; color: #166534; }

/* Lab User Sidebar Layout */
.lab-wrapper {
    display: flex;
    height: calc(100vh - 60px - 35px); /* Full height minus navbar and log drawer */
}

.lab-sidebar {
    flex: 0 0 320px; /* Do not grow, do not shrink, base width 320px */
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h3 {
    margin: 0 0 10px 0;
    color: var(--primary);
}

.sidebar-header .search-bar {
    width: 97%;
}

.sidebar-device-list {
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.sidebar-device-item:hover {
    background-color: #f8fafc;
}

.sidebar-device-item strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
    font-weight: 600;
}

.lab-main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    background-color: #f9fafb;
}

.lab-main-content h2 {
    color: var(--primary);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Tabs */
.tab-bar { display: none; background: #f1f5f9; padding: 0 10px; border-bottom: 1px solid #e2e8f0; height: 36px; align-items: flex-end; gap: 5px; }
.tab-item { padding: 8px 15px; background: #e2e8f0; border: 1px solid #cbd5e1; border-bottom: none; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 11px; font-weight: 600; color: #64748b; display: flex; align-items: center; gap: 8px; user-select: none; max-width: 150px; }
.tab-item:hover { background: #f8fafc; }
.tab-item.active { background: #ffffff; color: var(--primary); border-bottom: 1px solid #ffffff; margin-bottom: -1px; z-index: 10; box-shadow: 0 -2px 5px rgba(0,0,0,0.05); }
.tab-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-icon { font-size: 12px; line-height: 1; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; transition: all 0.2s; }
.tab-external { color: #64748b; margin-right: 2px; font-size: 10px; }
.tab-external:hover { color: var(--primary); background: #cbd5e1; }
.tab-close { font-size: 14px; margin-right: -5px; }
.tab-close:hover { background: #cbd5e1; color: #ef4444; }
.iframe-container { flex-grow: 1; position: relative; display: none; width: 100%; height: auto; overflow: hidden; background: white; }
.session-frame { width: 100%; height: 100%; border: none; display: none; }

/* Terminal View for Logs Page */
.terminal-view {
    background-color: #1e293b;
    color: #38bdf8;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 20px;
    height: 600px;
    max-height: 75vh;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    border-radius: 6px;
}

/* Dropdown Menu */
.dropdown { position: relative; display: inline-block; margin-right: 10px; }
.dropdown-content { display: none; position: absolute; right: 0; top: 100%; background-color: #fff; min-width: 180px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 3000; border-radius: 6px; border: 1px solid #e2e8f0; margin-top: 4px; }
.dropdown-content a { color: #475569; padding: 10px 15px; text-decoration: none; display: block; font-size: 12px; font-weight: 500; text-align: left; transition: background 0.2s; }
.dropdown-content a:hover { background-color: #f8fafc; color: var(--primary); }
.dropdown:hover .dropdown-content { display: block; }

/* --- Settings Page Layout --- */
.settings-wrapper {
    display: flex;
    height: calc(100vh - 60px); /* Full height minus navbar */
    overflow: hidden;
    background-color: #f8fafc;
}

.settings-sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    flex-shrink: 0;
}

.settings-nav-item {
    padding: 12px 25px;
    color: #64748b;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-nav-item:hover {
    background-color: #f8fafc;
    color: var(--primary);
}

.settings-nav-item.active {
    background-color: #eff6ff;
    color: var(--primary);
    border-left-color: var(--accent);
}

.settings-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.settings-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-tab-pane.active {
    display: block;
}

/* --- Navbar Gear Icon --- */
.nav-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.8);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0;
    text-decoration: none;
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    color: white;
}

.nav-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}