:root {
    /* Paleta de colores súper calmada y de bajo estrés */
    --bg-color: #f3f4f6;
    --panel-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    
    /* Colores identificativos (Suaves y fáciles de procesar) */
    --accent-primary: #5f5dec;  /* Indigo */
    --accent-success: #10b981;  /* Esmeralda */
    --accent-focus: #f59e0b;    /* Ambar para Alta concentración */
    --accent-low: #8b5cf6;      /* Violeta para Baja concentración */
    
    /* Categorías de Agenda */
    --cat-work-bg: #eff6ff;
    --cat-work-border: #bfdbfe;
    --cat-work-text: #1d4ed8;
    
    --cat-health-bg: #ecfdf5;
    --cat-health-border: #a7f3d0;
    --cat-health-text: #047857;
    
    --cat-leisure-bg: #fdf2f8;
    --cat-leisure-border: #fbcfe8;
    --cat-leisure-text: #be185d;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.04), 0 4px 6px -2px rgba(0,0,0,0.02);
    --shadow-glow: 0 0 15px rgba(245, 158, 11, 0.2);
    
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Playfair Display', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    user-select: none; /* Previene selecciones accidentales que pueden ser molestas */
}

/* App Wrapper */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    background: var(--panel-bg);
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.logo {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: -0.05em;
}

.current-date {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.header-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-time {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.2rem;
}

/* Progress bar (Gamificación / Satisfacción visual) */
.progress-container {
    flex-grow: 1;
    max-width: 450px;
    margin: 0 3rem;
    background: #f1f5f9;
    height: 16px;
    border-radius: 50px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
    border-radius: 50px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.6s ease; /* Efecto elástico y transición suave de color */
}

#progress-text {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    white-space: nowrap;
}

/* Dashboard Grid Layout */
.dashboard {
    display: grid;
    grid-template-columns: 340px 1fr 340px;
    gap: 1.75rem;
    flex-grow: 1;
}

.panel {
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.75rem;
}

.panel-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Buttons and Interaction */
.primary-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(95, 93, 236, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(95, 93, 236, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.icon-btn {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: rotate(90deg);
}

/* Tasks Panel */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: calc(var(--radius-md) - 4px);
    font-size: 0.85rem;
    font-family: var(--font-main);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s ease;
}

.tab-btn.active {
    background: var(--panel-bg);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    flex-grow: 1;
}

/* Task Cards with interactive priorities */
.task-item {
    display: flex;
    align-items: center;
    padding: 1.1rem;
    border-radius: var(--radius-md);
    background: var(--panel-bg);
    border: 2px solid #f3f4f6;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.task-item:hover {
    transform: translateX(4px);
}

.task-checkbox-wrapper {
    margin-right: 1.1rem;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 900;
    color: white;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Priority Design Cues */
.task-item.priority-focus {
    border-left: 6px solid var(--accent-focus);
    box-shadow: var(--shadow-glow);
}
.task-item.priority-focus .task-checkbox {
    border-color: var(--accent-focus);
}

.task-item.priority-normal {
    border-left: 6px solid var(--accent-primary);
}

.task-item.priority-later {
    border-left: 6px solid var(--accent-low);
}
.task-item.priority-later .task-checkbox {
    border-color: var(--accent-low);
}

/* Completed state */
.task-item.completed {
    border-left-color: var(--accent-success);
    background-color: #fcfdfd;
}

.task-item.completed .task-checkbox {
    background: var(--accent-success);
    border-color: var(--accent-success);
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.task-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-right: 1rem;
}

.task-title {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    line-height: 1.35;
    word-break: break-word;
}

.task-item.completed .task-desc {
    text-decoration: line-through;
    opacity: 0.8;
}

.task-badge {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.2rem;
    width: fit-content;
    padding: 0.1rem 0.5rem;
    border-radius: 50px;
}

.badge-focus {
    background: #fef3c7;
    color: #d97706;
}

.badge-normal {
    background: #e0e7ff;
    color: #4f46e5;
}

.badge-later {
    background: #f3e8ff;
    color: #7c3aed;
}

.agenda-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s;
}

.agenda-item:hover .agenda-actions {
    opacity: 1;
}

.edit-event-btn, .delete-event-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.25rem;
}

.edit-event-btn:hover {
    color: var(--accent-primary);
}

.delete-event-btn:hover {
    color: #ef4444;
}

