/* Base Theme & Variables */
:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.4);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Glow */
.glow-bg {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.05), transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.05), transparent 40%);
    z-index: -1;
    pointer-events: none;
}

/* Header */
.glass-header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.glass-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Pulse */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pulse {
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% { transform: scale(2); opacity: 0; }
}

/* Dashboard Grid */
.dashboard {
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Glass Panels (Device Cards) */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-glow);
    border-color: rgba(56, 189, 248, 0.3);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.device-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    background: rgba(255,255,255,0.1);
}
.badge.online { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid var(--success); }
.badge.offline { background: rgba(239, 68, 68, 0.2); color: var(--error); border: 1px solid var(--error); }

/* Telemetry Grid */
.telemetry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.telemetry-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.telemetry-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

.telemetry-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
    display: block;
}

/* Commands Timeline */
.commands-list {
    margin-bottom: 1.5rem;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.875rem;
}

.commands-list::-webkit-scrollbar { width: 4px; }
.commands-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.command-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cmd-status {
    font-size: 0.7rem;
    text-transform: uppercase;
}
.cmd-status.pending { color: var(--warning); }
.cmd-status.done { color: var(--success); }

/* Buttons & Inputs */
.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.modal {
    width: 100%;
    max-width: 400px;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal {
    transform: scale(0.9);
}

.modal h2 { margin-top: 0; margin-bottom: 0.25rem; }
.modal-subtitle { color: var(--accent); margin-bottom: 1.5rem; font-size: 0.875rem; }

.input-group {
    margin-bottom: 1rem;
}
.input-group label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}
.input-group select, .input-group textarea {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: white;
    font-family: monospace;
}
.input-group select:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Loading state */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 40vh;
    color: var(--text-muted);
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------
   Tabs & Setup Guide
-------------------------- */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-right: auto;
    margin-left: 2rem;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-color: rgba(56, 189, 248, 0.3);
}

/* Setup Panel */
.setup-guide {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.setup-panel {
    display: block;
}

.setup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.setup-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* Code Container */
.code-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.code-container pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
    color: #a6ffaa;
    font-family: monospace;
    font-size: 0.85rem;
}

.code-container .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    z-index: 2;
}
