@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700&display=swap');

:root {
    --primary-color: #4a90e2;
    --completed-green: #28a745;
    --completed-orange: #fd7e14;
    --overdue-red: #dc3545;
    --light-bg: #f4f7f9;
    --dark-text: #333;
    --light-text: #fff;
    --border-color: #ddd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--light-text);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.todo-app h2 {
    color: var(--dark-text);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

#show-add-modal-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--light-text);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 20px;
}
#show-add-modal-btn:hover {
    background: #357abd;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.tab-link {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #888;
    position: relative;
}
.tab-link.active {
    color: var(--primary-color);
    font-weight: bold;
}
.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.task-list-content { display: none; }
.task-list-content.active { display: block; }

/* Task List Items */
.task-list {
    list-style: none;
    padding: 0;
}
.task-list li {
    font-size: 1rem;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--light-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: grab;
    transition: box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.task-list li.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}
.task-list li .task-content {
    flex-grow: 1;
}
.task-list li .task-title {
    color: var(--dark-text);
    display: block;
}
.task-list li .task-deadline {
    font-size: 0.8rem;
    color: #777;
}

.task-actions {
    display: flex;
    gap: 10px;
}
.task-actions button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #888;
    transition: color 0.2s;
}
.task-actions button:hover { color: var(--primary-color); }
.task-actions .delete-btn:hover { color: var(--overdue-red); }

/* Task Status Colors */
#completed-list-container li.status-ontime { border-right: 5px solid var(--completed-green); }
#completed-list-container li.status-late { border-right: 5px solid var(--completed-orange); }
#ongoing-list-container li.status-overdue { border-right: 5px solid var(--overdue-red); }

/* --- Progress Bar Styles (Updated) --- */
.progress-wrapper {
    margin-top: 10px;
}

.progress-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color); /* Default color (Blue for >50%) */
    border-radius: 4px;
    transition: width 0.4s ease-in-out, background-color 0.4s ease-in-out;
}

.progress-text {
    font-size: 0.75rem; /* 12px */
    color: #6c757d;
    margin-bottom: 4px;
    display: block;
    text-align: left;
}

/* New Status Colors for Time Remaining */
.progress-bar.status-warning {
    background-color: var(--completed-orange); /* Orange for <= 50% */
}
.progress-bar.status-critical {
    background-color: var(--overdue-red); /* Red for <= 20% */
}
.progress-bar.overdue {
    background-color: var(--overdue-red); /* Red for passed deadline */
}


/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slide-down 0.3s ease-out;
}
@keyframes slide-down {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.close-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}
#modal-title { margin-bottom: 20px; }
#task-input, #task-deadline {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}
#save-task-btn {
    width: 100%;
    padding: 12px;
    background: var(--completed-green);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

/* --- Authentication Page Styles --- */
.auth-body {
    align-items: center;
}

.auth-container {
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.auth-container h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
}

.input-group {
    margin-bottom: 20px;
    text-align: right;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--light-bg);
}

.auth-container button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--light-text);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-link {
    margin-top: 20px;
}

.alert {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    color: white;
    text-align: center;
}
.alert.error { background: var(--overdue-red); }
.alert.success { background: var(--completed-green); }

/* Header for main app */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    font-size: 1.5rem;
    color: var(--dark-text);
    text-decoration: none;
    transition: color 0.2s;
}
.logout-btn:hover {
    color: var(--primary-color);
}

/* Add this to the end of your style.css */
.remember-me-group {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 20px;
    text-align: right;
}
.remember-me-group label {
    margin-bottom: 0;
}