/* Agenda Panel */
.agenda-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 0.25rem;
}

.agenda-item {
    display: flex;
    align-items: center;
    padding: 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    position: relative;
    transition: all 0.25s ease;
}

.agenda-time {
    display: flex;
    flex-direction: column;
    min-width: 65px;
    font-weight: 600;
    font-size: 0.85rem;
}

.time-start {
    color: var(--text-primary);
}

.time-end {
    color: var(--text-tertiary);
}

.agenda-content {
    flex-grow: 1;
    padding-left: 1rem;
    border-left: 2px dashed rgba(0,0,0,0.1);
}

.event-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.event-icon {
    margin-right: 0.35rem;
}

.event-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0;
    line-height: 1.35;
    word-break: break-word;
}

/* Agenda Category Colors */
.agenda-item.cat-work {
    background: var(--cat-work-bg);
    border-color: var(--cat-work-border);
    color: var(--cat-work-text);
}

.agenda-item.cat-health {
    background: var(--cat-health-bg);
    border-color: var(--cat-health-border);
    color: var(--cat-health-text);
}

.agenda-item.cat-leisure {
    background: var(--cat-leisure-bg);
    border-color: var(--cat-leisure-border);
    color: var(--cat-leisure-text);
}

/* Current Event Highlight (AHORA MISMO) */
.agenda-item.active-now {
    transform: scale(1.03);
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.15);
    border: 2.5px solid var(--accent-success) !important;
}

/* Visual feedback for completed agenda items */
.agenda-item.completed {
    opacity: 0.6;
}

.agenda-item.completed .event-title {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.now-badge {
    display: inline-block;
    background: var(--accent-success);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    margin-top: 0.4rem;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.95; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.95; }
}

/* Quick Notes Box */
.notes-panel {
    max-height: 80vh;
}

.quick-capture {
    position: relative;
    margin-bottom: 1.25rem;
}

#quick-note-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-family: var(--font-main);
    font-size: 0.95rem;
    border: 2px dashed var(--accent-primary);
    border-radius: var(--radius-md);
    outline: none;
    background: #fdfdfd;
    transition: all 0.25s ease;
    color: var(--text-primary);
}

#quick-note-input:focus {
    border-style: solid;
    box-shadow: 0 4px 12px rgba(95, 93, 236, 0.1);
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 0.25rem;
}

.note-card {
    background: #fffdf5; /* Color sutilmente cálido (estilo post-it) */
    border: 1px solid #fef3c7;
    border-radius: var(--radius-md);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.2s;
}

.note-card:hover {
    transform: translateY(-2px);
}

.note-text {
    font-size: 0.925rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Empty State Helpers */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-weight: 600;
    font-size: 0.95rem;
}

.empty-state .subtext {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    display: block;
    margin-top: 0.5rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Modals System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px); /* Difumina el fondo para eliminar distracciones visuales */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Form Styles inside Modals */
.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-content input[type="text"],
.modal-content select {
    width: 100%;
    padding: 0.9rem 1.1rem;
    font-family: var(--font-main);
    font-size: 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
}

.modal-content input:focus,
.modal-content select:focus {
    border-color: var(--accent-primary);
}

.time-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.time-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.time-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.time-field input[type="time"] {
    padding: 0.75rem;
    font-family: var(--font-main);
    font-size: 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.cancel-btn {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cancel-btn:hover {
    background: #e2e8f0;
}

.save-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.save-btn:hover {
    background: #4f46e5;
}

/* Dopamine Particles (Satisfying bursting stars and dots) */
#confetti-canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.dopamine-particle {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Custom Scrollbars to keep it tidy */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile responsive layout overrides */
@media (max-width: 1100px) {
    .app-container {
        padding: 1rem;
    }
    .dashboard {
        grid-template-columns: 1fr;
    }
    .panel {
        max-height: none;
        min-height: auto;
    }
    .app-header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    .progress-container {
        margin: 0;
        width: 100%;
    }
    .current-date {
        align-items: center;
    }
    .navbar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }
}

/* Navbar Styles */
.navbar {
    background: #ffffff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
}

.navbar-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.navbar a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: color 0.3s;
}

.navbar a:hover {
    color: var(--accent-primary);
}

.role-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
}

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

.badge-admin {
    background: #fee2e2;
    color: #b91c1c;
}

.logout-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.3s;
}

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