:root {
    --primary: #155D3A; /* Verde Oscuro ARFA */
    --primary-hover: #0F432A;
    --secondary: #E67E22; /* Naranja Chupalla ARFA */
    --bg-color: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --danger: #D32F2F; /* Rojo ARFA */
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

body.bg-light {
    display: block; /* Quitamos flex centrado por defecto en body */
    padding-top: 0;
    margin: 0;
}

/* Navbar */
.navbar {
    background: white;
    padding: 1rem 5%;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.nav-brand {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.25rem;
}
.nav-links {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}
.nav-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
    display: none;
}
@media (min-width: 600px) {
    .nav-text { display: inline; }
}
.nav-item {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.container {
    background: var(--surface);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin: 0 auto; /* Centrar horizontalmente al quitar flex del body */
}

.container-large {
    max-width: 800px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-report {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

#reader-container {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: #000;
    /* Para darle un aire más limpio al scanner de html5-qrcode */
}

#reader {
    width: 100%;
    border: none !important;
}

#reader img {
    max-width: 100%;
}

/* Ocultamos elementos inútiles de la librería */
#reader__dashboard_section_csr span,
#reader__dashboard_section_swaplink {
    display: none !important;
}

.actions {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

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

.btn-back {
    position: absolute;
    left: 0;
    top: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: transparent;
    border: 1px solid var(--border);
}

.status-box {
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.status-box.hidden {
    display: none;
}

.status-box.success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.status-box.error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.status-box.loading {
    background-color: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(30, 64, 175, 0.3);
    border-radius: 50%;
    border-top-color: #1E40AF;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tabla de Informes */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #F9FAFB;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #F9FAFB;
}

.data-cell {
    font-family: monospace;
    color: var(--primary);
    font-weight: 600;
    word-break: break-all;
}

.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.empty-icon {
    color: #D1D5DB;
}

.mt-3 {
    margin-top: 1.5rem;
}
