/* ==================== VARIABLES ==================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius: 8px;
    --transition: all 0.3s ease;
}

/* ==================== RESET ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* ==================== NAVBAR ==================== */
.navbar {
    background-color: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 1.25rem;
    font-weight: 700;
}

.logo {
    width: 40px;
    height: 40px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-dark);
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

.nav-menu a:hover {
    background-color: var(--bg-light);
    color: var(--primary);
}

.user-name {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-logout {
    color: var(--danger) !important;
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ==================== HERO ==================== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==================== CARDS ==================== */
.card {
    background-color: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

/* ==================== GRID ==================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ==================== STAT CARDS ==================== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    margin: 0;
    color: var(--primary);
}

.stat-content p {
    margin: 0;
    color: var(--text-muted);
}

.stat-card.success .stat-content h3 {
    color: var(--success);
}

.stat-card.warning .stat-content h3 {
    color: var(--warning);
}

.stat-card.danger .stat-content h3 {
    color: var(--danger);
}

/* ==================== FORMS ==================== */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

fieldset {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

legend {
    font-weight: 700;
    font-size: 1.125rem;
    padding: 0 0.5rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control.error {
    border-color: var(--danger);
}

textarea.form-control {
    resize: vertical;
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ==================== TABLES ==================== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
}

.table thead {
    background-color: var(--bg-light);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
}

.table td {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.table tbody tr:hover {
    background-color: var(--bg-light);
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pendiente {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-confirmado {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-realizado {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-cancelado {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-aprobado {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-rechazado {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-abonado_efectivo {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-ingreso {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-egreso {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ==================== ALERTS ==================== */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--info);
}

.close-alert {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}

.close-alert:hover {
    opacity: 1;
}

/* ==================== SECTIONS ==================== */
.section {
    margin-bottom: 3rem;
}

.section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ==================== ESPECIALIDADES ==================== */
.especialidades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.especialidad-card {
    cursor: pointer;
    transition: var(--transition);
}

.especialidad-card input[type="radio"] {
    display: none;
}

.especialidad-card .card-content {
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

.especialidad-card input[type="radio"]:checked + .card-content {
    border-color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.especialidad-card:hover .card-content {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.precio {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* ==================== HORARIOS ==================== */
.horarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.horario-btn {
    padding: 0.75rem;
    border: 2px solid var(--border);
    background-color: var(--bg-white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.horario-btn:hover {
    border-color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.horario-btn.selected {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==================== FORM STEPS ==================== */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

/* ==================== FAMILIARES ==================== */
.familiar-item {
    background-color: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* ==================== PAGOS ==================== */
.pagos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.pago-card {
    border: 2px solid var(--border);
}

.pago-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.pago-info p {
    margin-bottom: 0.5rem;
}

.pago-comprobante {
    margin: 1rem 0;
}

.pago-actions {
    display: flex;
    gap: 0.5rem;
}

.form-rechazo {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ==================== FOOTER ==================== */
.footer {
    background-color: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

/* ==================== UTILITIES ==================== */
.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--info);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .container {
        padding: 1rem;
    }
}
