/* /public/styles.css */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --bg-tertiary: #3a3a3a;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent-primary: #4a90e2;
    --accent-secondary: #50e3c2;
    --accent-danger: #e24a4a;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    --border-radius: 8px;
    --border-color: #444;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f2f5;
    --bg-tertiary: #e4e6eb;
    --text-primary: #1c1e21;
    --text-secondary: #606770;
    --accent-primary: #1877f2;
    --accent-secondary: #42b72a;
    --accent-danger: #e02c4f;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --border-color: #dddfe2;
}

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

html, body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
}

#app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* --- Sidebar --- */
#sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

#sidebar.collapsed {
    width: 80px;
}

#sidebar.collapsed #sidebar-header h1,
#sidebar.collapsed #sidebar-nav .nav-text,
#sidebar.collapsed #theme-switcher .switch-label,
#sidebar.collapsed #connection-status,
#sidebar.collapsed #project-title {
    display: none;
}

#sidebar.collapsed #sidebar-header {
    justify-content: center;
}

#sidebar.collapsed #sidebar-nav a {
    justify-content: center;
}

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

#sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

#toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}
#toggle-sidebar:hover { color: var(--text-primary); }

#project-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar-nav {
    list-style-type: none;
    flex-grow: 1;
}

#sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

#sidebar-nav a:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

#sidebar-nav a.active {
    background-color: var(--accent-primary);
    color: white;
}

#sidebar-nav a .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

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

#connection-status {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 15px;
    white-space: nowrap;
}
.status-synced { color: var(--accent-secondary); }
.status-saving { color: var(--accent-primary); }
.status-error { color: var(--accent-danger); }

#theme-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input { display: none; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-tertiary);
    transition: .4s;
    border-radius: 26px;
}

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

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

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

/* --- Main Content --- */
#main-content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 30px;
}

.view {
    display: none;
}
.view.active {
    display: block;
}

/* --- Common Section Styles --- */
.content-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

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

.section-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.section-body {
    padding: 25px;
}

/* --- Form Elements --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* --- Buttons --- */
.btn {
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}
.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn-secondary:hover {
    filter: brightness(1.2);
}

.btn-danger {
    background-color: var(--accent-danger);
    color: white;
}
.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-small {
    padding: 5px 10px;
    font-size: 13px;
}

/* --- Tables & Lists --- */
.item-list {
    list-style-type: none;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.list-item:hover {
    background-color: var(--bg-tertiary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.item-detail {
    font-size: 14px;
    color: var(--text-secondary);
}

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

/* --- Dashboard --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-change {
    font-size: 14px;
}
.stat-change.positive { color: var(--accent-secondary); }
.stat-change.negative { color: var(--accent-danger); }

/* --- Kanban Board --- */
#kanban-board {
    display: flex;
    gap: 20px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 20px;
}

.kanban-column {
    width: 300px;
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

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

.kanban-column-title {
    font-weight: 600;
    color: var(--text-primary);
}

.task-count {
    font-size: 14px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
}

.kanban-tasks {
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kanban-task {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 15px;
    box-shadow: var(--shadow);
    cursor: grab;
    transition: background-color 0.2s;
}

.kanban-task:hover {
    background-color: var(--bg-tertiary);
}

.kanban-task-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.task-priority {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: capitalize;
}
.priority-low { background-color: rgba(80, 227, 194, 0.2); color: var(--accent-secondary); }
.priority-medium { background-color: rgba(245, 166, 35, 0.2); color: #f5a623; }
.priority-high { background-color: rgba(226, 74, 74, 0.2); color: var(--accent-danger); }

.task-assignee {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 1px var(--border-color);
}

.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.drag-over {
    background-color: var(--bg-tertiary);
    border: 2px dashed var(--accent-primary);
}

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

.modal-backdrop.active {
    display: flex; /* Added this class to show */
}

.modal {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

#close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

/* Utility */
.text-danger { color: var(--accent-danger); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent-primary); }
.font-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}
.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
}
.empty-state p {
    font-size: 16px;
}
