/* --- GLOBAL --- */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f4f7fa;
    color: #333;
    margin: 0;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

/* --- MAIN --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    padding: 30px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    color: #6a5af9;
    text-align: center;
    margin-bottom: 40px;
}

.menu h3 {
    font-size: 14px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu li a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background-color 0.3s, color 0.3s;
}

.menu li a:hover,
.menu li.active a {
    background-color: #edeefd;
    color: #6a5af9;
}

.user-profile {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.user-profile span {
    display: block;
    font-weight: 600;
}

.user-profile small {
    color: #888;
}

/* --- MAIN RIGHT --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
}

/* --- HEADERS --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.app-header h2 {
    margin: 0;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-bar {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
}

.icon-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.icon-btn:hover {
    background-color: #f0f0f0;
}

/* --- DASHBOARD--- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* --- CARD --- */
.card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.card-span-2 {
    grid-column: span 2;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
    flex-shrink: 0;
}

.card-header h3 {
    margin: 0;
    font-weight: 500;
}

.card-content {
    font-size: 14px;
    color: #666;
    flex-grow: 1;
    overflow-y: auto;
}

.card-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#tasks-container ul {
    list-style: disc;
    padding-left: 40px;
    margin-top: 5px;
}

/* --- TAGS --- */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-red {
    background-color: #fee2e2;
    color: #ef4444;
}

.tag-blue {
    background-color: #dbeafe;
    color: #3b82f6;
}

.tag-green {
    background-color: #d1fae5;
    color: #10b981;
}

.tag-yellow {
    background-color: #fef9c3;
    color: #eab308;
}

.tag-purple {
    background-color: #e9d5ff;
    color: #9333ea;
}

.tag-orange {
    background-color: #ffedd5;
    color: #f97316;
}

/* --- CALENDAR --- */
.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-nav button {
    background: none;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.calendar-nav button:hover {
    color: #333;
}

.calendar-header-widget {
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
}

.calendar-widget table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.calendar-widget th {
    font-size: 12px;
    font-weight: 600;
    color: #aaa;
    padding-bottom: 10px;
    text-transform: uppercase;
}

.calendar-widget td {
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    line-height: 34px;
    height: 34px;
    width: 34px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.calendar-widget td.other-month {
    color: #ccc;
}

.calendar-widget td:hover {
    background-color: #edeefd;
}

.calendar-widget td.today {
    background-color: #6a5af9;
    color: #ffffff;
    font-weight: 600;
}

/* --- LIST --- */
.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-list li {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.todo-list li:last-child {
    border-bottom: none;
}

.todo-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #6a5af9;
}

.todo-list label {
    flex-grow: 1;
    transition: color 0.3s;
}

.todo-list li.completed label {
    text-decoration: line-through;
    color: #aaa;
}

.delete-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.3s;
    flex-shrink: 0;
}

.delete-btn:hover {
    color: #e74c3c;
}

.priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 5px;
}

.priority-high {
    background-color: #ef4444;
}

.priority-medium {
    background-color: #eab308;
}

.priority-low {
    background-color: #22c55e;
}

