:root {
    --bg-color: #0b0f19;
    --glass-bg: rgba(20, 25, 40, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.5);
    
    --neon-green: #00ffaa;
    --neon-red: #ff3366;
    --neon-blue: #00e5ff;
    --neon-cyan: #00f0ff;
    --neon-yellow: #ffea00;
    --neon-orange: #ff8800;
    
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Particles Background */
#particles-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, #131a2a 0%, #0b0f19 100%);
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(0, 229, 255, 0.3);
    pointer-events: none;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-100px) scale(1.5); opacity: 0; }
}

/* Glassmorphism Base */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--glass-shadow);
}

/* Top Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    margin: 20px;
    z-index: 10;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-item .label {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-item .value {
    font-weight: 800;
    color: var(--text-primary);
}

.status-warning {
    color: var(--neon-yellow) !important;
}
.status-ok {
    color: var(--neon-green) !important;
}

.detected-list {
    flex-grow: 1;
    margin-left: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls inside StatusBar */
.controls {
    display: flex;
    gap: 15px;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    transition: all 0.3s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.4);
}

/* Main Dashboard */
.dashboard-layout {
    display: flex;
    flex: 1;
    padding: 0 20px 20px 20px;
    gap: 20px;
    height: calc(100vh - 100px);
}

/* Left Section: Camera */
.camera-section {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.video-container {
    position: relative;
    flex: 1;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px var(--glass-shadow);
    background: #000;
}

video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    pointer-events: none;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(11, 15, 25, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 20px;
}

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

.loading-overlay h2 {
    font-size: 24px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.loading-overlay p {
    color: var(--text-secondary);
}

/* Detection History Panel */
.history-panel {
    height: 150px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
}

.history-panel h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 10px;
}

#history-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#history-list li {
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#history-list li .time { color: var(--text-secondary); font-size: 11px; }

/* Right Section: Actions */
.action-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
}

.action-section::-webkit-scrollbar {
    width: 6px;
}
.action-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.action-card {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
    transform: translateX(0);
}

.action-card.hidden {
    opacity: 0;
    transform: translateX(50px);
    pointer-events: none;
    display: none;
}

.action-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 0 15px currentColor;
    flex-shrink: 0;
}

.content h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.content p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Micro animations for action cards */
.green-pulse { color: var(--neon-green); background: var(--neon-green); animation: pulse 1.5s infinite; }
.red-pulse { color: var(--neon-red); background: var(--neon-red); animation: pulse-fast 0.8s infinite; }
.blue-pulse { color: var(--neon-blue); background: var(--neon-blue); animation: pulse 2s infinite; }
.cyan-pulse { color: var(--neon-cyan); background: var(--neon-cyan); animation: pulse 1.5s infinite; }
.yellow-pulse { color: var(--neon-yellow); background: var(--neon-yellow); animation: pulse 2s infinite; }
.orange-pulse { color: var(--neon-orange); background: var(--neon-orange); animation: pulse 1.5s infinite; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(currentColor, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(currentColor, 0); }
    100% { box-shadow: 0 0 0 0 rgba(currentColor, 0); }
}

@keyframes pulse-fast {
    0% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(255, 51, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

/* Additional specific card glows */
.action-card.alert { border-left: 4px solid var(--neon-red); }
.action-card.info { border-left: 4px solid var(--neon-blue); }
.action-card.code { border-left: 4px solid var(--neon-cyan); }
.action-card.study { border-left: 4px solid var(--neon-yellow); }
.action-card.break { border-left: 4px solid var(--neon-orange); }
