:root {
    --bg-dark: #090e1a;
    --bg-sidebar: #0e1628;
    --bg-panel: rgba(22, 34, 57, 0.45);
    --bg-panel-solid: #15223c;
    --border-color: rgba(36, 57, 98, 0.4);
    --border-color-glow: rgba(36, 57, 98, 0.8);
    
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-purple: #a855f7;
    --accent-orange: #f97316;
    --accent-green: #22c55e;
    --accent-pink: #ec4899;
    --accent-red: #ef4444;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-dark: #0f172a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.04) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== LAYOUT STRUCT ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

/* ==================== SIDEBAR BRAND & MENU ==================== */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 0 8px;
}

.brand-icon {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    background: none;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.15), rgba(168, 85, 247, 0.05));
    border-left: 3px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 600;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px;
    border-top: 1px solid var(--border-color);
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* ==================== HEADER BAR ==================== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.header-bar h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
}

.user-profile span {
    font-size: 14px;
    font-weight: 500;
}

/* ==================== TAB CONTENT & MONITORS ==================== */
.tab-content {
    display: none;
    flex-direction: column;
    gap: 24px;
}

.tab-content.active {
    display: flex;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-data h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.kpi-data .value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.glow-blue { border-color: rgba(59, 130, 246, 0.2); }
.glow-blue:hover { box-shadow: 0 8px 30px rgba(59, 130, 246, 0.1); border-color: var(--accent-blue); }
.glow-green { border-color: rgba(34, 197, 94, 0.2); }
.glow-green:hover { box-shadow: 0 8px 30px rgba(34, 197, 94, 0.1); border-color: var(--accent-green); }
.glow-orange { border-color: rgba(249, 115, 22, 0.2); }
.glow-orange:hover { box-shadow: 0 8px 30px rgba(249, 115, 22, 0.1); border-color: var(--accent-orange); }
.glow-pink { border-color: rgba(236, 72, 153, 0.2); }
.glow-pink:hover { box-shadow: 0 8px 30px rgba(236, 72, 153, 0.1); border-color: var(--accent-pink); }
.glow-cyan { border-color: rgba(6, 182, 212, 0.2); }
.glow-cyan:hover { box-shadow: 0 8px 30px rgba(6, 182, 212, 0.1); border-color: var(--accent-cyan); }
.glow-purple { border-color: rgba(168, 85, 247, 0.2); }
.glow-purple:hover { box-shadow: 0 8px 30px rgba(168, 85, 247, 0.1); border-color: var(--accent-purple); }

.bg-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.bg-green { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.bg-orange { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.bg-pink { background: rgba(236, 72, 153, 0.15); color: var(--accent-pink); }
.bg-cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.bg-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.bg-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Panels & Tables */
.content-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.panel-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.2s;
    cursor: pointer;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Expandable rows */
.expandable-row {
    background-color: rgba(0, 0, 0, 0.1);
}

.expandable-row td {
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
}

.expand-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.expandable-row.open .expand-details {
    max-height: 400px;
    padding: 16px 0;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.transcript-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    font-family: 'Inter', monospace;
    font-size: 12px;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.info-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

.info-row .label {
    color: var(--text-muted);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.simple { background-color: rgba(34, 197, 94, 0.12); color: var(--accent-green); border: 1px solid rgba(34, 197, 94, 0.25); }
.badge.medium { background-color: rgba(168, 85, 247, 0.12); color: var(--accent-purple); border: 1px solid rgba(168, 85, 247, 0.25); }
.badge.hard { background-color: rgba(239, 68, 68, 0.12); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.25); }

.badge.status-completed { background-color: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.badge.status-assigned { background-color: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge.status-transcribed { background-color: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.badge.status-failed { background-color: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: var(--text-primary);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: var(--text-primary);
}

.btn-icon {
    padding: 8px 12px;
}

.btn-block {
    width: 100%;
}

.status-btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.status-btn.free { background: rgba(34, 197, 94, 0.12); color: var(--accent-green); border-color: rgba(34, 197, 94, 0.2); }
.status-btn.busy { background: rgba(249, 115, 22, 0.12); color: var(--accent-orange); border-color: rgba(249, 115, 22, 0.2); }
.status-btn.offline { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); border-color: rgba(239, 68, 68, 0.2); }

/* ==================== FORMS & SETTINGS ==================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.col-6 {
    width: 50%;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.checkbox-group label {
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-grid input[type="checkbox"] {
    accent-color: var(--accent-cyan);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.slider-badge {
    background-color: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.slider-container input[type="range"] {
    flex-grow: 1;
    accent-color: var(--accent-orange);
}

/* ==================== SIMULATOR & STEP LOGS ==================== */
.simulator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.pipeline-logs {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Inter', monospace;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.log-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.log-empty-state i {
    font-size: 40px;
}

.pipeline-step-log {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.4s forwards ease;
}

.step-status-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-status-icon.pending {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.step-status-icon.active {
    background-color: rgba(168, 85, 247, 0.15);
    border: 1px solid var(--accent-purple);
    color: var(--accent-purple);
    animation: pulseGlow 1.5s infinite ease-in-out;
}

.step-status-icon.success {
    background-color: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.step-status-icon.error {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.step-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-details h4 {
    font-size: 13px;
    font-weight: 700;
}

.step-details p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.step-details .debug-data {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 10px;
    color: var(--accent-cyan);
    margin-top: 4px;
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 0 10px 4px rgba(168, 85, 247, 0.2); }
}

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-panel-solid);
    border: 1px solid var(--border-color-glow);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Text alignment & layout utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
