/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Navegación */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    color: #667eea;
    font-size: 1.8rem;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Secciones */
.section {
    display: none;
    min-height: calc(100vh - 80px);
}

.section.active {
    display: block;
}

.section h2 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Horario de clases */
.schedule-container {
    display: grid;
    grid-template-columns: 150px repeat(5, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.time-column,
.day-column {
    display: flex;
    flex-direction: column;
}

.time-slot,
.day-header,
.subject {
    padding: 1rem;
    text-align: center;
    font-weight: 500;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.day-header {
    background: #667eea;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.time-slot {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.time-slot.break {
    background: #ffeaa7;
    color: #2d3436;
}

.time-slot.monday-only {
    background: #fab1a0;
    color: #2d3436;
}

/* Materias con colores */
.subject.historia { background: #74b9ff; color: white; }
.subject.educacion-fisica { background: #00b894; color: white; }
.subject.logica { background: #a29bfe; color: white; }
.subject.matematicas { background: #fd79a8; color: white; }
.subject.valores { background: #fdcb6e; color: #2d3436; }
.subject.orientacion { background: #e17055; color: white; }
.subject.lengua { background: #6c5ce7; color: white; }
.subject.fisica { background: #00cec9; color: white; }
.subject.ingles { background: #55a3ff; color: white; }
.subject.geografia { background: #81ecec; color: #2d3436; }
.subject.genero { background: #ff7675; color: white; }
.subject.artes { background: #fd79a8; color: white; }
.subject.dibujo { background: #fdcb6e; color: #2d3436; }
.subject.informatica { background: #636e72; color: white; }
.subject.break { background: #ffeaa7; color: #2d3436; }
.subject.empty { background: #ddd; }

.subject.double {
    grid-row: span 2;
    min-height: 120px;
}

/* Formularios */
.reminder-form,
.note-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.form-input,
.form-textarea,
.form-select {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    width: 100%;
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-filter {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    margin: 0.25rem;
}

.btn-filter.active {
    background: #667eea;
    color: white;
}

.btn-filter.priority-alta { border-left: 4px solid #e74c3c; }
.btn-filter.priority-media { border-left: 4px solid #f39c12; }
.btn-filter.priority-baja { border-left: 4px solid #27ae60; }

/* Listas de recordatorios y notas */
.reminders-list,
.notes-list {
    display: grid;
    gap: 1rem;
}

.reminder-item,
.note-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.note-content {
    flex: 1;
}

.note-text {
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.note-date {
    color: #666;
    font-size: 0.85rem;
}

.reminder-item:hover,
.note-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.reminder-item {
    border-left: 4px solid #667eea;
}

.note-item.priority-alta { border-left: 4px solid #e74c3c; }
.note-item.priority-media { border-left: 4px solid #f39c12; }
.note-item.priority-baja { border-left: 4px solid #27ae60; }

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.item-title {
    font-weight: 700;
    color: #2d3436;
}

.item-date {
    color: #636e72;
    font-size: 0.9rem;
}

.item-content {
    color: #2d3436;
    margin-bottom: 1rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    padding: 0.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Chat del asistente IA */
.chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    gap: 1rem;
    flex-wrap: wrap;
}

.context-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-options label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.context-options select {
    padding: 0.5rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.context-options select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.chat-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    height: 600px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.message.user-message {
    flex-direction: row-reverse;
}

.message i {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.bot-message i {
    background: #667eea;
}

.user-message i {
    background: #00b894;
}

.message-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 15px;
    max-width: 70%;
    word-wrap: break-word;
}

.user-message .message-content {
    background: #667eea;
    color: white;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 0.5rem;
}

.chat-input .form-input {
    flex: 1;
    margin: 0;
}

/* Filtros de notas */
.notes-filter {
    margin-bottom: 2rem;
    text-align: center;
}

/* Estilos para notas completadas */
.note-item.completed {
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.05);
}

.completed-text {
    text-decoration: line-through;
    color: #888;
}

/* Estilos para checkbox personalizado */
.note-checkbox {
    margin-right: 12px;
    display: flex;
    align-items: center;
}

.note-checkbox input[type="checkbox"] {
    display: none;
}

.note-checkbox label {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.note-checkbox input[type="checkbox"]:checked + label {
    background: #667eea;
    border-color: #667eea;
}

.note-checkbox input[type="checkbox"]:checked + label::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Contadores en filtros */
.counter {
    background: #e74c3c;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.8rem;
    margin-left: 5px;
    min-width: 18px;
    text-align: center;
    display: inline-block;
}

.counter:empty {
    display: none;
}

/* Responsive Design Mejorado */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .schedule-container {
        grid-template-columns: 100px repeat(5, 1fr);
        font-size: 0.8rem;
        overflow-x: auto;
    }
    
    .time-slot,
    .day-header,
    .subject {
        padding: 8px 4px;
        min-width: 60px;
    }
    
    .subject {
        padding: 4px;
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .container {
        padding: 5px;
    }
    
    .form-group {
        flex-direction: column;
        margin-bottom: 15px;
    }
    
    .form-input,
    .form-textarea,
    .form-select {
        min-width: 100%;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .btn {
        padding: 12px 15px;
        font-size: 0.9rem;
        touch-action: manipulation;
    }
    
    .btn-filter {
        flex: 1;
        min-width: calc(50% - 3px);
        font-size: 0.8rem;
    }
    
    .section h2 {
        font-size: 2rem;
    }
    
    .chat-container {
        height: 300px;
    }
    
    .chat-input {
        padding: 10px;
    }
    
    .chat-input .form-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .nav-link {
        font-size: 0.75rem;
        padding: 6px 8px;
    }
    
    .schedule-container {
        grid-template-columns: 80px repeat(2, 1fr);
        font-size: 0.6rem;
    }
    
    .day-column:nth-child(n+5) {
        display: none;
    }
    
    .time-slot,
    .subject {
        padding: 0.5rem;
        font-size: 0.6rem;
    }
    
    .subject {
        padding: 2px;
    }
    
    .btn-filter {
        min-width: 100%;
        margin-bottom: 5px;
    }
    
    .note-item {
        padding: 10px;
        gap: 8px;
    }
    
    .note-checkbox label {
        width: 18px;
        height: 18px;
    }
    
    .note-text {
        font-size: 0.9rem;
    }
    
    .note-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .btn-delete {
        padding: 6px;
        min-width: 32px;
        height: 32px;
    }
    
    .chat-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .context-options {
        justify-content: center;
    }
    
    .context-options select {
        flex: 1;
        min-width: 200px;
    }
    
    .chat-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn-secondary {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .chat-messages {
        padding: 8px;
    }
    
    .message {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .form-textarea {
        min-height: 80px;
    }
    
    .section {
        padding: 15px;
    }
    
    .section h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reminder-item,
.note-item,
.message {
    animation: fadeIn 0.5s ease;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}