@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&family=Press+Start+2P&display=swap');

:root {
    --bg-dark: #090d16;
    --panel-bg: #111827;
    --panel-border: #1e293b;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --gold: #eab308;
    --emerald: #10b981;
    --purple: #8b5cf6;
    --rose: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.top-nav {
    background: #0f172a;
    border-bottom: 1px solid var(--panel-border);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 2rem;
    background: #1e293b;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid #334155;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-live {
    font-size: 0.7rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
    border: 1px solid var(--emerald);
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 700;
}

.brand-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stats-ribbon {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.fps-selector-box {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 4px 8px;
    border-radius: 8px;
}

.fps-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.btn-fps {
    background: #0f172a;
    border: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.15s ease;
}

.btn-fps:hover {
    color: #fff;
    border-color: #64748b;
}

.btn-fps.active {
    background: #2563eb;
    color: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.stat-pill {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-pill.permanent .stat-value { color: var(--gold); }
.stat-pill.ephemeral .stat-value { color: #38bdf8; }
.stat-pill.queue .stat-value { color: var(--rose); }
.stat-pill.completed .stat-value { color: var(--emerald); }

.status-active {
    flex-direction: row;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    font-size: 0.8rem;
    color: var(--emerald);
    font-weight: 700;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 10px var(--emerald);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.8; }
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 340px;
    flex: 1;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
}

/* Canvas Area */
.canvas-panel {
    background: #0b1120;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.canvas-header {
    background: #0f172a;
    padding: 10px 16px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.room-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: #1e293b;
    border: 1px solid #334155;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 6px;
    color: #cbd5e1;
}

.zoom-hint {
    font-size: 0.75rem;
    color: var(--gold);
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #020617;
    position: relative;
    padding: 10px;
}

#officeCanvas {
    background: #1e1b18;
    border: 2px solid #334155;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: pointer;
    max-width: 100%;
    height: auto;
}

/* Action Toolbar */
.controls-toolbar {
    background: #0f172a;
    border-top: 1px solid var(--panel-border);
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-secondary:hover { background: #475569; }

.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* Side Intel Panel */
.intel-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.panel-section {
    background: #0f172a;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.panel-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.roster-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 230px;
    overflow-y: auto;
}

.roster-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: 0.2s;
}

.roster-card:hover {
    border-color: var(--primary);
    background: #24324a;
}

.roster-info h4 {
    font-size: 0.85rem;
    color: var(--text-main);
}

.roster-info p {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.roster-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.roster-badge.permanent { background: rgba(234, 179, 8, 0.2); color: var(--gold); }
.roster-badge.ephemeral { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }

.logs-section {
    flex: 1;
}

.logs-container {
    flex: 1;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-item {
    font-size: 0.75rem;
    background: #1e293b;
    border-right: 3px solid var(--primary);
    padding: 6px 10px;
    border-radius: 4px;
    color: #cbd5e1;
}

.log-item .log-time {
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-left: 6px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: #0f172a;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
}

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

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

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #94a3b8;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 0.85rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.agent-detail-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0;
}

.detail-row {
    font-size: 0.85rem;
}

.bubble-quote {
    display: block;
    background: #1e293b;
    padding: 8px 12px;
    border-radius: 6px;
    border-right: 3px solid var(--gold);
    color: #fde047;
    margin-top: 4px;
}
