/* ============================================
   FONAFAM - SISTEMA COMPLETO
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: #f5f5f5;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   HEADER Y TOPBAR
   ============================================ */
.topbar {
    background: #2c3e50;
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.topbar .brand {
    font-weight: bold;
    font-size: 18px;
    flex: 1;
}

.topbar .user {
    font-size: 13px;
}

.topbar .user a {
    color: #fff;
    text-decoration: underline;
}

/* Botón hamburguesa - OCULTO en escritorio */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: space-between;
    width: 40px;
    height: 40px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
}

/* ============================================
   MENÚ DE NAVEGACIÓN
   ============================================ */
.menu {
    background: #34495e;
    padding: 8px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.menu a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
}

.menu a:hover {
    background: #2c3e50;
}

.menu .menu-highlight {
    background: #27ae60;
    color: #fff;
    font-weight: bold;
}

.menu .menu-config {
    background: #e67e22;
    color: #fff;
}

.menu .menu-admin {
    background: #8e44ad;
    color: #fff;
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    color: #2c3e50;
    margin-bottom: 15px;
}

/* ============================================
   TABLAS
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-top: 10px;
}

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.table th {
    background: #ecf0f1;
    font-weight: bold;
}

.table tfoot td {
    background: #f8f9fa;
    font-weight: bold;
}

.table tr.canceled {
    opacity: 0.5;
    text-decoration: line-through;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #95a5a6;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    margin-top: 10px;
}

.form label {
    display: block;
    font-size: 13px;
    margin-top: 10px;
    margin-bottom: 5px;
    color: #555;
    font-weight: 600;
}

.form input,
.form select,
.form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.form fieldset {
    border: 1px solid #ddd;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}

.form legend {
    font-weight: bold;
    color: #2c3e50;
}

.row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.row > div {
    flex: 1;
    min-width: 180px;
}

/* ============================================
   BÚSQUEDA
   ============================================ */
.search {
    background: #fff;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.search input,
.search select {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   CARDS
   ============================================ */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card h3 {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
}

.card .num {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    margin-top: 10px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    padding: 15px;
    color: #888;
    font-size: 12px;
}

/* ============================================
   LOGIN
   ============================================ */
.login-body {
    background: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: #fff;
    padding: 30px;
    border-radius: 5px;
    width: 340px;
}

.login-box h2 {
    text-align: center;
    color: #2c3e50;
}

.login-box input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.login-box button {
    width: 100%;
    padding: 10px;
    background: #2980b9;
    color: #fff;
    border: none;
    border-radius: 3px;
    margin-top: 15px;
    cursor: pointer;
}

/* ============================================
   COMPONENTES ESPECIALES
   ============================================ */
.wizard-container,
.quick-pay-card,
.service-card {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    max-width: 900px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 18px;
    align-items: end;
}

.form-row.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-field {
    display: flex;
    flex-direction: column;
    min-height: 70px;
}

.form-field label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-field input,
.form-field select {
    width: 100%;
    height: 38px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.auto-field {
    background: #f5f5f5 !important;
    color: #495057 !important;
    font-weight: 600;
}

.folio-input {
    font-size: 20px !important;
    font-weight: bold !important;
    text-align: center !important;
    letter-spacing: 2px !important;
    background: #fff3cd !important;
    border: 2px solid #ffc107 !important;
}

.section-title {
    font-size: 15px;
    color: #2c3e50;
    margin: 25px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #ecf0f1;
    font-weight: 600;
}

.split-box {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    padding: 18px;
    border-radius: 6px;
    margin: 18px 0;
}

.split-box h4 {
    margin: 0 0 12px 0;
    color: #2e7d32;
}

.balance-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 18px 0;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 6px;
}

.balance-item {
    text-align: center;
}

.balance-item .label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 600;
}

.balance-item .value {
    font-size: 26px;
    font-weight: bold;
    color: #2c3e50;
}

.balance-item .value.new {
    color: #27ae60;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ============================================
   RESPONSIVE - MÓVIL
   ============================================ */
@media (max-width: 768px) {
    /* Mostrar botón hamburguesa */
    .menu-toggle {
        display: flex;
    }
    
    /* Ajustar topbar */
    .topbar {
        padding: 10px 15px;
    }
    
    .topbar .brand {
        font-size: 16px;
    }
    
    .topbar .user {
        font-size: 12px;
    }
    
    /* Menú oculto por defecto */
    .menu {
        display: none;
        flex-direction: column;
        padding: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    }
    
    /* Menú visible cuando tiene clase menu-open */
    .menu.menu-open {
        display: flex;
    }
    
    .menu a {
        padding: 15px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        border-radius: 0;
        white-space: normal;
    }
    
    .menu a:last-child {
        border-bottom: none;
    }
    
    /* Ajustes de layout */
    .container {
        padding: 15px;
    }
    
    .row {
        flex-direction: column;
    }
    
    .form-row,
    .form-row.cols-2 {
        grid-template-columns: 1fr;
    }
    
    .balance-display {
        grid-template-columns: 1fr;
    }
    
    .cards {
        grid-template-columns: 1fr;
    }
    
    .wizard-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .wizard-actions .btn {
        width: 100%;
    }
    
    /* Tablas con scroll */
    .table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
    }
    
    .search {
        flex-direction: column;
    }
    
    .search input,
    .search select,
    .search button {
        width: 100%;
    }
}

/* Móvil pequeño */
@media (max-width: 480px) {
    .topbar .brand {
        font-size: 14px;
    }
    
    .form-field input,
    .form-field select {
        font-size: 16px;
    }
}

/* Impresión */
@media print {
    .topbar,
    .menu,
    .footer {
        display: none !important;
    }
}