@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
    --bg-primary: #0a0d14;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(26, 35, 55, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(16, 185, 129, 0.4);
    
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-glow: rgba(16, 185, 129, 0.25);
    --accent-cyan: #06b6d4;
    --accent-indigo: #6366f1;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(6, 182, 212, 0.07) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 65%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Glassmorphism containers */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Header Navbar - Responsivo para Móvil */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 13, 20, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
    flex-shrink: 0;
}

.brand-text-container {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    background: linear-gradient(135deg, #fff 30%, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 0.7rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Session Selector Dropdown */
.session-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    max-width: 100%;
}

.session-select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    padding: 4px 0;
    max-width: 240px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.session-select option {
    background: #121826;
    color: var(--text-main);
}

/* Container Layout */
.app-container {
    max-width: 1150px;
    width: 92%;
    margin: 1.5rem auto;
    flex: 1;
}

/* Auth Section (Login) */
.auth-wrapper {
    max-width: 420px;
    margin: 3rem auto;
    padding: 2.25rem 1.75rem;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.auth-header h2 {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-control {
    width: 100%;
    padding: 0.85rem 1.1rem;
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.85rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1e1202;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-block {
    width: 100%;
}

.btn-hero {
    padding: 1.1rem 2.2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: #021a12;
    letter-spacing: 0.3px;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.btn-hero:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5);
}

/* Main Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
}

/* Cards */
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 1.5rem;
}

/* Status Info Grid */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: rgba(10, 13, 20, 0.4);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

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

.info-value {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.info-value-mono {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
}

/* Status Badge */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill.online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pill.waiting {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

/* Navigation Tabs (QR vs Pairing Code) */
.auth-tabs {
    display: flex;
    gap: 10px;
    background: rgba(10, 13, 20, 0.6);
    padding: 6px;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.tab-btn.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* QR Code Container Box */
.qr-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qr-box {
    width: 250px;
    height: 250px;
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.25);
    margin: 1rem 0;
    position: relative;
}

.qr-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.qr-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 24, 38, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--primary);
    gap: 10px;
    padding: 1rem;
}

/* Pairing Code Display Box */
.pairing-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.pairing-box {
    margin: 1.25rem 0;
    padding: 1.5rem 1.75rem;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(10, 13, 20, 0.8) 100%);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 360px;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.15);
    transition: var(--transition);
}

.pairing-code-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 5px;
    color: #34d399;
    text-shadow: 0 0 20px rgba(52, 211, 153, 0.5);
    margin-bottom: 0.5rem;
    user-select: all;
}

.copy-btn {
    margin-top: 0.5rem;
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* Circular Countdown Timer */
.timer-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 0.75rem;
    background: rgba(10, 13, 20, 0.6);
    padding: 8px 18px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.timer-svg {
    width: 34px;
    height: 34px;
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.timer-circle-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Admin Modal & Tables */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container-lg {
    width: 94%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transform: translateY(20px);
    transition: var(--transition);
    overflow: hidden;
}

.modal-overlay.active .modal-container-lg {
    transform: translateY(0);
}

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

.modal-body-scroll {
    overflow-y: auto;
    flex: 1;
    padding-right: 6px;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.88rem;
}

.data-table th, .data-table td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    background: rgba(10, 13, 20, 0.6);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Checkbox Grid for Session Assignment */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 13, 20, 0.5);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    padding: 0.9rem 1.4rem;
    border-radius: var(--radius-md);
    background: rgba(18, 24, 38, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }

/* --- REGLAS RESPONSIVAS MÓVILES (FIX HEADER OVERFLOW) --- */
@media (max-width: 850px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .navbar {
        padding: 0.85rem 1rem;
        gap: 8px;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .brand-badge {
        font-size: 0.62rem;
        padding: 2px 6px;
    }

    .session-select-wrapper {
        width: 100%;
        order: 3;
        margin-top: 4px;
        justify-content: space-between;
    }

    .session-select {
        max-width: none;
        width: 100%;
        font-size: 0.85rem;
    }

    .nav-actions {
        gap: 6px;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.88rem;
    }

    .pairing-code-text {
        font-size: 2rem;
        letter-spacing: 3px;
    }
}

@media (max-width: 480px) {
    .brand-text-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .card-body {
        padding: 1rem;
    }

    .pairing-box {
        padding: 1.25rem 1rem;
    }
}

/* Animations & Helpers */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.hidden {
    display: none !important;
}
