/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 30px;
}

header h1 a {
    text-decoration: none;
    color: #333;
}

nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-info {
    color: #666;
    margin-right: 10px;
}

.user-info-link {
    color: #3B82F6;
    text-decoration: none;
    margin-right: 10px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.user-info-link:hover {
    background: #EFF6FF;
    color: #1D4ED8;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    background: #e0e0e0;
    color: #333;
}

.btn-primary {
    background: #3B82F6;
    color: white;
}

.btn-secondary {
    background: #6B7280;
    color: white;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
}

/* Flash Messages / Notifications */
.flash-messages {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.flash {
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateX(0);
}

.flash:hover {
    opacity: 0.9;
}

.flash-error {
    background: #FEE2E2;
    color: #DC2626;
    border-left: 4px solid #DC2626;
}

.flash-success {
    background: #D1FAE5;
    color: #059669;
    border-left: 4px solid #059669;
}

.flash-info {
    background: #DBEAFE;
    color: #1D4ED8;
    border-left: 4px solid #1D4ED8;
}

/* Mobile styles */
@media (max-width: 768px) {

    /* Notifications at top, full width */
    .flash-messages {
        bottom: auto;
        top: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        padding: 10px;
    }

    .flash {
        border-radius: 0;
        border-left: none;
        border-bottom: 3px solid;
    }

    .flash-error {
        border-bottom-color: #DC2626;
    }

    .flash-success {
        border-bottom-color: #059669;
    }

    .flash-info {
        border-bottom-color: #1D4ED8;
    }

    /* Add task form - stack vertically */
    .add-task-form-expanded .form-row-main {
        flex-direction: column;
    }

    .add-task-form-expanded .form-row-main input[type="text"] {
        width: 100%;
    }

    .add-task-form-expanded .form-row-main select {
        width: 100%;
    }

    .add-task-form-expanded .form-row-main .btn {
        width: 100%;
    }

    /* Date fields stack */
    .date-section-inline {
        flex-wrap: wrap;
    }

    .date-section-inline .section-label {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Container padding */
    .container {
        padding: 10px;
    }

    /* Header responsive */
    header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    header h1 {
        font-size: 1.3rem;
    }

    /* Dashboard header */
    .dashboard-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .dashboard-header .btn {
        text-align: center;
    }

    /* Task items */
    .task-item {
        flex-wrap: wrap;
        padding: 10px 12px;
    }

    .task-meta {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .task-actions {
        order: 2;
    }
}

/* Auth Forms */
.auth-form {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-form h2 {
    margin-bottom: 20px;
    text-align: center;
}

/* Language Switcher */
.lang-switcher {
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.lang-link {
    color: #666;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lang-link:hover {
    color: #3B82F6;
    background: #EFF6FF;
}

.lang-link.active {
    color: #3B82F6;
    font-weight: 600;
}

.lang-sep {
    color: #ccc;
    margin: 0 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: #3B82F6;
}

.form-group small {
    color: #666;
    font-size: 12px;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-link a {
    color: #3B82F6;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h2 {
    margin: 0;
}

.quick-add-link {
    font-size: 0.9rem;
}

.dashboard h2 {
    margin-bottom: 20px;
}

.add-task-form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.add-task-form input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.add-task-form select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

/* Expanded Add Task Form */
.add-task-form-expanded {
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.add-task-form-expanded .form-row-main {
    display: flex;
    gap: 10px;
}

.add-task-form-expanded input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.add-task-form-expanded select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.extra-fields {
    margin-top: 10px;
}

.extra-fields summary {
    cursor: pointer;
    color: #666;
    font-size: 14px;
    padding: 5px 0;
}

.extra-fields-content {
    padding: 15px 0 5px;
}

.extra-fields .form-group {
    margin-bottom: 12px;
}

.extra-fields .form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #555;
}

.extra-fields textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.extra-fields input[type="datetime-local"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #ddd;
}

.task-item.priority-low {
    border-left-color: #9CA3AF;
}

.task-item.priority-medium {
    border-left-color: #3B82F6;
}

.task-item.priority-high {
    border-left-color: #F59E0B;
}

.task-item.priority-urgent {
    border-left-color: #EF4444;
}

.task-item.task-done {
    opacity: 0.6;
}

.task-item.task-done .task-title {
    text-decoration: line-through;
}

.checkbox-btn {
    width: 28px;
    height: 28px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-done .checkbox-btn {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.task-title {
    font-weight: 500;
}

.task-description {
    font-size: 13px;
    color: #666;
}

.task-meta {
    display: flex;
    gap: 8px;
}

.priority-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.priority-badge.priority-low {
    background: #F3F4F6;
    color: #6B7280;
}

.priority-badge.priority-medium {
    background: #DBEAFE;
    color: #1D4ED8;
}

.priority-badge.priority-high {
    background: #FEF3C7;
    color: #D97706;
}

.priority-badge.priority-urgent {
    background: #FEE2E2;
    color: #DC2626;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.edit-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    text-decoration: none;
}

.edit-btn:hover {
    color: #3B82F6;
}

.delete-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
}

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

.task-dates {
    font-size: 12px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.date-badge {
    font-size: 11px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Task Groups */
.task-group {
    margin-bottom: 24px;
}

.task-group-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-group-header.group-overdue {
    background: #FEE2E2;
    color: #DC2626;
}

.task-group-header.group-today {
    background: #DBEAFE;
    color: #1D4ED8;
}

.task-group-header.group-tomorrow {
    background: #FEF3C7;
    color: #D97706;
}

.task-group-header.group-this-week {
    background: #D1FAE5;
    color: #059669;
}

.task-group-header.group-later {
    background: #E5E7EB;
    color: #4B5563;
}

.task-group-header.group-no-date {
    background: #F3F4F6;
    color: #6B7280;
}

.task-group .task-item {
    margin-bottom: 8px;
}

.task-group-overdue .task-item:not(.task-done) {
    background: #FEF2F2;
}

/* Completed Tasks Section */
.completed-tasks-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #E5E7EB;
}

.completed-tasks-section .section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #059669;
}

/* Edit Task Page */
.edit-task-page {
    max-width: 600px;
    margin: 0 auto;
}

.edit-task-page h2 {
    margin-bottom: 20px;
}

.task-edit-form {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.task-edit-form .form-group {
    margin-bottom: 20px;
}

.task-edit-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.task-edit-form input[type="text"],
.task-edit-form textarea,
.task-edit-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
}

.task-edit-form input[type="datetime-local"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.task-edit-form textarea {
    resize: vertical;
    min-height: 80px;
}

.task-edit-form .form-row {
    display: flex;
    gap: 15px;
}

.task-edit-form .form-row .form-group {
    flex: 1;
}

.task-edit-form .char-count {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* Date sections */
.date-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.date-section h4 {
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
}

.date-section .hint {
    display: block;
    color: #888;
    font-size: 12px;
    margin-bottom: 10px;
}

.date-section-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.date-section-inline .section-label {
    min-width: 90px;
    font-weight: 500;
    color: #555;
}

.date-section-inline input[type="date"],
.date-section-inline input[type="time"] {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.date-section-inline input:disabled {
    background: #eee;
    cursor: not-allowed;
}

.hint-inline {
    color: #888;
    font-size: 12px;
}

/* Footer */
footer {
    margin-top: auto;
    padding: 20px 0;
    text-align: center;
    color: #999;
    font-size: 14px;
}

main {
    flex: 1;
}

/* Profile Page */
.profile-page {
    max-width: 600px;
    margin: 0 auto;
}

.profile-page h2 {
    margin-bottom: 30px;
}

.profile-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.profile-section h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 18px;
    color: #333;
}

.profile-form .form-group {
    margin-bottom: 16px;
}

.profile-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.profile-form .form-group input[type="password"],
.profile-form .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.profile-form .form-group input:focus,
.profile-form .form-group select:focus {
    outline: none;
    border-color: #3B82F6;
}

.profile-form .form-group small {
    color: #666;
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

.profile-actions {
    margin-top: 20px;
    text-align: center;
}

/* Tags and Categories */
.tags-list,
.categories-list {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item,
.category-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-badge,
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    background: #e0e0e0;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.btn-delete {
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.no-items {
    color: #999;
    font-style: italic;
    margin-top: 8px;
}

.profile-form .form-group input[type="text"],
.profile-form .form-group input[type="color"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.profile-form .form-group input[type="color"] {
    height: 40px;
    cursor: pointer;
}

/* Tags checkboxes in form */
.tags-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag-checkbox {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

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

.tag-label {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    background: #e0e0e0;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.tag-checkbox input[type="checkbox"]:checked+.tag-label {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.tag-label:hover {
    opacity: 0.8;
}

/* Task labels (tags and categories in task display) */
.task-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.category-badge-small,
.tag-badge-small {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e0e0e0;
    color: #333;
    font-size: 12px;
    font-weight: 500;
}

.category-badge-small {
    background: #DBEAFE;
    color: #1E40AF;
}

.tag-badge-small {
    background: #FEF3C7;
    color: #92400E;
}