/* ===== RESET & BASE STYLES ===== */
:root {
    /* Light theme variables */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --accent-primary: #4f46e5;
    --accent-secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Column colors */
    --todo-color: #94a3b8;
    --inprogress-color: #f59e0b;
    --review-color: #8b5cf6;
    --done-color: #10b981;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    
    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

[data-theme="dark"] {
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #475569;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

.subtitle {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    max-width: calc(100vw - 280px);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.sidebar-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #4338ca;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-add-task {
    width: 100%;
    padding: 0.75rem;
    background: none;
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-add-task:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background-color: rgba(79, 70, 229, 0.05);
}

/* ===== KANBAN BOARD ===== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.kanban-column {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}

.kanban-column:hover {
    box-shadow: var(--shadow-md);
}

.column-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.column-counter {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.column-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    min-height: 200px;
    transition: background-color var(--transition-fast);
}

.column-content.drag-over {
    background-color: rgba(79, 70, 229, 0.05);
    border-radius: var(--radius-md);
}

.column-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ===== TASK CARDS ===== */
.task-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: grab;
    transition: all var(--transition-fast);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.task-card:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.task-card.priority-critical::before {
    background-color: var(--danger);
}

.task-card.priority-high::before {
    background-color: var(--warning);
}

.task-card.priority-medium::before {
    background-color: var(--info);
}

.task-card.priority-low::before {
    background-color: var(--success);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.task-title {
    font-weight: 500;
    margin-right: 0.5rem;
    flex: 1;
    word-break: break-word;
}

.task-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.task-card:hover .task-actions {
    opacity: 1;
}

.task-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    word-break: break-word;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.75rem;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.task-tag {
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.6875rem;
    font-weight: 500;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.task-date {
    color: var(--text-tertiary);
    white-space: nowrap;
}

.task-date.overdue {
    color: var(--danger);
    font-weight: 500;
}

/* ===== FILTERS & CONTROLS ===== */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 0.75rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover, .filter-btn.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.tag-filter {
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 1rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tag-filter:hover, .tag-filter.active {
    background-color: var(--accent-primary);
    color: white;
}

.form-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
}

/* ===== STATISTICS ===== */
.stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-value {
    font-weight: 600;
    font-size: 1.125rem;
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--success);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-tertiary);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* ===== COLOR PICKER ===== */
.color-picker {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
}

.color-presets {
    display: flex;
    gap: 0.5rem;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.color-option:hover {
    transform: scale(1.2);
}

/* ===== SEARCH & HEADER ===== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-container {
    flex: 1;
    max-width: 400px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 0.75rem;
    color: var(--text-tertiary);
}

#search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-actions {
    position: absolute;
    right: 0.75rem;
}

/* ===== CALENDAR VIEW ===== */
.calendar-view {
    display: none;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
}

.calendar-view.active {
    display: block;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day {
    min-height: 100px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.calendar-tasks {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-task {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background-color: var(--accent-primary);
    color: white;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== QUICK ADD PANEL ===== */
.quick-add-panel {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    width: 300px;
    border: 1px solid var(--border-color);
}

.quick-add-panel.active {
    display: flex;
    gap: 0.5rem;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#quick-add-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background-color: var(--success);
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateX(150%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background-color: var(--danger);
}

.notification.warning {
    background-color: var(--warning);
}

/* ===== SWITCH TOGGLE ===== */
.switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    transition: background-color var(--transition-fast);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

input:checked + .slider {
    background-color: var(--accent-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.switch-label {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* ===== DRAG & DROP STYLES ===== */
.drag-ghost {
    opacity: 0.5;
    transform: rotate(5deg);
}

.drop-zone {
    min-height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
    transition: all var(--transition-fast);
}

.drop-zone.active {
    border-color: var(--accent-primary);
    background-color: rgba(79, 70, 229, 0.05);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        max-width: 100%;
    }
    
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    .main-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .header-actions {
        display: flex;
        gap: 0.5rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .quick-add-panel {
        width: calc(100% - 2rem);
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .sidebar,
    .main-content {
        padding: 1rem;
    }
    
    .modal-content {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}