/* ============================================
   LM CAM - Estilos Premium Dark Mode
   ============================================ */

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

/* ---- CSS Variables ---- */
:root {
    --bg-primary: #07070d;
    --bg-secondary: #0e0e18;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --glass: rgba(15, 15, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent: #00d4ff;
    --accent-glow: rgba(0, 212, 255, 0.25);
    --accent2: #7c3aed;
    --accent2-glow: rgba(124, 58, 237, 0.25);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #5f6673;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

/* ---- Animated Background ---- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Utility ---- */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.hidden { display: none !important; }

/* ---- Top Navbar ---- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 24px;
    background: rgba(7, 7, 13, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}
.navbar__brand .icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.navbar__links { display: flex; gap: 8px; }
.navbar__links a {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}
.navbar__links a:hover, .navbar__links a.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.navbar__links a.active { color: var(--accent); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    transition: var(--transition);
    letter-spacing: -0.01em;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00a8cc);
    color: #000;
    box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
    box-shadow: 0 6px 30px rgba(0, 212, 255, 0.4);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-icon {
    width: 40px; height: 40px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    transition: var(--transition);
}
.btn-icon:hover { color: var(--accent); background: var(--bg-card-hover); }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    padding: 24px;
    transition: var(--transition);
}
.card:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,0.1); }
.card__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Form Controls ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-control {
    width: 100%;
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ---- Status Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge--scanning {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent);
    border: 1px solid rgba(0, 212, 255, 0.2);
}
.badge--found {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge--unknown {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.badge--loading {
    background: rgba(124, 58, 237, 0.12);
    color: var(--accent2);
    border: 1px solid rgba(124, 58, 237, 0.2);
}
.badge__dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ============================================
   CAMERA VIEW - index.html
   ============================================ */
.camera-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: 100vh;
    padding-top: 68px;
}
.camera-feed {
    position: relative;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.camera-feed video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.camera-feed canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Scanline effect */
.camera-feed::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 212, 255, 0.015) 2px,
        rgba(0, 212, 255, 0.015) 4px
    );
    pointer-events: none;
    z-index: 2;
}

/* Scan sweep animation */
.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 20px var(--accent), 0 0 60px var(--accent-glow);
    z-index: 3;
    animation: scan-sweep 3s linear infinite;
    opacity: 0.6;
}
@keyframes scan-sweep {
    0% { top: 0; }
    100% { top: 100%; }
}

/* Camera overlay corners */
.camera-corners {
    position: absolute;
    inset: 40px;
    z-index: 3;
    pointer-events: none;
}
.camera-corners::before, .camera-corners::after,
.camera-corners span::before, .camera-corners span::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--accent);
    border-style: solid;
    border-width: 0;
    opacity: 0.5;
}
.camera-corners::before { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.camera-corners::after { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.camera-corners span::before { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.camera-corners span::after { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

/* Camera status bar */
.camera-status {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.camera-timestamp {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 5;
}

/* ---- Person Info Sidebar ---- */
.sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar__header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.sidebar__header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.sidebar__content { padding: 24px; flex: 1; }

/* Person card in sidebar */
.person-card {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.person-card__photo {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px solid var(--glass-border);
    position: relative;
}
.person-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.person-card__photo .confidence-ring {
    position: absolute;
    inset: -3px;
    border-radius: var(--radius);
    border: 2px solid var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}
.person-card__name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.person-card__role {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 20px;
}
.person-card__details { display: flex; flex-direction: column; gap: 14px; }
.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.detail-row__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.detail-row__content { flex: 1; }
.detail-row__label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.detail-row__value {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    height: 100%;
}
.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}
.empty-state__text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ============================================
   ADMIN VIEW - admin.html
   ============================================ */
.admin-layout {
    padding-top: 84px;
    padding-bottom: 40px;
}
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.admin-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.admin-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
}
.stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Person grid */
.persons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.person-tile {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}
.person-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: rgba(0, 212, 255, 0.2);
}
.person-tile__photo {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-secondary);
    overflow: hidden;
}
.person-tile__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}
.person-tile:hover .person-tile__photo img { transform: scale(1.05); }
.person-tile__info { padding: 16px; }
.person-tile__name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.person-tile__role {
    font-size: 0.8rem;
    color: var(--accent);
}
.person-tile__actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal__header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}
.modal__body { padding: 24px; }
.modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Camera capture in modal */
.capture-area {
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}
.capture-area video, .capture-area canvas, .capture-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.capture-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

