* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

:root {
    --primary-color: #765DE4;
    --secondary-color: #F5F5F5;
    --text-color: #333;
    --secondary-text-color: #000;
    --background-color: #fff;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app{
    display: grid;
    grid-template-columns:260px 1fr;
    min-height:100vh;
}

body {
    background: var(--background-color);
    color: var(--text-color);
}

/* ==========================
   SIDEBAR
========================== */

.sidebar{
    background:white;
    border-right:1px solid var(--border);
    padding:30px;
}

.sidebar h2{
    color:var(--primary);
    margin-bottom:30px;
}

.sidebar nav{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.sidebar a{
    padding:14px;
    border-radius:12px;
    color:#444;
    transition:.3s;
}

.sidebar a:hover,
.sidebar a.active{
    background:var(--primary);
    color:white;
}

/* --- Navbar --- */
.dashboards{
    padding:30px;
    padding-bottom:100px;
}

.header-div {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:30px;
}

.header-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    font-size: 18px;
}

.header-title h2 {
    font-size: 20px;
}

.icons {
    display: flex;
    align-items:center;
    gap:15px;
    font-size: 22px;
}

.icons a {
    color: var(--text-color);
    text-decoration: none;
}

.bottom-nav{
    display: none;
}

/* --- Dashboard --- */
.dashboard {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    padding: 0 10px;
    flex-wrap: wrap;
}

.dashboard .box {
    background: rgba(118, 93, 228, 0.1);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-color);
    flex: 1 1 100px;
    text-align: center;
}

/* --- Empty State --- */
.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: 500px;
    margin: 30px auto;
    padding: 30px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.container img {
    width: 180px;
    height: auto;
    margin-bottom: 15px;
}

.container h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

.container p {
    color: #777;
    max-width: 280px;
    line-height: 1.5;
    font-size: 14px;
}

/* --- Add Button --- */
.add-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 200;
    transition: all 0.3s ease;
}

.add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--primary-color);
}

/* --- Task Form --- */
.task-model {
    display: none;
    flex-direction: column;
    gap: 18px;
    max-width: 450px;
    margin: 20px auto;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 25px 20px;
    background: var(--card-bg);
    width: 90%;
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 5px;
    text-align: left;
}

.task-model h2 {
    font-size: 20px;
    text-align: center;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

.task-model input,
.task-model textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-color);
}

.task-model input:focus,
.task-model textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    border-width: 2px;
}

.due {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* --- Buttons Group --- */
.cate-group, .priority-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.cate-btn, .priority-btn {
    padding: 8px 14px;
    background-color: rgba(118, 93, 228, 0.2);
    border-radius: 20px;
    color: var(--secondary-text-color);
    border: none;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.cate-btn.active, .priority-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.save-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.save-btn:hover {
    transform: translateY(-2px);
}

/* --- Task Grid --- */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.task-card {
    background: var(--card-bg);
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    transition: 0.2s;
    /* ✅ Fix text overflow */
    overflow: hidden;
    word-wrap: break-word;
    white-space: normal;
}

.task-card.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    /* ✅ Prevent title overflow */
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h3 {
    font-size: 16px;
    color: var(--secondary-text-color);
    /* ✅ Wrap long text */
    word-break: break-all;
    line-height: 1.4;
}

.card-icons span {
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 4px;
    font-size: 16px;
    border: 1px solid var(--text-color);
    flex-shrink: 0;
}

.complete-btn { color: green; }
.delete-btn { color: red; }

.card-body {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    /* ✅ Fix description overflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.card-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.priority-high {
    background: #ff4d4d;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    flex-shrink: 0;
}
.priority-medium {
    background: #ffb84d;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    flex-shrink: 0;
}
.priority-low {
    background: #28a745;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    flex-shrink: 0;
}

.task-cate {
    background: rgba(118, 93, 228, 0.15);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.card-deadline {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #777;
    border-top: 1px solid #eee;
    padding-top: 8px;
    flex-wrap: wrap;
    gap: 4px;
}



/* ==========================
   DARK MODE
========================== */

body.dark {
    background: #121212;
    color: #e0e0e0;
}

/* Sidebar */
body.dark .sidebar {
    background: #1a1a2e;
    border-right-color: #2a2a2a;
}

body.dark .sidebar a {
    color: #ccc;
}

body.dark .sidebar a:hover,
body.dark .sidebar a.active {
    background: #7c3aed;
    color: white;
}

/* Header & page text */
body.dark .header-title h2,
body.dark h2,
body.dark h3 {
    color: #e0e0e0;
}

body.dark .icons a {
    color: #e0e0e0;
}

/* Stats boxes */
body.dark .dashboard .box {
    background: rgba(118, 93, 228, 0.25);
    color: #e0e0e0;
}

/* Task cards */
body.dark .task-card {
    background: #1e1e1e;
    border-color: #333;
    color: #e0e0e0;
}

body.dark .card-header h3 {
    color: #e0e0e0;
}

body.dark .card-body,
body.dark .card-body p {
    color: #bbb;
}

body.dark .card-deadline {
    color: #aaa;
    border-top-color: #333;
}

body.dark .card-icons span {
    border-color: #555;
    color: #ccc;
}

body.dark .complete-btn { color: #4ade80; }
body.dark .delete-btn   { color: #f87171; }

/* Category & priority tags */
body.dark .task-cate {
    background: rgba(118, 93, 228, 0.3);
    color: #c4b5fd;
}

/* Empty state */
body.dark .container {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark .container p {
    color: #aaa;
}

/* Create task form */
body.dark .task-model {
    background: #1e1e1e;
    border-color: #7c3aed;
    color: #e0e0e0;
}

body.dark .task-model h2 {
    color: #e0e0e0;
}

body.dark .form-group label {
    color: #ccc;
}

body.dark .task-model input,
body.dark .task-model textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

body.dark .task-model input::placeholder,
body.dark .task-model textarea::placeholder {
    color: #666;
}

body.dark .task-model input:focus,
body.dark .task-model textarea:focus {
    border-color: #7c3aed;
}

body.dark .cate-btn,
body.dark .priority-btn {
    background: rgba(118, 93, 228, 0.25);
    color: #e0e0e0;
}

body.dark .cate-btn.active,
body.dark .priority-btn.active {
    background: #7c3aed;
    color: white;
}

body.dark .back-btn {
    color: #a78bfa;
}
