/* ============================================
   RESET Y VARIABLES GLOBALES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   LOGIN - PÁGINA DE ACCESO
   ============================================ */
.login-body {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #dc2626 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 24px;
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.3);
}

.login-logo h1 {
    color: var(--dark);
    font-size: 24px;
    margin-bottom: 5px;
}

.login-logo p {
    color: var(--gray-500);
    font-size: 13px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--gray-500);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 44px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--gray-100);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--primary);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 4px solid var(--danger);
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.btn-login {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(30, 58, 138, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.login-footer p {
    color: var(--gray-500);
    font-size: 12px;
}

/* ============================================
   DASHBOARD - PANEL ADMINISTRATIVO
   ============================================ */
.dashboard-body {
    background: var(--gray-100);
    overflow-x: hidden;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.overlay.active {
    display: block;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1e3a8a 0%, #1e293b 100%);
    color: white;
    padding: 20px 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 999;
}

.sidebar-header {
    text-align: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.logo-mini {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0 10px;
}

.nav-group {
    margin-top: 20px;
}

.nav-title {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 15px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
    margin-bottom: 2px;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-item.logout {
    margin-top: 10px;
    color: #fca5a5;
}

.nav-item.logout:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #fecaca;
}

/* MAIN CONTENT */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.header {
    background: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--dark);
    padding: 5px;
}

.menu-toggle svg {
    width: 26px;
    height: 26px;
}

.header-title {
    flex-grow: 1;
}

.header-title h1 {
    font-size: 20px;
    color: var(--dark);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.user-details p {
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

.content {
    padding: 30px;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-section h2 {
    color: var(--dark);
    margin-bottom: 5px;
    font-size: 24px;
}

.subtitle {
    color: var(--gray-500);
    margin-bottom: 25px;
}

/* CARDS DE ESTADÍSTICAS */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
    border-left: 4px solid;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card.blue { border-color: var(--primary-light); }
.stat-card.green { border-color: var(--success); }
.stat-card.red { border-color: var(--danger); }
.stat-card.orange { border-color: var(--warning); }

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.stat-card.blue .stat-icon { background: var(--primary-light); }
.stat-card.green .stat-icon { background: var(--success); }
.stat-card.red .stat-icon { background: var(--danger); }
.stat-card.orange .stat-icon { background: var(--warning); }

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-info h3 {
    font-size: 26px;
    color: var(--dark);
    margin-bottom: 3px;
}

.stat-info p {
    color: var(--gray-500);
    font-size: 13px;
}

.welcome-box {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.welcome-box h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

.welcome-box p {
    color: var(--gray-700);
}

.placeholder-box {
    background: white;
    padding: 60px 30px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.placeholder-box svg {
    color: var(--gray-300);
    margin-bottom: 15px;
}

.placeholder-box h3 {
    color: var(--dark);
    margin-bottom: 8px;
}

.placeholder-box p {
    color: var(--gray-500);
}

/* ============================================
   RESPONSIVE - TABLET Y MÓVIL
   ============================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }
}

@media (max-width: 640px) {
    .login-card {
        padding: 30px 20px;
    }

    .login-logo h1 {
        font-size: 20px;
    }

    .content {
        padding: 20px 15px;
    }

    .header {
        padding: 12px 15px;
    }

    .header-title h1 {
        font-size: 17px;
    }

    .user-details {
        display: none;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .stat-info h3 {
        font-size: 22px;
    }
}

@media (max-width: 400px) {
    .login-card {
        padding: 25px 15px;
    }

    .logo-circle {
        width: 65px;
        height: 65px;
        font-size: 20px;
    }
}


/**fin css boar */
 :root {
            --fec-blue: #1a237e;
            --fec-red: #d32f2f;
        }
        body { background-color: #02214e; font-family: 'Arial Black', Gadget, sans-serif; padding: 20px; }
        
        .setup-panel { background: rgb(132, 140, 135); padding: 25px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
            #capture-area {
    display: inline-block;
    padding: 0;
    margin: 0;
    font-size: 0;
    line-height: 0;
    white-space: nowrap;
    background: transparent;
    transform: scale(0.8); /* ← 70% del tamaño real */
    transform-origin: top left;
}
        
        
        /* --- CARDS (800x504 cada una) --- */
        .card-container {
            width: 800px;
            height: 504px;
            position: relative;
            background-size: 100% 100%;
            background-color: white;
            border-radius: 10px;
            overflow: hidden;
            margin-bottom: 20px;
            display: inline-block;
            box-shadow: 0 10px 25px rgba(0,0,0,0.2);
        }

        .layer { position: absolute; z-index: 10; color: #000; pointer-events: none; }

        /* --- POSICIONAMIENTO FRENTE --- */
        #layer-photo { top: 125px; left: 22px; width: 150px; height: 180px; object-fit: cover; border: 2px solid var(--fec-blue); }
        
        /* Número de carnet (201) */
        #layer-card-num { top: 350px; left: 12px; width: 160px; text-align: center; font-size: 32px; font-weight: 900; }
        
        /* Nombre: Debajo de FEC */
        #layer-name { top: 350px; left: 250px; width: 400px; font-size: 26px; text-align: left; }

        /* Bloque Izquierda Inferior (Rango, ID, Sangre) */
        #layer-rank { top: 385px; left: 20px; font-size: 24px; text-transform: uppercase; }
        #layer-id   { top: 430px; left: 250px; font-size: 22px; }
        #layer-blood { top: 465px; left: 250px; font-size: 22px; }

        /* Bloque Derecha Inferior (Fechas y QR) */
        #layer-dates { bottom: 15px; right: 200px; text-align: right; font-size: 14px; line-height: 1.2; font-family: Arial, sans-serif; }
        #layer-qr { bottom: 20px; right: 20px; background: white; padding: 5px; }

        .label-static { font-size: 18px; font-weight: bold; color: #444; }

        /* --- POSICIONAMIENTO TRASERO (Mayormente estático) --- */
        #layer-qr-back { top: 50%; left: 50%; transform: translate(-50%, -50%); }

        .download-zone { background: #fff; padding: 20px; border-radius: 10px; text-align: center; margin-top: 20px; }
    
    