:root {
    --primary: #005A9C; /* A corporate blue for DosPrados */
    --primary-light: #3B82F6;
    --secondary: #1E293B;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --border: #E2E8F0;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Dark Mode Overrides */
body.dark-mode {
    --primary: #3B82F6;
    --primary-light: #60A5FA;
    --secondary: #94A3B8;
    --background: #0F172A;
    --surface: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border: #334155;
}

/* Ensure elements with hardcoded light backgrounds have dark text in dark mode */
body.dark-mode .accordion-header,
body.dark-mode .btn-secondary {
    color: #000000;
}

body.dark-mode .btn-secondary:hover {
    color: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links li:hover {
    background: var(--background);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-links li.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

header {
    background: var(--surface);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

/* Views Container */
.view-container {
    padding: 40px;
    flex: 1;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: 12px;
}

/* Metrics Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-card i {
    font-size: 3rem;
    color: var(--primary-light);
    background: rgba(59, 130, 246, 0.1);
    padding: 16px;
    border-radius: 12px;
}

.metric-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-info p {
    color: var(--text-muted);
    font-weight: 500;
}

.chart-container {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-top: 24px;
    max-width: 800px;
}

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--background);
}

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

td img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--background);
}

/* Forms */
.card-container {
    background: var(--surface);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

.data-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-group input, .form-group select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--background);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: var(--surface);
}

.data-form h3 {
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--secondary);
}

/* Action Buttons in Table */
.action-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    margin-right: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-light);
    color: white;
}

.action-btn.delete {
    color: var(--danger);
}

.action-btn.delete:hover {
    background: var(--danger);
    color: white;
}

/* Badge Generator Styles - Exact Replica Logic */
.badge-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    background: #e5e5e5;
    padding: 40px;
    border-radius: 12px;
}

.badge-card-new {
    background: white;
    width: 8.5cm;
    height: 5.5cm;
    position: relative;
    box-sizing: border-box;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid #ddd; /* Subtle border for preview */
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    color: black;
    padding: 0.3cm;
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Prevents card from shrinking on narrow screens */
}

/* ---------------- FRONT SIDE ---------------- */
.badge-front-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    height: 1.2cm;
    margin-bottom: 0.1cm;
}
.badge-logo-container {
    height: 100%;
}
.badge-logo-container img {
    height: 100%;
    object-fit: contain;
}

.sanctions-box-top {
    display: flex;
    gap: 0.3cm;
}

.sanctions-box-top .sanction-item {
    display: flex;
    align-items: center;
    gap: 0.05cm;
}

.badge-front-content {
    display: flex;
    flex: 1;
    gap: 0.2cm;
}

.badge-col-left {
    width: 2.2cm;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.badge-photo-box {
    width: 2.2cm;
    height: 2.7cm;
    border: 3px solid #002B49;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.2cm;
    overflow: hidden;
}

.badge-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-date-box {
    text-align: center;
    font-size: 0.25cm;
    line-height: 1.2;
}
.badge-date-box strong {
    display: block;
    font-weight: 800;
}
.badge-date-box span {
    display: block;
    font-size: 0.3cm;
}

.badge-col-middle {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.05cm;
}

.badge-col-right {
    width: 2.3cm;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.1cm;
}

.data-group {
    display: flex;
    flex-direction: column;
}
.data-group label {
    font-size: 0.24cm;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}
.data-group span {
    font-size: 0.22cm;
    line-height: 1.1;
}

.badge-back h3 {
    margin: 0;
    font-size: 0.7rem;
    color: #8c4a4a;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-back p {
    margin: 2px 0 5px 0;
    font-size: 0.65rem;
    color: #333;
}

.badge-col-middle .data-group:last-child span {
    font-size: 0.24cm;
    font-style: italic;
}

.badge-col-right-dc3 {
    width: 2.5cm;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.sanction-item {
    display: flex;
    align-items: center;
    gap: 0.1cm;
}

.s-circle {
    width: 0.7cm;
    height: 0.7cm;
    border-radius: 50%;
    border: 2px solid;
    box-sizing: border-box;
}

.s-green { border-color: #00B050; }
.s-yellow { border-color: #FFC000; }
.s-red { border-color: #FF0000; }

.sanction-item span {
    font-size: 0.2cm;
    font-weight: 800;
}

/* ---------------- BACK SIDE ---------------- */
.badge-back-main {
    display: flex;
    justify-content: space-between;
    flex: 1;
    margin-bottom: 0.1cm;
}

.back-left-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 4.5cm;
}

.badge-logo-container-back {
    height: 1.1cm;
    margin-top: 0.2cm;
}
.badge-logo-container-back img {
    height: 100%;
    object-fit: contain;
}

.badge-signatures {
    display: flex;
    justify-content: space-between;
    gap: 0.2cm;
}

.sig-line {
    width: 2cm;
    border-top: 2px solid black;
    text-align: center;
    font-size: 0.22cm;
    padding-top: 0.05cm;
    line-height: 1.1;
}

.back-right-col {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.qr-box-container {
    width: 3.2cm;
    height: 3.2cm;
    border: 4px solid #002B49;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.1cm;
    box-sizing: border-box;
    margin-top: 0.8cm; /* Agregado para bajar el QR */
}

.qr-box-container #qrcode {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-box-container #qrcode img,
.qr-box-container #qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}

.badge-back-footer {
    font-size: 0.22cm;
    text-align: justify;
    line-height: 1.1;
}

/* Print Styles */
@media print {
    @page {
        margin: 1cm;
        size: auto;
    }
    
    /* Ocultar elementos de UI que no se deben imprimir */
    .sidebar, header, .view-header, .time-filters, .print-hide {
        display: none !important;
    }
    
    /* Permitir que el contenido fluya libremente y ocupe toda la página */
    body, html, .main-content, .view-container {
        height: auto !important;
        overflow: visible !important;
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    
    /* Ocultar todas las vistas excepto la activa */
    .view {
        display: none !important;
    }
    .view[style*="display: block"], .view[style*="display: flex"] {
        display: block !important;
    }

    .badge-preview-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0.5cm !important;
        align-items: flex-start !important;
        width: 100% !important;
        justify-content: center !important;
        margin: 0 !important;
        background: white !important;
        page-break-inside: avoid;
    }

    #multi-badge-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 1cm !important;
    }

    .badge-card-new {
        box-shadow: none !important;
        border: 1px dashed #666 !important;
        page-break-inside: avoid;
        margin: 0 !important;
    }

    .print-page-break {
        page-break-inside: avoid;
    }
}

/* Guard Verification View */
.verification-panel {
    background: var(--surface);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    margin: 40px auto;
    text-align: center;
}

.status-indicator {
    padding: 15px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.status-indicator.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 2px solid var(--success);
}

.status-indicator.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 2px solid var(--danger);
}

#verify-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 4px solid var(--border);
}

#verify-name {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

#verify-company {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

#verify-position {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.verify-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.verify-actions button {
    flex: 1;
}

/* Login View */
.login-card {
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-logo {
    max-width: 200px;
    margin-bottom: 20px;
}

.login-card h2 {
    margin-bottom: 8px;
    color: var(--primary);
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

/* Front logo image */
.dp-logo-img {
    height: 45px;
    object-fit: contain;
}

/* Accordion */
.accordion-header {
    background: #F0F4F8; /* Un tono azul/gris muy tenue y elegante */
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm); /* Corregido de var(--shadow) que no existía */
    font-weight: 600;
    color: var(--secondary);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.accordion-header:hover {
    background: #E2E8F0;
}
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
}

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

.accordion-content {
    display: none;
    padding: 10px 0;
}
