:root {
    /* Color Palette - Premium Dark Mode */
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --bg-card: #252525;
    --primary: #bb86fc;
    --primary-variant: #3700b3;
    --secondary: #03dac6;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: #333333;
    --glass: rgba(30, 30, 30, 0.8);
    --danger: #ff5555;
    --success: #10b981;
    --warning: #f59e0b;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;

    /* Typography */
    --font-main: 'Poppins', sans-serif;

    /* Transitions */
    --transition-fast: 0.2s ease;
}

@font-face {
    font-family: Poppins;
    src: url("/css/Poppins/Poppins-Regular.ttf");
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-card) var(--bg-dark);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
    border: 1px solid var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

#app {
    display: flex;
    height: 100%;
}

/* Sidebar */
#sidebar {
    width: 250px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
}

.brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: var(--space-lg);
    padding-left: var(--space-sm);
}

.menu {
    list-style: none;
}

.menu li {
    margin-bottom: var(--space-sm);
}

.menu button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: var(--space-md);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.menu button:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.menu button.active {
    background-color: rgba(187, 134, 252, 0.1);
    color: var(--primary);
    font-weight: 600;
}

/* Main Content */
#content {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    position: relative;
}

/* Common Components */
h1 {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    color: var(--text-main);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
    color: var(--text-main);
}

h3 {
    font-size: 1.2rem;
    margin-bottom: var(--space-sm);
    color: var(--text-main);
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: background-color var(--transition-fast);
    color: var(--text-main);
    background: transparent;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

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

.btn-primary:hover {
    background-color: #a370f7;
}

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

.btn-danger:hover {
    background-color: rgba(255, 85, 85, 0.1);
}

.btn-sm {
    padding: 2px 6px;
    font-size: 0.8rem;
}

.card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Form Elements */
input,
textarea,
select {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: var(--space-md);
    color: var(--text-main);
    font-family: inherit;
    margin-bottom: var(--space-md);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Utility Classes */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.text-muted {
    color: var(--text-muted);
    opacity: 0.8;
}

.text-sm {
    font-size: 0.8rem;
}

.text-lg {
    font-size: 1.2rem;
}

.w-full {
    width: 100%;
}

.cursor-pointer {
    cursor: pointer;
}

/* Projects View */
.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-md);
}

.project-card {
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.project-card:hover {
    transform: translateY(-2px);
}

.project-status {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.project-desc {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
}

/* Project Detail View */
.project-detail-header {
    margin-bottom: var(--space-lg);
}

.project-title-input {
    font-size: 2rem;
    background: transparent;
    border: none;
    color: inherit;
    font-weight: bold;
    width: 100%;
    padding: 0;
    margin: 0;
}

.project-title-input:focus {
    border: none;
    outline: none;
    background: rgba(255, 255, 255, 0.05);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.detail-textarea {
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    resize: none;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    padding-bottom: var(--space-md);
}

.kanban-column {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: var(--space-md);
    border-radius: 8px;
    min-width: 250px;
}

.kanban-column.drag-over {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 2px var(--primary);
}

.column-header {
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--primary);
    padding-bottom: var(--space-sm);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 50px;
}

.task-card {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    position: relative;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

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

.task-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: 5px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

/* Labels */
.labels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
}

.label-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-left-width: 5px;
    border-left-style: solid;
}

.label-pattern-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.label-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* Notes */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-md);
}

.note-card {
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.note-card:hover {
    transform: translateY(-2px);
}

.labels-container {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.label-tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Editor */
.editor-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-panel);
    border-radius: 12px;
    padding: var(--space-lg);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.editor-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
}

.editor-title:focus {
    outline: none;
}

/* Quill Dark Theme Overrides */
#editor-wrapper {
    height: 60vh;
    border: 1px solid var(--border) !important;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px 8px 0 0;
}

.ql-container.ql-snow {
    border: none !important;
    flex: 1;
    overflow-y: auto;
}

.ql-snow .ql-stroke {
    stroke: var(--text-muted) !important;
}

.ql-snow .ql-fill {
    fill: var(--text-muted) !important;
}

.ql-snow .ql-picker {
    color: var(--text-muted) !important;
}

.ql-snow .ql-picker-options {
    background-color: var(--bg-panel) !important;
    border: 1px solid var(--border) !important;
}

.ql-snow .ql-active .ql-stroke,
.ql-snow .ql-active .ql-fill,
.ql-snow .ql-picker:hover {
    stroke: var(--primary) !important;
    fill: var(--primary) !important;
    color: var(--primary) !important;
}

