/* Modern CSS Styles */
:root {
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --danger-color: #f72585;
    --success-color: #4cc9f0;
    --warning-color: #f8961e;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-color: #e9ecef;
    --card-bg: #ffffff;
    --body-bg: #f8f9fa;
    --text-color: #212529;
    --text-light: #6c757d;
}

[data-theme="dark"] {
    --dark-color: #f8f9fa;
    --light-color: #212529;
    --gray-color: #adb5bd;
    --border-color: #495057;
    --card-bg: #2b2d42;
    --body-bg: #161a2b;
    --text-color: #f8f9fa;
    --text-light: #adb5bd;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    line-height: 1.6;
    transition: all 0.3s ease;
}

.container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    padding: 20px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.bg-blue { background-color: #4361ee; }
.bg-green { background-color: #4cc9f0; }
.bg-orange { background-color: #f8961e; }
.bg-red { background-color: #f72585; }
.bg-purple { background-color: #7209b7; }

/* Button Styles */
button {
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.secondary-btn:hover {
    background-color: rgba(67, 97, 238, 0.1);
    transform: translateY(-1px);
}

.danger-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.danger-btn:hover {
    background-color: #e5177b;
    transform: translateY(-1px);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* Authentication Styles */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.auth-form {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.form-subtitle {
    color: var(--gray-color);
    margin-bottom: 24px;
    font-size: 15px;
}

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
    font-size: 14px;
}

.auth-form input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    background: transparent;
    color: var(--text-color);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.auth-toggle {
    margin-top: 20px;
    color: var(--gray-color);
    font-size: 14px;
}

.auth-toggle a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-toggle a:hover {
    text-decoration: underline;
}


/* User Profile Styles */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.username {
    font-weight: 500;
    color: var(--text-color);
    font-size: 13px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.username::before {
    content: "\f007";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
    color: var(--primary-color);
}

/* Update existing header styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn {
    margin-left: 0;
}



/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
}

/* Task Form */
.task-form {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow: hidden;
}

.form-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.form-content {
    padding: 20px;
}

.task-form input,
.task-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 16px;
    background: transparent;
    color: var(--text-color);
}

.task-form input:focus,
.task-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

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

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

.form-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row .input-group i {
    left: 12px;
}

.form-row .input-group input {
    padding-left: 38px;
}

/* Task Controls */
.task-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.controls-left {
    flex: 1;
    min-width: 250px;
}

.controls-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
    font-size: 14px;
}

#task-search {
    width: 100%;
    padding: 10px 16px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: transparent;
    color: var(--text-color);
}

#task-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.task-controls select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: transparent;
    color: var(--text-color);
    min-width: 150px;
}

.task-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

/* Progress Bar */
.progress-container {
    margin-bottom: 30px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bulk-select {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-select label {
    font-size: 14px;
    cursor: pointer;
}

#bulk-action-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: transparent;
    color: var(--text-color);
}

/* Task List */
.task-list-container {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

#task-list {
    width: 100%;
    border-collapse: collapse;
}

#task-list thead {
    background-color: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border-color);
}

#task-list th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-light);
}

#task-list td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

#task-list tr:last-child td {
    border-bottom: none;
}

#task-list tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.task-checkbox {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.task-title {
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-color);
}

.task-description {
    font-size: 14px;
    color: var(--text-light);
    white-space: pre-wrap;
    word-break: break-word;
}

.status-pending {
    color: var(--warning-color);
    font-weight: 500;
    background: rgba(248, 150, 30, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
    font-size: 13px;
}

.status-completed {
    color: var(--success-color);
    font-weight: 500;
    background: rgba(76, 201, 240, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
    font-size: 13px;
}

.overdue {
    color: var(--danger-color);
    font-weight: 500;
}

.due-today {
    color: var(--warning-color);
    font-weight: 500;
}

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

.action-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.mark-completed {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--success-color);
}

.mark-completed:hover {
    background-color: rgba(76, 201, 240, 0.2);
}

.mark-pending {
    background-color: rgba(248, 150, 30, 0.1);
    color: var(--warning-color);
}

.mark-pending:hover {
    background-color: rgba(248, 150, 30, 0.2);
}

.delete-button {
    background-color: rgba(247, 37, 133, 0.1);
    color: var(--danger-color);
}

.delete-button:hover {
    background-color: rgba(247, 37, 133, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
}

.empty-state td {
    border: none;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-color);
    margin-bottom: 16px;
}

.empty-state h3 {
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
}

.modal.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.modal-body {
    padding: 20px;
    color: var(--text-light);
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Additional Button Styles for Modal */
.success-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-btn:hover {
    background-color: #3db8d8;
    transform: translateY(-1px);
}

.warning-btn {
    background-color: var(--warning-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-btn:hover {
    background-color: #e0871a;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .primary-btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .auth-form {
        padding: 30px 20px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .controls-right {
        width: 100%;
    }
    
    .controls-right select {
        flex: 1;
        min-width: auto;
    }
    
    .bulk-actions {
        flex-wrap: wrap;
    }
    
    #task-list th, #task-list td {
        padding: 12px 8px;
    }
    
    .task-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer button {
        width: 100%;
    }
}