.add-task-link-btn {
    background-color: #6a5af9;
    color: white;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.add-task-link-btn:hover {
    background-color: #5a3fdb;
}

/* --- NOTES --- */
.dashboard-notes-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-preview-item {
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 10px;
    border: 1px solid #eee;
}

.note-preview-item h5 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview-item p {
    margin: 0;
    font-size: 13px;
    color: #777;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* --- CARDS --- */
.card-header-actions {
    position: relative;
    display: flex;
    align-items: center;
}

.card-menu {
    display: none;
    position: absolute;
    top: 40px;
    right: 0;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    z-index: 10;
    width: 150px;
}

.card-menu.active {
    display: block;
}

.card-menu a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: background-color 0.2s;
}

.card-menu a:hover {
    background-color: #f4f7fa;
}

/* --- SCHEDULE --- */
.schedule-container {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: auto;
    margin-top: 20px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 0.7fr repeat(7, 1fr);
    grid-template-rows: auto repeat(12, 85px);
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    position: relative;
}

.grid-header,
.grid-time {
    background-color: #f9f9f9;
    padding: 10px;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.grid-header.time-col {
    text-align: right;
    border-right: 1px solid #eee;
}

.grid-time {
    grid-column: 1;
    text-align: right;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    border-right: 1px solid #eee;
    border-top: 1px solid #f0f0f0;
    padding-right: 10px;
}

/* --- SCHEDULE EVENTS --- */
.event {
    border-radius: 8px;
    padding: 6px 8px;
    margin: 2px;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    position: relative;
    line-height: 1.4;
    min-height: 30px;
    overflow-y: visible;
    overflow-wrap: break-word;
    word-break: break-word;
}

.event strong {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 5px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.event small {
    display: block;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* EVENTS */
.event-personal {
    background-color: #ffedd5;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

.event-work {
    background-color: #fef9c3;
    border: 1px solid #fde68a;
    color: #854d0e;
}

/* EVENT DELETE */
.event-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 50%;
    color: #991b1b;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.event:hover .event-delete-btn {
    opacity: 1;
}

/* --- ANALYTICS --- */
.page-content {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ---EVENT --- */
.add-event-form-container,
.manage-classes-container {
    margin-bottom: 20px;
    padding: 25px;
}

.add-event-form-container h3,
.manage-classes-container h3 {
    margin: 0 0 20px 0;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

#add-event-form,
#add-class-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px 20px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
}

#add-event-form button[type="submit"],
#add-class-form button[type="submit"] {
    background-color: #6a5af9;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    height: fit-content;
    margin-top: auto;
    grid-column: -2 / -1;
    justify-self: end;
}

#add-event-form button[type="submit"]:hover,
#add-class-form button[type="submit"]:hover {
    background-color: #5a3fdb;
}

/* MANAGE CLASSES */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 5px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    cursor: pointer;
}

input[type="color"] {
    padding: 2px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
}

.defined-classes-list {
    margin-top: 25px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.defined-classes-list h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #777;
}

.defined-classes-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.defined-classes-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 5px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.defined-classes-list li:last-child {
    border-bottom: none;
}

.defined-classes-list .class-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    margin-right: 10px;
    display: inline-block;
    vertical-align: middle;
}

.defined-classes-list .class-details {
    flex-grow: 1;
}

.defined-classes-list button {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 16px;
}

/* --- TASKS --- */
.tasks-page-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-task-container {
    padding: 25px;
}

.add-task-container h3 {
    margin: 0 0 20px 0;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

#add-task-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
    margin-left: 0;
}

#add-task-form .form-group {
    width: 100%;
}

#add-task-form button[type="submit"] {
    background-color: #6a5af9;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    height: fit-content;
    margin-top: auto;
    grid-column: -2 / -1;
    justify-self: end
}

.full-task-list-container {
    padding: 20px;
}

.full-task-list-container h3 {
    margin: 0 0 15px 0;
    font-weight: 500;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* --- NOTES --- */
.notes-page-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-note-container {
    padding: 25px;
}

.add-note-container h3 {
    margin: 0 0 20px 0;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

#add-note-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#add-note-form textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    resize: vertical;
    min-height: 80px;
}

#add-note-form button[type="submit"] {
    background-color: #6a5af9;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    align-self: flex-end;
}

#add-note-form button[type="submit"]:hover {
    background-color: #5a3fdb;
}

.notes-display-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.note-card {
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
}

.note-card h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    padding-right: 25px;
}

.note-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    flex-grow: 1;
}

.note-card .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* NOTE COLORS */
.note-color-1 {
    background-color: #fef3c7;
    border-left: 5px solid #fcd34d;
}

.note-color-2 {
    background-color: #d1fae5;
    border-left: 5px solid #6ee7b7;
}

.note-color-3 {
    background-color: #dbeafe;
    border-left: 5px solid #93c5fd;
}

.note-color-4 {
    background-color: #e9d5ff;
    border-left: 5px solid #c084fc;
}

.note-color-5 {
    background-color: #fee2e2;
    border-left: 5px solid #fca5a5;
}


/* --- ANALYTICS --- */
.analytics-page-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    padding: 25px;
    text-align: center;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 500;
    color: #777;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #6a5af9;
}

.chart-container {
    padding: 30px;
}

.chart-container h3 {
    margin: 0 0 20px 0;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.chart-placeholder {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
    color: #aaa;
    text-align: center;
}

/* --- CHART --- */
.chart-container {
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    position: relative;
    height: 350px;
    width: 100%;
    flex-grow: 1;
}

#taskCompletionChart {
    display: block;
    box-sizing: border-box;
    height: 100%;
    width: 100%;
}