/* ---- Notification Toast ---- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    font-size: 0.875rem;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}
.toast--success { border-color: rgba(16, 185, 129, 0.3); }
.toast--error { border-color: rgba(239, 68, 68, 0.3); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---- Loading Spinner ---- */
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   SECURITY SYSTEM STYLES
   ============================================ */

/* Navbar controls */
.navbar__controls {
    display: flex;
    align-items: center;
    gap: 12px;
}
.navbar__subtitle {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* REC indicator */
.rec-indicator {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--danger);
    letter-spacing: 0.08em;
}
.rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: rec-blink 1s ease-in-out infinite;
}
@keyframes rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* Alert badge */
.badge--alert {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: alert-badge-pulse 0.8s ease-in-out infinite;
}
@keyframes alert-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(239, 68, 68, 0.2); }
}

/* Camera red flash on alert */
.camera-feed.alert-flash {
    animation: camera-alert-flash 0.6s ease-in-out infinite;
}
.camera-feed.alert-flash .scan-line {
    background: linear-gradient(90deg, transparent, var(--danger), transparent);
    box-shadow: 0 0 20px var(--danger), 0 0 60px rgba(239, 68, 68, 0.3);
}
.camera-feed.alert-flash .camera-corners::before,
.camera-feed.alert-flash .camera-corners::after,
.camera-feed.alert-flash .camera-corners span::before,
.camera-feed.alert-flash .camera-corners span::after {
    border-color: var(--danger);
    opacity: 1;
}
@keyframes camera-alert-flash {
    0%, 100% { box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.0); }
    50% { box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.15); }
}

/* Authorized badge */
.authorized-badge {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

/* ---- Alert Panel ---- */
.alert-panel {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.alert-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.alert-header.alert-pulse {
    animation: alert-panel-pulse 1s ease-in-out infinite;
}
@keyframes alert-panel-pulse {
    0%, 100% { background: rgba(239, 68, 68, 0.1); }
    50% { background: rgba(239, 68, 68, 0.2); }
}
.alert-icon {
    font-size: 2rem;
    animation: alert-icon-shake 0.5s ease-in-out infinite;
}
@keyframes alert-icon-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}
.alert-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--danger);
    letter-spacing: 0.04em;
}
.alert-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.alert-capture {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid rgba(239, 68, 68, 0.4);
    position: relative;
    margin-bottom: 4px;
}
.alert-capture img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.alert-capture-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.alert-actions {
    display: flex;
    gap: 8px;
}

/* Alert history */
.alert-history-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}
.alert-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}
.alert-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.alert-history-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(239, 68, 68, 0.2);
}
.alert-history-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(239, 68, 68, 0.3);
    flex-shrink: 0;
}
.alert-history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.alert-history-time {
    font-size: 0.75rem;
    color: var(--text-primary);
    font-family: var(--mono);
}
.alert-history-label {
    font-size: 0.7rem;
    color: var(--danger);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    position: relative;
    z-index: 1;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    padding: 40px 32px;
    animation: modalSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.login-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}
.login-form { margin-bottom: 16px; }
.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    justify-content: center;
    margin-top: 8px;
}
.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: center;
}
.login-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 20px;
}

/* ============================================
   TAB SYSTEM / PANEL LAYOUT
   ============================================ */
.panel-layout { position: relative; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Camera inside tabs */
.camera-layout-inner {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: calc(100vh - 68px);
    margin-top: 68px;
}

/* Nav tab active style */
.nav-tab {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}
.nav-tab:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-tab.active { background: var(--bg-card-hover); color: var(--accent); }
.nav-logout {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--danger);
    transition: var(--transition);
    text-decoration: none;
}
.nav-logout:hover { background: rgba(239, 68, 68, 0.1); }

