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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #eee;
}

/* User Bar */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-bar-left .app-name {
    font-weight: 600;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-bar-right #user-info {
    color: #aaa;
    font-size: 0.9rem;
}

.user-bar-right #admin-link {
    color: #ffc107;
    text-decoration: none;
    font-size: 0.85rem;
}

.user-bar-right #admin-link:hover {
    text-decoration: underline;
}

.user-bar-right .logout-btn {
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.user-bar-right .logout-btn:hover {
    background: rgba(220, 53, 69, 0.3);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-box h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-box h2 {
    text-align: center;
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 30px;
}

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

.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: #aaa;
    font-size: 0.9rem;
}

.auth-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #00d2ff;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 210, 255, 0.3);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #888;
    font-size: 0.9rem;
}

.auth-link a {
    color: #00d2ff;
    text-decoration: none;
}

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

.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.flash-error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.flash-success {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar h2 {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-day-btn {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.new-day-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.3);
}

.days-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.year-divider {
    display: flex;
    align-items: center;
    margin: 10px 0 5px 0;
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 4px 0;
    border-radius: 4px;
    transition: color 0.2s;
}

.year-divider:hover {
    color: #00d2ff;
}

.year-divider .year-toggle {
    font-size: 0.6rem;
    margin-right: 6px;
    width: 10px;
}

.year-divider .year-label {
    margin-right: 10px;
}

.year-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, rgba(255,255,255,0.2), transparent);
}

.year-entries {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.year-entries.collapsed {
    display: none;
}

.day-item {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.day-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.day-item.active {
    background: rgba(0, 210, 255, 0.15);
    border-color: rgba(0, 210, 255, 0.3);
    color: #00d2ff;
}

.day-item.future {
    border-left: 3px solid #28a745;
}

.day-item.future .day-date::before {
    content: '→ ';
    color: #28a745;
}

.day-item .day-date {
    font-weight: 600;
}

.day-item .day-weekday {
    font-size: 0.75rem;
    opacity: 0.7;
}

.main-content {
    flex: 1;
    overflow-y: auto;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.date {
    color: #888;
    font-size: 0.9rem;
}

.notification-status {
    margin-top: 10px;
}

.notif-enabled {
    color: #28a745;
    font-size: 0.8rem;
}

.notif-disabled {
    color: #dc3545;
    font-size: 0.8rem;
}

.notif-unavailable {
    color: #888;
    font-size: 0.8rem;
}

.notif-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: transparent;
    color: #ffc107;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.notif-btn:hover {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.add-task {
    margin-bottom: 25px;
}

#task-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#task-title {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
}

#task-title::placeholder {
    color: #888;
}

#task-priority {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

#task-priority option {
    background: #1a1a2e;
}

#task-due-time,
#task-date {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

#task-due-time::-webkit-calendar-picker-indicator,
#task-date::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

#task-form button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#task-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 210, 255, 0.3);
}

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

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls span {
    color: #888;
    font-size: 0.9rem;
}

.sort-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: transparent;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.sort-btn.active {
    background: rgba(0, 210, 255, 0.2);
    border-color: #00d2ff;
    color: #00d2ff;
}

.legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: #888;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.tasks-container {
    min-height: 200px;
}

.task-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

.task-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.task-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    margin-right: 15px;
}

.task-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.description-toggle {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    transition: color 0.2s;
}

.description-toggle:hover {
    color: #00d2ff;
}

.description-toggle.has-content {
    color: #00d2ff;
}

.description-section {
    display: none;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.description-section.expanded {
    display: block;
}

.description-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.description-toolbar button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #aaa;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    min-width: 28px;
    transition: all 0.2s;
}

.description-toolbar button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.toolbar-separator {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

.description-editor {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0, 0, 0, 0.1);
    color: #ddd;
    font-size: 0.9rem;
    line-height: 1.5;
}

.description-editor:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.2);
}

.description-editor:empty:before {
    content: attr(placeholder);
    color: #666;
    pointer-events: none;
}

.description-editor img {
    max-width: 100%;
    border-radius: 4px;
    margin: 8px 0;
}

.description-editor ul,
.description-editor ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.description-editor a {
    color: #00d2ff;
}

.overdue-warning {
    color: #dc3545;
    font-size: 1.2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.task-card.overdue {
    border-left-color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.05);
}

.task-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

.priority-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-select {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid;
    cursor: pointer;
    outline: none;
}

.priority-select option {
    background: #1a1a2e;
    color: #fff;
}

.delete-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: color 0.2s;
}

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

.task-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.completion-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.completion-section label {
    font-size: 0.85rem;
    color: #888;
    min-width: 80px;
}

.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.completion-input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
}

.completion-input:focus {
    outline: none;
    border-color: #00d2ff;
}

.due-time-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.due-time-section label {
    font-size: 0.85rem;
    color: #888;
    min-width: 80px;
}

.due-time-input {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.9rem;
}

.due-time-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.due-time-input:focus {
    outline: none;
    border-color: #00d2ff;
}

.due-time-input.overdue {
    border-color: #dc3545;
    color: #dc3545;
}

.status-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-section label {
    font-size: 0.85rem;
    color: #888;
    min-width: 80px;
}

.status-buttons {
    display: flex;
    gap: 8px;
}

.status-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.status-btn.active {
    font-weight: 600;
}

.status-btn.working.active {
    background: rgba(40, 167, 69, 0.2);
    border-color: #28a745;
    color: #28a745;
}

.status-btn.blocked.active {
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
    color: #dc3545;
}

.status-btn.idle.active {
    background: rgba(108, 117, 125, 0.2);
    border-color: #6c757d;
    color: #adb5bd;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.move-copy-section {
    display: flex;
    align-items: center;
    gap: 6px;
}

.target-date-input {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

.target-date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.target-date-input:focus {
    outline: none;
    border-color: #00d2ff;
}

.move-btn,
.copy-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.move-btn:hover {
    background: rgba(0, 210, 255, 0.1);
    border-color: #00d2ff;
    color: #00d2ff;
}

.copy-btn:hover {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
    color: #28a745;
}

.interrupts-badge {
    font-size: 0.8rem;
    color: #888;
}

.interrupts-badge span {
    color: #ffc107;
    font-weight: 600;
}

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

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 15px;
        max-height: none;
    }

    .sidebar h2 {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        margin-bottom: 10px;
    }

    .sidebar h2::after {
        content: '▼';
        font-size: 0.7rem;
        transition: transform 0.2s;
    }

    .sidebar.collapsed h2::after {
        transform: rotate(-90deg);
    }

    .sidebar.collapsed .days-list,
    .sidebar.collapsed .new-day-btn {
        display: none;
    }

    .days-list {
        max-height: 40vh;
        overflow-y: auto;
        gap: 5px;
    }

    .year-divider {
        position: sticky;
        top: 0;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1;
        padding: 6px 0;
        margin: 5px 0;
    }

    .year-entries {
        gap: 3px;
    }

    .day-item {
        padding: 8px 12px;
    }
}

@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .task-meta {
        width: 100%;
        justify-content: space-between;
    }

    .completion-section,
    .status-section,
    .due-time-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .progress-container {
        width: 100%;
    }

    .progress-bar {
        min-width: 0;
        flex: 1;
    }

    .completion-input {
        width: 60px;
        flex-shrink: 0;
    }

    .status-buttons {
        flex-wrap: wrap;
    }

    .due-time-input {
        width: 100%;
    }
}
