/* Reset y variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --text-light: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.registro-box {
    max-width: 600px;
}

.login-header {
    background: var(--primary-color);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    padding: 30px;
}

.login-form h3 {
    margin: 20px 0 15px 0;
    color: var(--text-color);
    font-size: 16px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.login-form h3:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 12px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

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

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.login-footer {
    padding: 20px 30px;
    background: var(--light-bg);
    text-align: center;
    font-size: 14px;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

.demo-info {
    padding: 20px 30px;
    background: #fef3c7;
    border-top: 1px solid #fcd34d;
}

.demo-info h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #92400e;
}

.demo-info ul {
    list-style: none;
    font-size: 13px;
    color: #78350f;
}

.demo-info li {
    padding: 4px 0;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Dashboard layout */
.dashboard {
    min-height: 100vh;
    background: var(--light-bg);
}

/* Menú horizontal superior */
.top-navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    max-width: 1600px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.navbar-brand h1 {
    font-size: 22px;
    color: white;
    margin: 0;
}

.navbar-brand .role-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    margin: 0;
    padding: 0;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s;
    background: rgba(255,255,255,0.1);
}

.nav-menu li a:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-menu li a.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Colores específicos por menú */
.nav-menu li a.nav-dashboard { background: rgba(59, 130, 246, 0.3); }
.nav-menu li a.nav-profesionales { background: rgba(16, 185, 129, 0.3); }
.nav-menu li a.nav-especialidades { background: rgba(245, 158, 11, 0.3); }
.nav-menu li a.nav-agendas { background: rgba(139, 92, 246, 0.3); }
.nav-menu li a.nav-turnos { background: rgba(236, 72, 153, 0.3); }
.nav-menu li a.nav-usuarios { background: rgba(14, 165, 233, 0.3); }
.nav-menu li a.nav-backup { background: rgba(34, 197, 94, 0.3); }
.nav-menu li a.nav-misturnos { background: rgba(99, 102, 241, 0.3); }
.nav-menu li a.nav-salir { background: rgba(239, 68, 68, 0.3); }