/* Navbar user info */
.navbar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 16px;
    border-right: 1px solid var(--border);
    margin-right: 4px;
}
.navbar__user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}
.navbar__user-role {
    font-size: 0.65rem;
    padding: 3px 8px;
}

/* ============================================
   USER MANAGEMENT ROWS
   ============================================ */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.user-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.user-row:hover {
    background: var(--bg-card-hover);
}
.user-row--inactive {
    opacity: 0.5;
}
.user-row__avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.user-row__info { flex: 1; }
.user-row__name {
    font-weight: 600;
    font-size: 0.95rem;
}
.user-row__meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.user-row__login {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 140px;
}
.user-row__actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   SIDEBAR DASHBOARD LAYOUT
   ============================================ */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar-nav {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-nav__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-nav__logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--success), #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.sidebar-nav__title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--success);
    letter-spacing: -0.02em;
}
.sidebar-nav__badge {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-top: 1px;
}
.sidebar-nav__menu {
    flex: 1;
    padding: 12px 12px;
}
.sidebar-nav__section {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    padding: 16px 12px 6px;
    text-transform: uppercase;
}
.sidebar-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
}
.sidebar-nav__item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.sidebar-nav__item.active {
    background: var(--success);
    color: #000;
    font-weight: 600;
}
.sidebar-nav__icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-nav__footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}
.sidebar-nav__logout {
    color: var(--danger) !important;
}
.sidebar-nav__logout:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    height: 60px;
    background: rgba(7, 7, 13, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
}
.topbar__toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
}
.topbar__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: -0.02em;
}
.topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar__username {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding-top: 60px;
    min-height: 100vh;
}
.page-content {
    display: none;
    padding: 28px;
}
.page-content.active {
    display: block;
}

/* Camera inside dashboard */
.camera-page {
    display: none;
    padding: 0;
}
.camera-page.active {
    display: grid;
    grid-template-columns: 1fr 340px;
    height: calc(100vh - 60px);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .sidebar-nav {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar-nav.open {
        transform: translateX(0);
    }
    .topbar {
        left: 0;
    }
    .topbar__toggle {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .camera-page.active {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    .sidebar { max-height: 40vh; border-left: none; border-top: 1px solid var(--border); }
    .persons-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .user-row { flex-wrap: wrap; }
    .user-row__login { display: none; }
}
@media (max-width: 600px) {
    .page-content { padding: 16px; }
    .admin-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .modal { max-width: 100%; margin: 10px; }
    .login-card { padding: 32px 20px; }
    .stats-row { grid-template-columns: 1fr; }
}

/* ============================================
   Alert Cards - Historial de intrusos
   ============================================ */

.alerts-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.alerts-empty__icon {
    font-size: 3rem;
    margin-bottom: 16px;
}
.alerts-empty h3 {
    color: var(--success);
    margin-bottom: 8px;
}

.alert-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}
.alert-card:hover {
    background: var(--bg-card-hover);
    border-left-color: var(--warning);
}

.alert-card__photo {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--danger);
}
.alert-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.alert-card__count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.alert-card__info {
    flex: 1;
    min-width: 0;
}
.alert-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.alert-card__badge {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
}
.alert-card__times {
    color: var(--warning);
    font-size: 0.8rem;
    font-weight: 600;
}
.alert-card__dates {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.alert-card__dates strong {
    color: var(--text-primary);
}
.alert-card__device {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.alert-card__actions {
    flex-shrink: 0;
}

/* Alerts badge on sidebar */
.sidebar-nav__badge-count {
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
    animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@media (max-width: 768px) {
    .alert-card { flex-wrap: wrap; }
    .alert-card__photo { width: 60px; height: 60px; }
    .alert-card__actions { width: 100%; }
    .alert-card__actions .btn { width: 100%; justify-content: center; }
}
