* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #1f2937, #111827);
    color: #f9fafb;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 900px;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.app-header {
    text-align: center;
    margin-bottom: 32px;
}

.brand-block {
    display: grid;
    gap: 8px;
    align-items: start;
}

.brand-block p {
    margin-left: 4px;
}

.app-logo {
    width: min(340px, 60vw);
    height: auto;
    display: block;
    object-fit: contain;
}

.app-header p {
    color: #9ca3af;
    font-size: 18px;
}

.task-form {
    display: grid;
    grid-template-columns: 1fr 140px 160px 130px;
    gap: 12px;
    margin-bottom: 24px;
}

.task-form input,
.task-form select {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #374151;
    background: #1f2937;
    color: #f9fafb;
    font-size: 15px;
}

.task-form input:focus,
.task-form select:focus {
    outline: none;
    border-color: #60a5fa;
}

.task-form button {
    border: none;
    border-radius: 12px;
    background: #2563eb;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.task-form button:hover {
    background: #1d4ed8;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stats div {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 16px;
    padding: 18px;
    text-align: center;
}

.stats span {
    font-size: 32px;
    font-weight: bold;
    color: #60a5fa;
}

.stats p {
    color: #9ca3af;
    margin-top: 4px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.filter-button {
    flex: 1 1 120px;
    min-width: 120px;
    padding: 10px 18px;
    border: 1px solid #374151;
    background: #1f2937;
    color: #f9fafb;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s;
}

.filter-button:hover,
.filter-button.active {
    background: #2563eb;
    border-color: #2563eb;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.task-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 18px;
    padding: 18px;
}

.task-card.completed {
    opacity: 0.6;
}

.task-card.completed .task-title {
    text-decoration: line-through;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-title {
    font-size: 18px;
    font-weight: 600;
}

.task-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: #9ca3af;
    font-size: 14px;
}

.priority {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

.priority.low {
    background: #064e3b;
    color: #6ee7b7;
}

.priority.medium {
    background: #78350f;
    color: #fcd34d;
}

.priority.high {
    background: #7f1d1d;
    color: #fca5a5;
}

.delete-button {
    border: none;
    background: #dc2626;
    color: white;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: 0.2s;
}

.delete-button:hover {
    background: #b91c1c;
}

.empty-message {
    text-align: center;
    color: #9ca3af;
    padding: 30px;
    border: 1px dashed #374151;
    border-radius: 16px;
}

@media (max-width: 760px) {
    .task-form {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-button {
        width: 100%;
        min-width: 0;
        padding-left: 10px;
        padding-right: 10px;
        text-align: center;
    }

    .task-card {
        grid-template-columns: auto 1fr;
    }

    .delete-button {
        grid-column: 1 / -1;
    }
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr 180px 170px;
    gap: 12px;
    margin-bottom: 24px;
}

.toolbar input,
.toolbar select {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #374151;
    background: #1f2937;
    color: #f9fafb;
    font-size: 15px;
}

.toolbar input:focus,
.toolbar select:focus {
    outline: none;
    border-color: #60a5fa;
}

#clearCompletedButton {
    border: none;
    border-radius: 12px;
    background: #7f1d1d;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

#clearCompletedButton:hover {
    background: #991b1b;
}

.task-actions {
    display: flex;
    gap: 8px;
}

.edit-button {
    border: none;
    background: #2563eb;
    color: white;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: 0.2s;
}

.edit-button:hover {
    background: #1d4ed8;
}

.overdue-tag {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
    background: #7f1d1d;
    color: #fecaca;
}

.task-card.overdue {
    border-color: #dc2626;
}

@media (max-width: 760px) {
    .toolbar {
        grid-template-columns: 1fr;
    }

    .task-actions {
        grid-column: 1 / -1;
    }
}

/* ---------- Theme variables ---------- */

body {
    transition: background 0.25s ease, color 0.25s ease;
}

body.light-theme {
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    color: #111827;
}

body.light-theme .app-container {
    background: #ffffff;
    border-color: #bfdbfe;
}

body.light-theme .app-header p,
body.light-theme .task-meta,
body.light-theme .empty-message {
    color: #4b5563;
}

body.light-theme .task-form input,
body.light-theme .task-form select,
body.light-theme .task-form textarea,
body.light-theme .toolbar input,
body.light-theme .toolbar select {
    background: #f9fafb;
    color: #111827;
    border-color: #cbd5e1;
}

body.light-theme .stats div,
body.light-theme .task-card {
    background: #f9fafb;
    border-color: #d1d5db;
}

body.light-theme .filter-button {
    background: #f3f4f6;
    color: #111827;
    border-color: #d1d5db;
}

body.light-theme .filter-button.active,
body.light-theme .filter-button:hover {
    background: #2563eb;
    color: #ffffff;
}

body.light-theme .task-title {
    color: #111827;
}

/* ---------- Header with theme button ---------- */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    text-align: left;
}

.theme-toggle-button {
    border: 1px solid #374151;
    background: #1f2937;
    color: #f9fafb;
    border-radius: 999px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.theme-toggle-button:hover {
    background: #2563eb;
    border-color: #2563eb;
}

body.light-theme .theme-toggle-button {
    background: #e5e7eb;
    color: #111827;
    border-color: #cbd5e1;
}

/* ---------- Description textarea ---------- */

.task-form textarea {
    grid-column: 1 / -1;
    min-height: 90px;
    resize: vertical;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #374151;
    background: #1f2937;
    color: #f9fafb;
    font-size: 15px;
    font-family: inherit;
}

.task-form textarea:focus {
    outline: none;
    border-color: #60a5fa;
}

.task-description {
    color: #d1d5db;
    font-size: 14px;
    line-height: 1.4;
}

body.light-theme .task-description {
    color: #4b5563;
}

/* ---------- Reminder tags ---------- */

.reminder-tag {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

.reminder-overdue {
    background: #7f1d1d;
    color: #fecaca;
}

.reminder-today {
    background: #78350f;
    color: #fde68a;
}

.reminder-tomorrow {
    background: #1e3a8a;
    color: #bfdbfe;
}

.reminder-soon {
    background: #064e3b;
    color: #a7f3d0;
}

.task-card.overdue {
    border-color: #dc2626;
}

.task-card.due-today {
    border-color: #f59e0b;
}

.task-card.due-soon {
    border-color: #10b981;
}

/* ---------- Drag and drop ---------- */

.task-card {
    cursor: grab;
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.task-card:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.drag-hint {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 12px;
}

body.light-theme .drag-hint {
    color: #4b5563;
}

@media (max-width: 760px) {
    .app-header {
        flex-direction: column;
        text-align: center;
    }

    .brand-block {
        justify-items: center;
    }

    .brand-block p {
        margin-left: 0;
    }

    .filters {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .filter-button {
        width: 100%;
        min-width: 0;
    }
}