.nav-menu li a.nav-dashboard.active { background: #3b82f6; color: white; }
.nav-menu li a.nav-profesionales.active { background: #10b981; color: white; }
.nav-menu li a.nav-especialidades.active { background: #f59e0b; color: white; }
.nav-menu li a.nav-agendas.active { background: #8b5cf6; color: white; }
.nav-menu li a.nav-turnos.active { background: #ec4899; color: white; }
.nav-menu li a.nav-usuarios.active { background: #0ea5e9; color: white; }
.nav-menu li a.nav-backup.active { background: #22c55e; color: white; }
.nav-menu li a.nav-misturnos.active { background: #6366f1; color: white; }

.navbar-user {
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-user strong {
    font-weight: 600;
}

.main-content {
    padding: 30px;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    background: white;
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 28px;
    color: var(--text-color);
    margin: 0;
}

.page-header .actions {
    display: flex;
    gap: 10px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.card-header h2 {
    font-size: 18px;
    color: var(--text-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 5px solid var(--primary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-card.card-blue {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.stat-card.card-green {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #d1fae5 100%);
}

.stat-card.card-orange {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
}

.stat-card.card-purple {
    border-left-color: #8b5cf6;
    background: linear-gradient(135deg, #ffffff 0%, #ede9fe 100%);
}

.stat-card.card-pink {
    border-left-color: #ec4899;
    background: linear-gradient(135deg, #ffffff 0%, #fce7f3 100%);
}

.stat-card.card-cyan {
    border-left-color: #06b6d4;
    background: linear-gradient(135deg, #ffffff 0%, #cffafe 100%);
}

.stat-card h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 38px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.stat-card .stat-icon {
    font-size: 40px;
    opacity: 0.2;
    float: right;
    margin-top: -50px;
}

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

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

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

table th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--text-color);
}

table tr:hover {
    background: var(--light-bg);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #e2e8f0;
    color: #475569;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.modal-footer .btn {
    margin-left: 10px;
}

.calendar {
    background: white;
    border-radius: 8px;
    padding: 20px;
}

.horarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.horario-slot {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.horario-slot:hover:not(.disabled) {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.horario-slot.disabled {
    background: #f1f5f9;
    color: var(--text-light);
    cursor: not-allowed;
}

.horario-slot.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-group form {
    margin: 0;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Mejoras para tabla de acciones */
table td .btn-group {
    justify-content: flex-start;
}

table td .btn-sm {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 10px;
}

/* Estilos para modales de selección de estado */
.modal-body input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.modal-body label:has(input[type="radio"]:checked) {
    border-color: var(--primary-color) !important;
    background: var(--primary-color)10 !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Calendario visual para pacientes */
.paso-reserva {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    background: white;
}

.calendario-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendario-dia-nombre {
    text-align: center;
    font-weight: bold;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-color);
}

.calendario-dia {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    padding: 8px;
}

.calendario-dia:hover:not(.disabled):not(.vacio):not(.completo) {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: scale(1.05);
}

.calendario-dia.vacio {
    border: none;
    cursor: default;
}

.calendario-dia.disabled {
    background: #f8f9fa;
    color: #adb5bd;
    cursor: not-allowed;
    border-color: #e9ecef;
}

.calendario-dia.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.calendario-dia.disponible {
    border-color: #10b981;
    background: #d1fae5;
    color: #065f46;
}

.calendario-dia.disponible::after {
    content: '✓';
    font-size: 12px;
    color: #10b981;
    margin-top: 2px;
    font-weight: bold;
}

.calendario-dia.completo {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
    cursor: not-allowed;
}

.calendario-dia.completo::after {
    content: '✗';
    font-size: 12px;
    color: #ef4444;
    margin-top: 2px;
    font-weight: bold;
}

.calendario-dia .dia-numero {
    font-size: 18px;
    font-weight: 600;
}

.calendario-dia .dia-info {
    font-size: 9px;
    color: var(--text-light);
    margin-top: 2px;
}

.horarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.horario-slot {
    padding: 15px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    font-weight: 600;
    background: white;
    position: relative;
}

.horario-slot::before {
    content: '🕐';
    display: block;
    font-size: 20px;
    margin-bottom: 5px;
}

.horario-slot.disponible {
    border-color: #10b981;
    background: #d1fae5;
    color: #065f46;
}

.horario-slot.disponible::before {
    content: '✓';
    font-size: 24px;
    color: #10b981;
}

.horario-slot.disponible:hover {
    border-color: #059669;
    background: #a7f3d0;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.horario-slot.ocupado {
    background: #fee2e2;
    color: #991b1b;
    cursor: not-allowed;
    border-color: #ef4444;
    opacity: 0.6;
}

.horario-slot.ocupado::before {
    content: '✗';
    color: #ef4444;
    font-size: 24px;
}

.horario-slot.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transform: translateY(-3px);
}

.horario-slot.selected::before {
    content: '✓';
    font-size: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        padding: 10px 20px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        margin-top: 10px;
    }
    
    .nav-menu li a {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .navbar-user {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    /* Calendario responsive */
    .calendario-grid {
        gap: 4px;
    }
    
    .calendario-dia {
        padding: 4px;
    }
    
    .calendario-dia .dia-numero {
        font-size: 14px;
    }
    
    .calendario-dia .dia-info {
        font-size: 8px;
    }
    
    .horarios-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .horario-slot {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .horario-slot::before {
        font-size: 16px;
        margin-bottom: 3px;
    }
    
    .modal-content {
        max-width: 95% !important;
        margin: 20px auto;
    }
    
    .paso-reserva {
        padding: 15px;
    }
    
    .paso-reserva h3 {
        font-size: 16px;
    }
}
