:root {
    --primary-color: #e6e8f0;
    --primary-dark: #2b40a6;
    --secondary-color: #764ba2;
    --background-color: #f8f9fa;
    --sidebar-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #bdbebe;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    --background-color: #1a1a1a;
    --sidebar-bg: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #404040;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-y: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Authentication Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fdfdff 0%, #1a1025 100%);
    padding: 20px;
}

.auth-card {
    background: transparent;
    border-radius: 20px;
    box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
    overflow: hidden;
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    background: #796E72;
    background: linear-gradient(to right, #524f4f 5%, #200303 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 28px;
    margin-bottom: 10px;
}

.auth-header p {
    color: #1d1d1d;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #1d1d1d;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    width: 100%;
    padding: 12px;
    background: rgb(29, 28, 28);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-profile {
    width: 20%;
}

.btn:hover {
    background: black;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-color);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #1d1d1d;
}

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

.error-message, .success-message {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.error-message {
    background: transparent;
    color: rgb(255, 1, 1);
    font-size: 15px;
    text-align: center;
}

.success-message {
    background: transparent;
    color: #3c3;
    font-size: 15px;
    text-align: center;
}

/* Dashboard Styles */
.dashboard {
    display: none;
    height: 100vh;
    overflow: hidden;
}

.dashboard-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 43px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    background: #796E72;
    background: linear-gradient(to right, #5d5659 5%, #200303 100%);
    -webkit-background-clip: text;
    cursor: pointer;
    position: relative;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(85, 85, 85, 0.653);
    font-weight: bold;
    overflow: hidden;
    position: relative;
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.logo-upload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.logo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
    color: white;
    font-size: 12px;
}

.logo-icon:hover .logo-overlay {
    opacity: 1;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 15px 20px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
    background: rgba(76, 76, 79, 0.1);
    color: black;
    border-left-color: black;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #c82333;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    padding: 30px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.content-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.content-header p {
    color: var(--text-secondary);
}

.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-height: 0;
}

/* Search and Filter Section */
.search-filter-section {
    background: var(--sidebar-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.search-filter-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 15px;
    align-items: center;
}

.search-input {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--background-color);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 14px;
}

.clear-filters-btn {
    padding: 10px 16px;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: var(--text-primary);
}

.filter-results {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Tasks View */
.add-task-form {
    background: var(--sidebar-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.task-input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.task-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    background: var(--background-color);
    color: var(--text-primary);
}

.task-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.date-input {
    width: 200px;
}

.add-task-btn {
    padding: 12px 24px;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.priority-select {
    width: 120px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--background-color);
    color: var(--text-primary);
}

.tasks-container {
    display: grid;
    gap: 15px;
    overflow-y: auto;
    max-height: 50vh;
    height: 100%;
}

.task-item {
    background: var(--sidebar-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid var(--border-color);
}

.task-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.task-item.priority-high {
    border-left-color: var(--danger-color);
}

.task-item.priority-medium {
    border-left-color: var(--warning-color);
}

.task-item.priority-low {
    border-left-color: var(--success-color);
}

.task-item.completed {
    opacity: 0.7;
}

.task-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
}

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

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

.task-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.edit-btn {
    background: rgb(58, 57, 57);
    color: white;
}

.delete-btn {
    background: var(--danger-color);
    color: white;
}

.task-meta {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.priority-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.priority-high {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.priority-medium {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.priority-low {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

/* Calendar View */
.calendar-container {
    background: var(--sidebar-bg);
    border-radius: 15px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.calendar-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-nav button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.calendar-day {
    background: var(--sidebar-bg);
    padding: 15px 10px;
    min-height: 100px;
    position: relative;
}

.calendar-day-number {
    font-weight: 600;
    margin-bottom: 5px;
}

.calendar-task {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-bottom: 2px;
    cursor: pointer;
}

.calendar-task.overdue {
    background: var(--danger-color);
}

/* Settings View */
.settings-section {
    background: var(--sidebar-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.settings-section h3 {
    margin-bottom: 20px;
    color: black;
}

.settings-form {
    display: grid;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.hidden {
    display: none !important;
}

/* Edit Task Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--sidebar-bg);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-hover);
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Mobile Styles */
.mobile-header {
    display: none;
    padding: 15px 20px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1001;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.mobile-nav {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    max-height: none;
    overflow-y: auto;
}

.mobile-nav.show {
    transform: translateX(0);
}

.mobile-nav-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mobile-nav-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
    background: rgba(11, 11, 11, 0.1);
    color: var(--text-primary-);
    border-left-color: var(--primary-color);
}

.mobile-nav-item i {
    width: 20px;
}

.mobile-logout {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.mobile-logout-btn {
    width: 100%;
    padding: 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.mobile-logout-btn:hover {
    background: #c82333;
}

.mobile-collapsible {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(.4,0,.2,1);
    margin-bottom: 10px;
}
.mobile-collapsible.expanded {
    display: block;
    max-height: 1000px; 
    transition: max-height 0.5s cubic-bezier(.4,0,.2,1);
}

.mobile-collapsible-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar-bg);
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.mobile-collapsible-toggle i {
    margin-left: 10px;
    transition: transform 0.3s;
}
.mobile-collapsible-toggle.active i {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .mobile-header {
        display: flex;
    }

    .mobile-collapsible-toggle {
        display: flex;
    }
    .mobile-collapsible {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(.4,0,.2,1);
        margin-bottom: 10px;
    }
    .mobile-collapsible.expanded {
        max-height: 1000px; /* Large enough for content */
        transition: max-height 0.5s cubic-bezier(.4,0,.2,1);
    }

    .mobile-nav {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

     .content-body {
        padding: 20px 15px;
        min-height: 0;  
    }
    .tasks-container {
        display: grid;
        gap: 10px;
        max-height: 100vh;
        /* Remove flex-direction: column or similar overrides */
    }
    .task-item {
        padding: 10px 8px;
        font-size: 15px;
    }
    .task-header {
        gap: 8px;
        flex-wrap: nowrap;
    }
    .task-title {
        font-size: 16px;
    }
    .task-meta {
        gap: 10px;
        font-size: 12px;
        flex-direction: row;
        align-items: center;
    }
    .task-actions {
        gap: 6px;
        margin-top: 0;
        width: auto;
        justify-content: flex-end;
    }

    .content-header {
        display: none;
    }

    .content-body {
        padding: 20px 15px;
    }

    .search-filter-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .add-task-form {
        padding: 20px 15px;
    }

    .task-input-group {
        flex-direction: column;
        gap: 12px;
    }

    .date-input, .priority-select {
        width: 100%;
    }

    .task-item {
        padding: 15px;
    }

    .task-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .task-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }

    .task-meta {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .settings-section {
        padding: 20px 15px;
    }

    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
        max-width: none;
        padding: 20px;
    }

    .calendar-container {
        margin: 0 -15px;
    }

    .calendar-grid {
        font-size: 14px;
    }

    .calendar-day {
        padding: 8px 5px;
        min-height: 80px;
    }

    .calendar-task {
        font-size: 10px;
        padding: 1px 4px;
    }

    .auth-container {
        padding: 15px;
    }

    .auth-card {
        padding: 30px 20px;
    }
    .btn-profile {
        width: 100%;
        min-width: 0;
        max-width: none;
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    .mobile-header {
        padding: 12px 15px;
    }

    .content-body {
        padding: 15px 10px;
    }

    .add-task-form {
        padding: 15px 10px;
    }

    .task-item {
        padding: 7px 4px;
        font-size: 13px;
    }
    .task-title {
        font-size: 14px;
    }
    .task-meta {
        font-size: 11px;
        gap: 6px;
    }
    .task-btn {
        font-size: 11px;
        padding: 4px 8px;
    }

    .settings-section {
        padding: 15px 10px;
    }

    .modal-content {
        margin: 15px;
        width: calc(100% - 30px);
        padding: 15px;
    }

    .calendar-day {
        padding: 5px 3px;
        min-height: 70px;
    }

    .calendar-day-number {
        font-size: 12px;
    }

    .calendar-task {
        font-size: 9px;
        padding: 1px 3px;
    }

    .auth-card {
        padding: 25px 15px;
    }

    .mobile-nav-content {
        padding: 15px;
    }

    .mobile-nav-item {
        padding: 12px 15px;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .task-btn, .btn, .mobile-nav-item, .add-task-btn , .btn-profile{
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .task-checkbox {
        width: 24px;
        height: 24px;
    }

    .mobile-menu-toggle {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}