/* MyGantt Web — Dark theme matching native app */

:root {
    --bg-deep: #0f0f1a;
    --bg-card: #13132a;
    --bg-input: #0f0f1a;
    --bg-hover: #1a1a2e;
    --border: #2a2a3e;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-muted: #555;
    --accent: #2563eb;
    --red: #ef4444;
    --red-light: #ff6b6b;
    --row-height: 44px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    padding: 16px 24px 12px;
    flex-shrink: 0;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
}

.header .subtitle {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 12px;
    flex-shrink: 0;
}

.filter-group {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.filter-btn {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 8px 16px;
    border: none;
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn.active {
    background: var(--accent);
    color: white;
}

.filter-btn:hover:not(.active) {
    color: var(--text-secondary);
}

.spacer { flex: 1; }

.btn-add {
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-add:hover { opacity: 0.85; }

/* Chart container */
.chart-wrapper {
    flex: 1;
    overflow: auto;
    margin: 0 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    position: relative;
}

.chart-scroll {
    display: flex;
    min-height: 100%;
}

/* Label column */
.label-col {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
}

.label-header {
    height: 68px;
    border-bottom: 1px solid var(--border);
}

.label-row {
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--row-height);
    padding: 0 8px 0 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border);
}

.label-row:hover { background: var(--bg-hover); }

.label-row.indent-1 { padding-left: 28px; }

/* Checkbox */
.checkbox {
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--text-muted);
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 9px;
    transition: all 0.15s;
}

.checkbox.checked {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

/* Expand/collapse chevron */
.chevron {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.label-info {
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.label-name {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-name.completed {
    color: var(--text-muted);
    text-decoration: line-through;
}

.label-name.parent { font-weight: 600; }

.label-meta {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 9px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.label-meta .cat-name { /* color set inline */ }
.label-meta .sep { color: var(--text-muted); }
.label-meta .due { color: var(--text-muted); }
.label-meta .due.overdue { color: var(--red-light); }

/* Timeline area */
.timeline-col {
    flex: 1;
    position: relative;
    min-width: 600px;
}

.timeline-header {
    height: 68px;
    position: relative;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.month-label {
    position: absolute;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 11px;
    color: var(--text-muted);
    top: 10px;
}

.week-label {
    position: absolute;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 9px;
    color: #444;
    top: 28px;
}

.day-label {
    position: absolute;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 8px;
    color: #333;
    top: 42px;
}

.grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
    opacity: 0.5;
}

.today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--red);
    z-index: 5;
}

.today-label {
    position: absolute;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 9px;
    font-weight: 600;
    color: var(--red);
    top: -16px;
    transform: translateX(-50%);
    z-index: 6;
}

/* Bars area */
.bars-area {
    position: relative;
}

.bar-row {
    height: var(--row-height);
    position: relative;
    border-bottom: 1px solid var(--border);
}

.bar {
    position: absolute;
    top: 10px;
    height: calc(var(--row-height) - 20px);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    transition: opacity 0.15s;
    overflow: hidden;
    white-space: nowrap;
}

.bar.completed { opacity: 0.4; }
.bar.overdue { opacity: 0.6; }

.bar:hover { filter: brightness(1.15); }

.bar .bar-date { font-size: 10px; }
.bar .overdue-icon { color: var(--red-light); margin-right: 2px; }

/* Drag handles */
.drag-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    background: rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity 0.15s;
}

.bar:hover .drag-handle { opacity: 1; }

.drag-handle.left {
    left: 0;
    border-radius: 6px 0 0 6px;
}

.drag-handle.right {
    right: 0;
    border-radius: 0 6px 6px 0;
}

/* Footer */
.footer {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 11px;
    color: var(--text-muted);
    padding: 10px 24px 16px;
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}

.footer .today-hint { color: var(--red); }
.footer .overdue-hint { color: var(--red-light); }

/* Category legend */
.legend {
    display: flex;
    gap: 16px;
    padding: 0 24px 8px;
    flex-shrink: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    min-width: 400px;
    max-width: 480px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.modal h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.form-field {
    margin-bottom: 14px;
}

.form-field label {
    display: block;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 11px;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--text-muted);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--accent);
}

.form-field textarea {
    height: 60px;
    resize: vertical;
}

.form-dates {
    display: flex;
    gap: 12px;
}

.form-dates .form-field { flex: 1; }

.form-buttons {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.btn {
    font-size: 14px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    flex: 1;
}

.btn-primary:hover { opacity: 0.85; background: var(--accent); }

.btn-danger {
    color: var(--red);
    border-color: var(--red);
}

.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* Empty state */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 14px;
    color: var(--text-muted);
}

/* Category color dot in form */
.cat-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
