:root {
    --sidebar-bg: #1e1f21;
    --sidebar-text: #b3b3b3;
    --sidebar-hover: #2d2e30;
    --sidebar-active: #3d3e40;
    --main-bg: #f5f7f9;
    --board-bg: #f5f7f9;
    --list-bg: #ebedf0;
    --task-bg: #ffffff;
    --primary-color: #7b68ee;
    --primary-hover: #6a5acd;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --radius: 6px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--main-bg);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

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

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

#add-workspace-btn {
    background: none;
    border: 1px solid var(--sidebar-text);
    color: var(--sidebar-text);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#add-workspace-btn:hover {
    background: var(--sidebar-text);
    color: var(--sidebar-bg);
}

.workspace-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.workspace-item {
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.workspace-item:hover {
    background-color: var(--sidebar-hover);
}

.workspace-item.active {
    background-color: var(--sidebar-active);
    color: white;
}

.workspace-item .delete-ws {
    opacity: 0;
    background: none;
    border: none;
    color: #ff4d4f;
    cursor: pointer;
    font-size: 0.8rem;
}

.workspace-item:hover .delete-ws {
    opacity: 1;
}

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

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

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.view-toggle {
    display: flex;
    background: #eee;
    padding: 4px;
    border-radius: var(--radius);
}

.view-toggle button {
    border: none;
    background: none;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 4px;
}

.view-toggle button.active {
    background: white;
    box-shadow: var(--shadow);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-bar select {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.tag-filter-container {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

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

.btn-secondary {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Board */
.board {
    flex: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow-x: auto;
    align-items: flex-start;
}

.list-container {
    width: 300px;
    background-color: var(--list-bg);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    box-shadow: var(--shadow);
}

.list-header {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.list-title {
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
}

.delete-list {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.delete-list:hover {
    color: #ff4d4f;
}

.tasks-container {
    padding: 0 10px 10px 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 50px;
}

.task-card {
    background-color: var(--task-bg);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
}

.task-card:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.task-content {
    font-size: 0.9rem;
    outline: none;
    margin-bottom: 8px;
    display: block;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-status {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eee;
    cursor: pointer;
    user-select: none;
}

.status-todo { background: #dfe4ea; color: #57606f; }
.status-inprogress { background: #fff4d1; color: #b8860b; }
.status-done { background: #d1fadf; color: #2d6a4f; }

.delete-task {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
}

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

.add-task-area {
    padding: 10px;
}

.add-task-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
}

/* List View Table */
.list-view-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.list-view-table th, .list-view-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.list-view-table th {
    background: #f8f9fa;
    font-weight: 600;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-content h3 {
    margin-bottom: 8px;
}

#modal-input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Task Detail Modal */
.task-detail-container {
    background: white;
    width: 600px;
    max-height: 90vh;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

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

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

.td-title-input {
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    outline: none;
    width: 80%;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.task-detail-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.td-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.td-section label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.td-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: vertical;
    font-family: inherit;
}

.td-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.td-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.td-field label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.td-field select, .td-field input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

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

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

.subtasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #f9f9f9;
    border-radius: 4px;
}

.subtask-content {
    flex: 1;
    outline: none;
    font-size: 0.9rem;
}

.tag-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-chip {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    border: 2px solid transparent;
    user-select: none;
}

.tag-chip.selected {
    border-color: #333;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-item {
    background: #f5f7f9;
    padding: 10px;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.comment-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.comment-input-area {
    display: flex;
    gap: 8px;
}

.comment-input-area input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}