/* --- DARK THEME --- */
body.dark-theme {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-theme .sidebar {
    background-color: #161625;
    border-right-color: #30304a;
}

body.dark-theme .logo {
    color: #9a8cff;
}

body.dark-theme .menu h3 {
    color: #777;
}

body.dark-theme .menu li a {
    color: #ccc;
}

body.dark-theme .menu li a:hover,
body.dark-theme .menu li.active a {
    background-color: #2a2a3e;
    color: #9a8cff;
}

body.dark-theme .user-profile {
    border-top-color: #30304a;
}

body.dark-theme .user-profile small {
    color: #888;
}

body.dark-theme .app-header h2 {
    color: #f0f0f0;
}

body.dark-theme .search-bar {
    background-color: #2a2a3e;
    border-color: #40405a;
    color: #e0e0e0;
}

body.dark-theme .search-bar::placeholder {
    color: #888;
}

body.dark-theme .icon-btn {
    border-color: #40405a;
    color: #ccc;
}

body.dark-theme .icon-btn:hover {
    background-color: #30304a;
}

body.dark-theme .card {
    background-color: #161625;
    border-color: #30304a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.dark-theme .card-header {
    border-bottom-color: #30304a;
}

body.dark-theme .card-header h3 {
    color: #f0f0f0;
}

body.dark-theme .card-content {
    color: #ccc;
}

body.dark-theme .calendar-header-widget span,
body.dark-theme .calendar-widget td {
    color: #e0e0e0;
}

body.dark-theme .calendar-widget th {
    color: #888;
}

body.dark-theme .calendar-nav button {
    color: #888;
}

body.dark-theme .calendar-nav button:hover {
    color: #ccc;
}

body.dark-theme .calendar-widget td.other-month {
    color: #555;
}

body.dark-theme .calendar-widget td:hover {
    background-color: #2a2a3e;
}

body.dark-theme .calendar-widget td.today {
    background-color: #7d5fff;
    color: #fff;
}

body.dark-theme .todo-list li {
    border-bottom-color: #30304a;
}

body.dark-theme .todo-list label {
    color: #ccc;
}

body.dark-theme .todo-list li.completed label {
    color: #666;
}

body.dark-theme .delete-btn {
    color: #666;
}

body.dark-theme .delete-btn:hover {
    color: #fca5a5;
}

body.dark-theme .add-task-link-btn {
    background-color: #7d5fff;
}

body.dark-theme .add-task-link-btn:hover {
    background-color: #6a5af9;
}

body.dark-theme .note-preview-item {
    background-color: #2a2a3e;
    border-color: #40405a;
}

body.dark-theme .note-preview-item h5 {
    color: #f0f0f0;
}

body.dark-theme .note-preview-item p {
    color: #aaa;
}

body.dark-theme .card-menu {
    background-color: #1f1f30;
    border-color: #40405a;
}

body.dark-theme .card-menu a {
    color: #ccc;
}

body.dark-theme .card-menu a:hover {
    background-color: #30304a;
}

body.dark-theme .schedule-container {
    background-color: #161625;
    border-color: #30304a;
}

body.dark-theme .grid-header,
body.dark-theme .grid-time {
    background-color: #2a2a3e;
    border-color: #40405a;
    color: #ccc;
}

body.dark-theme .grid-time {
    color: #888;
}

body.dark-theme .page-content,
body.dark-theme .add-task-container,
body.dark-theme .full-task-list-container,
body.dark-theme .add-note-container,
body.dark-theme .manage-classes-container,
body.dark-theme .add-event-form-container {
    background-color: #161625;
    border-color: #30304a;
}

body.dark-theme .add-task-container h3,
body.dark-theme .full-task-list-container h3,
body.dark-theme .add-note-container h3,
body.dark-theme .manage-classes-container h3,
body.dark-theme .add-event-form-container h3 {
    border-bottom-color: #30304a;
    color: #f0f0f0;
}

body.dark-theme .form-group label {
    color: #ccc;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select,
body.dark-theme #add-note-form textarea {
    background-color: #2a2a3e;
    border-color: #40405a;
    color: #e0e0e0;
}

body.dark-theme input[type="color"] {
    background-color: #2a2a3e;
}

body.dark-theme .defined-classes-list {
    border-top-color: #30304a;
}

body.dark-theme .defined-classes-list h4 {
    color: #888;
}

body.dark-theme .defined-classes-list li {
    border-bottom-color: #30304a;
    color: #ccc;
}

body.dark-theme .note-card {
    background-color: #1f1f30;
    border-color: #40405a;
}

body.dark-theme .note-card h4 {
    border-bottom-color: #30304a;
    color: #f0f0f0;
}

body.dark-theme .note-card p {
    color: #ccc;
}

body.dark-theme .note-color-1 {
    border-left-color: #fcd34d;
}

body.dark-theme .note-color-2 {
    border-left-color: #6ee7b7;
}

body.dark-theme .note-color-3 {
    border-left-color: #93c5fd;
}

body.dark-theme .note-color-4 {
    border-left-color: #c084fc;
}

body.dark-theme .note-color-5 {
    border-left-color: #fca5a5;
}

body.dark-theme .stat-card h4 {
    color: #aaa;
}

body.dark-theme .stat-value {
    color: #9a8cff;
}