﻿/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Pantallas */
.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Login Screen */
.login-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 500px;
    margin: 50px auto;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.dental-icon {
    font-size: 5rem;
    color: #9C27B0;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.titulo-violeta {
    color: #9C27B0 !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.logo h1 {
    color: #333;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.logo h2 {
    color: #666;
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.logo h3 {
    color: #667eea;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.logo h4 {
    color: #999;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Login Form */
.login-form {
    margin-bottom: 30px;
}

.login-form h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-note {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

.form-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #9C27B0;
}

/* Admin Note */
.admin-note {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
    color: #856404;
}

.admin-note p {
    margin-bottom: 5px;
}

.admin-note p:last-child {
    margin-bottom: 0;
}

/* Botones */
.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #42b883 0%, #347357 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* Main Screen */
.header {
    background: white;
    border-radius: 15px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-menu {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9C27B0;
    cursor: pointer;
    display: none;
}

#fecha-actual {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.usuario-info {
    padding: 8px 20px;
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    color: white;
    border-radius: 20px;
    font-weight: 500;
}

/* Navegación de fecha */
.date-navigation {
    background: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-date {
    padding: 12px 25px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-date:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.date-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.date-input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

/* Contenido principal */
.main-content {
    display: grid;
    gap: 30px;
}

.turnos-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.section-title {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grid de turnos */
.turnos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.turno-card {
    padding: 20px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    position: relative;
}

.turno-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.turno-card.disponible {
    background: linear-gradient(135deg, #42b883 0%, #347357 100%);
}

.turno-card.ocupado {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.turno-card.mio {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.turno-hora {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.turno-estado {
    font-size: 1rem;
    font-weight: 500;
}

/* Icono de nota en tarjeta de turno */
.nota-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.turno-card.mio .nota-icon {
    color: rgba(33, 37, 41, 0.8);
}

/* Información de turno en modal */
.info-turno {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.info-turno p {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-turno p:last-child {
    margin-bottom: 0;
}

.info-turno i {
    min-width: 20px;
    color: #9C27B0;
}

.nota-actual {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.nota-actual p {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    font-style: italic;
}

/* Pacientes en lista */
.paciente-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.badge-turnos {
    background: #9C27B0;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Historial */
.historial-info {
    background: #e9ecef;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.historial-list-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.historial-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.historial-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.historial-fecha {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.historial-telefono {
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.historial-nota {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    font-style: italic;
}

.historial-registrado {
    color: #888;
    font-size: 0.8rem;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.no-historial {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

/* Modal para pacientes */
.paciente-options {
    padding: 20px;
}

.paciente-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.paciente-item {
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.paciente-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.paciente-nombre {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.paciente-telefono {
    color: #666;
    font-size: 0.9rem;
}

.paciente-usuario {
    color: #9C27B0;
    font-size: 0.8rem;
    font-weight: 500;
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #666;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.divider span {
    padding: 0 15px;
    background: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal,
.close-paciente-modal,
.close-registro-paciente-modal,
.close-registro-rapido-modal,
.close-nota-modal,
.close-historial-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

#modal-title {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Textarea para nota */
textarea.form-input {
    resize: vertical;
    min-height: 100px;
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
}

/* Menu móvil */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100%;
    background: white;
    box-shadow: 5px 0 25px rgba(0,0,0,0.1);
    z-index: 1001;
    transition: left 0.3s ease;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    padding: 20px;
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
}

.mobile-menu-content {
    padding: 20px;
}

.user-info-mobile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.user-info-mobile i {
    font-size: 1.5rem;
    color: #9C27B0;
}

.menu-item {
    width: 100%;
    padding: 15px;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #eee;
    color: #333;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.3s ease;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item.logout {
    color: #dc3545;
    border-bottom: none;
}

/* Loading y errores */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #9C27B0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.close-error {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Información box */
.info-box {
    background: #f3e5f5;
    border: 2px solid #ce93d8;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    color: #7b1fa2;
    font-weight: 500;
}

.info-box p {
    margin-bottom: 10px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* No turnos */
.no-turnos {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-turnos i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #999;
}

/* Registro Form */
.registro-form {
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .login-container {
        max-width: 95%;
        padding: 30px;
    }
    
    .turnos-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo h2 {
        font-size: 1.2rem;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .btn-menu {
        display: block;
    }
    
    .date-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .date-controls {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-date {
        width: 100%;
        justify-content: center;
    }
    
    .turnos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .turno-card {
        padding: 15px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .turnos-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}