/* ==========================================================================
   GESTOR DE CHEQUES BANCARIOS - SISTEMA DE ESTILOS Y TEMAS WEB
   ========================================================================== */

:root {
    /* TEMA POR DEFECTO: AZUL NOCTURNO */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-focus: #0284c7;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-light: rgba(2, 132, 199, 0.15);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --header-bg: #090d16;
}

/* TEMA CLARO */
body.theme-claro {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #cbd5e1;
    --border-focus: #2563eb;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37, 99, 235, 0.1);
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
    --header-bg: #ffffff;
}

/* TEMA OSCURO */
body.theme-oscuro {
    --bg-primary: #22252a;
    --bg-secondary: #2b2e35;
    --bg-tertiary: #3c3f47;
    --bg-card: #2b2e35;
    --bg-input: #1f2126;
    --border-color: #444750;
    --border-focus: #4b6eaf;
    --text-primary: #ffffff;
    --text-secondary: #b1b5be;
    --text-muted: #727782;
    --accent: #4b6eaf;
    --accent-hover: #3d5a91;
    --accent-light: rgba(75, 110, 175, 0.2);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --header-bg: #191b1f;
}

/* TEMA GRIS EJECUTIVO */
body.theme-gris {
    --bg-primary: #e4e7eb;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #cbd5e1;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #94a3b8;
    --border-focus: #334155;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #334155;
    --accent-hover: #1e293b;
    --accent-light: rgba(51, 65, 85, 0.15);
    --success: #047857;
    --danger: #b91c1c;
    --warning: #b45309;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    --header-bg: #334155;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER Y NAVEGACIÓN SUPERIOR */
header.app-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.brand-logo-img {
    height: 38px;
    max-width: 130px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 2px 4px;
}

.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.brand-text span.version-badge {
    font-size: 0.72rem;
    background-color: var(--accent-light);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 9999px;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.company-badge-btn, .user-badge-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.company-badge-btn:hover, .user-badge-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.user-avatar-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* BARRA DE PESTAÑAS (TABS) */
nav.app-tabs {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    padding: 0 1.5rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: var(--accent-light);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* CONTENEDOR PRINCIPAL */
main.app-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.15s ease;
}

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

/* CARDS Y GRUPOS */
.card-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--card-shadow);
}

.card-group-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* FORMULARIOS Y CAMPOS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 0.75rem;
    border-radius: 5px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input-with-badge {
    position: relative;
    display: flex;
    align-items: center;
}

.input-badge {
    position: absolute;
    right: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* BOTONES */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

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

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

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

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

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

.btn-success:hover {
    filter: brightness(0.9);
}

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

.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* MONTO EN LETRAS BANNER */
.monto-letras-box {
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    padding: 0.5rem 0.8rem;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.35rem;
    letter-spacing: 0.02em;
}

/* TABLA DE PARTIDA CONTABLE */
.partida-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.8rem;
}

table.partida-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table.partida-table th {
    background-color: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    font-weight: 700;
    text-align: left;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

table.partida-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

table.partida-table tr:hover {
    background-color: var(--accent-light);
}

.badge-debe {
    background-color: #0284c7;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.badge-haber {
    background-color: #059669;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

/* PREVISUALIZADOR DEL CHEQUE EN PANTALLA */
.cheque-preview-container {
    background-color: #111827;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
    min-height: 280px;
}

.cheque-canvas-wrapper {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    background: white;
    border-radius: 4px;
    cursor: default;
    user-select: none;
}

.zoom-toolbar {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.zoom-toolbar button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.zoom-toolbar button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.zoom-toolbar span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
}

/* ESTADÍSTICAS Y CARDS DEL REGISTRO */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-card-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat-card-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* TABLA DE REGISTRO DE CHEQUES */
.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table.data-table th {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.65rem 0.8rem;
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

table.data-table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

table.data-table tr:hover {
    background-color: var(--accent-light);
}

.status-badge {
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
}

.status-badge.impreso {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.anulado {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* MODALES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    flex: 1;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    background: var(--bg-secondary);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    header.app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}