.ql-editor {
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
    padding: var(--space-md);
}

.ql-editor.ql-blank::before {
    color: rgba(255, 255, 255, 0.2) !important;
    font-style: italic;
}

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

.modal-content {
    width: 400px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-sm);
    margin-bottom: 1.5rem;
}

.color-swatch {
    width: 100%;
    padding-top: 100%;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-swatch[data-selected="true"] {
    border-color: #fff;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--space-sm);
    margin-bottom: 1.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.icon-option {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
}

.icon-option:hover,
.icon-option[data-selected="true"] {
    background: rgba(255, 255, 255, 0.2);
}

.pattern-selector {
    display: flex;
    gap: var(--space-md);
    margin-bottom: 1.5rem;
}

.pattern-option {
    flex: 1;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pattern-option[data-selected="true"] {
    border-color: #fff;
}


@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* --- TIMELINE --- */

.timeline-container {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    position: relative;
}

.timeline-track {
    position: relative;
    min-width: 100%;
}

.timeline-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.timeline-month-label {
    position: absolute;
    top: -20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    transform: translateX(5px);
}

.timeline-week-label {
    position: absolute;
    top: 5px;
    font-size: 0.7rem;
    color: var(--text-muted);
    transform: translateX(5px);
    opacity: 0.7;
}

.timeline-bar {
    position: absolute;
    height: 30px;
    background: var(--primary);
    border-radius: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: white;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s;
}

.timeline-bar:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.timeline-bar:active {
    cursor: grabbing;
}

.timeline-bar-content {
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-delete-part {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    margin-left: 5px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-delete-part:hover {
    opacity: 1;
    color: var(--danger);
}

.timeline-bar.part-bar {
    height: 24px;
    opacity: 0.9;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.timeline-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: col-resize;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s;
}

.timeline-bar-name {
    cursor: pointer;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-bar-name:hover {
    text-decoration: underline;
}

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

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

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

.timeline-today-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--secondary);
    z-index: 0;
    pointer-events: none;
    box-shadow: 0 0 8px var(--secondary);
}

.timeline-today-marker::after {
    content: 'Today';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--secondary);
    color: #000;
    padding: 0px 3px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-top: 10px;
}

.timeline-date-tooltip {
    position: fixed;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-main);
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -100%);
    margin-top: -10px;
    display: none;
}

/* Checklist Styles */
.checklist-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.checklist-checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.checklist-checkbox:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checklist-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 12px;
    font-weight: bold;
}

.checklist-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    padding: 4px;
    font-family: inherit;
    margin-bottom: 0;
    /* Override default input margin */
}

.checklist-input:focus {
    background: rgba(255, 255, 255, 0.05);
    outline: none;
}

.checklist-input.done {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Sync Status */
#sync-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: auto;
    /* Push to bottom */
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

#sync-status.syncing {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    animation: pulse 1s infinite;
}

#sync-status.success {
    background-color: var(--success);
    box-shadow: 0 0 5px var(--success);
}

#sync-status.error {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Global Milestones */
.timeline-global-milestone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    /* Wider hit area */
    pointer-events: auto;
    z-index: 5;
}

.timeline-global-milestone:hover {
    z-index: 25;
}

.milestone-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.milestone-flag {
    position: absolute;
    top: 0;
    left: 50%;
    width: 12px;
    height: 12px;
    clip-path: polygon(100% 0, 100% 100%, 50% 70%, 0 100%, 0 0);
    /* Banner shape */
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 2;
    transform: translateX(-50%);
}

.timeline-global-milestone:hover .milestone-flag {
    transform: translateX(-50%) scale(1.4);
}

.milestone-label {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    transform-origin: center;
    white-space: nowrap;
    font-size: 0.7rem;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s, font-weight 0.2s;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background-color: #000;
    transition-property: transform;
    transition-duration: 1s;
    transition-delay: 0s;
}

.milestone-label:hover {
    transform: translateX(-50%) rotate(0deg);
}

.timeline-global-milestone:hover .milestone-label {
    opacity: 1;
    font-weight: bold;
}

/* Priority Areas */
.priority-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 4px;
}

.priority-area-section {
    margin-bottom: 2rem;
}

.priority-area-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.priority-area-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.priority-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.priority-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border-top: 4px solid var(--primary);
}

.modal-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-main);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}