/* Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

/* Dark Mode */
body.dark-mode {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.3);
}

body.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.8);
}

body.dark-mode .modal {
    background: var(--bg-card);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(2, 2, 2, .6);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-bottom: 2px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    margin-top: 4px;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.sidebar-header > div:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(2, 2, 2, .6);
    color: white;
    border-radius: .25vh;
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(2, 2, 2, .8);
    border-color: white;
    transform: scale(1.05);
}

.categories-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.category-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: rgba(2, 2, 2, .6);
    border: 1px solid transparent;
    border-radius: .25vh;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.category-item:hover {
    border-color: white;
}

.category-item.active {
    background: rgba(2, 2, 2, .8);
    color: white;
    border-color: white;
}

.category-icon {
    font-size: 1.5rem;
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 600;
    font-size: 1rem;
}

.category-count {
    font-size: 0.875rem;
    opacity: 0.8;
}

.category-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-radius: .25vh;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.category-item:hover .category-delete {
    display: flex;
}

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

.container {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(2, 2, 2, .6);
    border-left: white 2px solid;
    padding: 2rem;
    box-shadow: var(--shadow);
    z-index: 100;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: white;
}

.add-task-container {
    display: flex;
    gap: 1rem;
    max-width: 1000px;
    align-items: center;
}

.task-type-selector {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(2, 2, 2, .6);
    border-radius: .25vh;
    border: 1px solid transparent;
}

.type-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: .25vh;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.type-btn:hover {
    background: rgba(2, 2, 2, .8);
    color: white;
}

.type-btn.active {
    background: rgba(2, 2, 2, .8);
    color: white;
}

.task-input {
    flex: 1;
    padding: 1.3em 1.5rem;
    font-size: 1rem;
    background-color: rgba(2, 2, 2, .7);
    border: none;
    border-radius: .25vh;
    outline: none;
    transition: all 0.3s;
}

.task-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    color: white;
    font-weight: 500;
}

.btn-add {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(2, 2, 2, .6);
    color: white;
    border: 1px solid transparent;
    border-radius: .25vh;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-add:hover {
    background: rgba(2, 2, 2, .8);
    border-color: white;
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--border);
}

/* Board */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 2rem;
    flex: 1;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    background: rgba(2, 2, 2, .6);
    border-top: white 2px solid;
    border-left: white 2px solid;
}

/* Column */
.column {
    background: var(--bg-card);
    border-radius: .25vh;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100vh - 250px);
}

.column-header {
    padding: 1.5rem;
    background: rgba(2, 2, 2, .8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.column-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.task-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.15rem 0.65rem;
    border-radius: .25vh;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Column Content */
.column-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    min-height: 200px;
    color: white;
}

.column-content:empty::before {
    content: 'Glissez vos tâches ici';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    font-style: italic;
}

/* Task Card */
.task-card {
    color: white;
    background: rgba(2, 2, 2, .6);
    border: 2px solid transparent;
    border-radius: .25vh;
    padding: 1.25rem;
    margin-bottom: 1rem;
    cursor: grab;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.task-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.task-image-container {
    margin: 0.75rem 0;
    border-radius: .25vh;
    overflow: hidden;
    max-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-image-container img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    display: block;
    cursor: pointer;
    transition: transform 0.3s;
}

.task-image-container img:hover {
    transform: scale(1.02);
}

.task-file-container {
    margin: 0.75rem 0;
    padding: 1rem;
    border-radius: .25vh;
    background: rgba(2, 2, 2, .6);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.task-file-container:hover {
    border-color: var(--primary);
}

.task-file-icon {
    font-size: 2rem;
}

.task-file-info {
    flex: 1;
}

.task-file-name {
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.task-file-size {
    font-size: 0.875rem;
    color: var(--text-light);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.task-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    word-break: break-word;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.task-card:hover .task-actions {
    opacity: 1;
}

.task-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(2, 2, 2, .6);
    color: white;
    border-radius: .25vh;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.task-btn:hover {
    background: var(--primary);
    color: white;
}

.task-btn.delete:hover {
    background: var(--danger);
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.task-creator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: .25vh;
    font-size: 0.7rem;
    color: #818cf8;
    font-weight: 500;
}

.creator-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(99, 102, 241, 0.5);
}

.creator-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(2, 2, 2, .4);
    border-radius: .25vh;
    font-size: 0.75rem;
    color: white;
}

.subtasks-container {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(2, 2, 2, .8);
    border-radius: .25vh;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: relative;
    transition: all 0.3s ease;
}

input[type="checkbox"]:hover {
    border-color: rgb(255, 255, 255);
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    animation: checkmark 0.3s ease;
}

@keyframes checkmark {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.subtask-item.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.subtask-progress {
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.task-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: white;
}

/* Scrollbar */
.column-content::-webkit-scrollbar {
    width: 8px;
}

.column-content::-webkit-scrollbar-track {
    background: transparent;
}

.column-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.column-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Responsive */
@media (max-width: 1200px) {
    .board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .column:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .board {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .header {
        padding: 1.5rem 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .add-task-container {
        flex-direction: column;
    }
    
    .btn-add {
        width: 100%;
    }
    
    .column {
        min-height: 300px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-card {
    animation: fadeIn 0.3s ease-out;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(2, 2, 2, .8);
    border-radius: .25vh;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg);
    color: var(--text);
    border-radius: .25vh;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 1.5rem;
}

.modal-input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    height: auto;
    border: 1px solid transparent;
    background: rgba(2, 2, 2, .8);
    border-radius: .25vh;
    outline: none;
    transition: all 0.3s;
    margin-bottom: 1rem;
    font-family: inherit;
    resize: vertical;
}

.modal-input:focus {
    border-color: white;
    color: white
}

textarea.modal-input {
    min-height: 100px;
}

.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.emoji-btn {
    width: 48px;
    height: 48px;
    border: 1px solid transparent;
    background: rgba(2, 2, 2, .8);
    border-radius: .25vh;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    line-height: 48px;
}

.emoji-btn:hover {
    transform: scale(1.1);
    border-color: white;
    color: white;
}

.emoji-btn.active {
    border-color: white;
    background-color: rgba(2, 2, 2, .8);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid white;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Category Move Menu */
.category-move-btn {
    width: 100%;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: var(--text);
}

.category-move-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(5px);
}

.category-move-btn .category-icon {
    font-size: 1.5rem;
}

.subtasks-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.subtask-input-group {
    display: flex;
    gap: 0.5rem;
}

.subtask-input-group .modal-input {
    margin-bottom: 0;
}

.subtask-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(2, 2, 2, .8);
    border-radius: .25vh;
    margin-bottom: 0.5rem;
    color: white;
}

.subtask-list-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.subtask-text {
    flex: 1;
}

.subtask-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

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

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: #10b981;
    color: white;
}

.notification-error {
    background: #ef4444;
    color: white;
}

.notification-info {
    background: var(--primary);
    color: white;
}

.notification-warning {
    background: #f59e0b;
    color: white;
}

/* Image upload */
.tab-btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-light);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.file-input {
    width: 100%;
    padding: 1rem;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
    transition: all 0.3s;
}

.file-input:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.image-preview {
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    max-height: 300px;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.upload-progress {
    margin-top: 1rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
    animation: progress-indeterminate 1.5s infinite;
}

@keyframes progress-indeterminate {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 40%; margin-left: 30%; }
    100% { width: 0%; margin-left: 100%; }
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-light);
}
