/* ============================================
   PROJECT TIMELINE MANAGER - BASE STYLES
   Structural and layout styles (theme-independent)
   ============================================ */

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

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header */
.app-header {
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.app-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.project-name-editable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Buttons */
.btn {
    transition: all 0.2s ease;
}

.btn-primary {
    border: none;
    font-weight: 500;
}

.btn-outline-primary {
    background: transparent;
    font-weight: 500;
}

.btn-outline-secondary {
    background: transparent;
    font-weight: 500;
}

.btn-secondary {
    font-weight: 500;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    padding: 4px;
    transition: all 0.2s ease;
}

/* Panels */
.panel-card {
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.panel-header {
    padding: 16px 20px;
}

.panel-header h5 {
    font-weight: 600;
    font-size: 1rem;
}

.panel-header .material-icons {
    font-size: 20px;
}

/* Category List */
.category-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.category-group {
    border-bottom: 1px solid;
}

.category-group:last-child {
    border-bottom: none;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.category-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.collapse-icon {
    font-size: 20px;
    transition: transform 0.2s ease;
}

.category-color-indicator {
    width: 3px;
    height: 20px;
    border-radius: 2px;
}

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

.task-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.category-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-header:hover .category-actions {
    opacity: 1;
}

.category-tasks {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-tasks.collapsed {
    max-height: 0;
}

/* Task Items */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 12px 40px;
    border-top: 1px solid;
    transition: all 0.2s ease;
}

.task-info {
    flex: 1;
}

.task-name {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.task-dates {
    font-size: 0.8rem;
    font-family: 'IBM Plex Mono', monospace;
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-dates .material-icons {
    font-size: 14px;
}

.progress-container {
    margin-top: 8px;
    position: relative;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-custom {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.task-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

/* Gantt Chart Container */
.gantt-container {
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    min-height: 500px;
    max-height: calc(100vh - 280px);
    border-radius: 6px;
    padding: 20px;
    border: 1px solid;
}

/* Ensure timeline scrolls horizontally */
.gantt-container::-webkit-scrollbar {
    height: 12px;
}

.gantt-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
}

.gantt-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
}

.gantt-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Timeline Header */
.gantt-timeline {
    border-bottom: 2px solid;
    margin-bottom: 16px;
    padding-bottom: 12px;
    min-width: max-content;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
}

/* Multi-level Timeline Header */
.timeline-header-multi {
    display: flex;
    flex-direction: column;
    min-width: max-content;
}

.timeline-row {
    display: flex;
    width: 100%;
    min-width: max-content;
}

.timeline-row-years {
    border-bottom: 1px solid var(--border);
}

.timeline-row-months {
    border-bottom: 1px solid var(--border);
}

.timeline-row-weeks {
    border-bottom: 1px solid var(--border);
}

.timeline-row-quarters {
    border-bottom: 1px solid var(--border);
}

.timeline-row-days {
    /* Last row - no border-bottom */
}

.timeline-cell {
    text-align: center;
    font-weight: 600;
    font-family: 'IBM Plex Mono', monospace;
    border-right: 1px solid var(--border);
    padding: 6px 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: fit-content;
}

.timeline-cell:last-child {
    border-right: none;
}

/* Year cells */
.timeline-year {
    font-size: 0.95rem;
    padding: 10px 8px;
    background: var(--bg-tertiary);
    font-weight: 700;
}

/* Month cells */
.timeline-month {
    font-size: 0.85rem;
    padding: 8px 12px;
    background: var(--bg-secondary);
    min-width: fit-content;
}

/* Week cells */
.timeline-week {
    font-size: 0.75rem;
    padding: 6px 8px;
    background: var(--bg-card);
    min-width: 120px;
    flex-shrink: 0;
}

/* Quarter cells */
.timeline-quarter {
    font-size: 0.85rem;
    padding: 8px 12px;
    background: var(--bg-secondary);
    min-width: 80px;
    flex-shrink: 0;
}

/* Day cells */
.timeline-day {
    font-size: 0.7rem;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-card);
    min-width: 50px;
    flex-shrink: 0;
}

.timeline-day-weekday {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.7;
    white-space: nowrap;
}

.timeline-day-number {
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.timeline-weekend {
    background: var(--bg-weekend, var(--bg-tertiary));
    opacity: 0.85;
}

/* Old single-level timeline (fallback) */
.timeline-column {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px;
    border-right: 1px solid;
    font-family: 'IBM Plex Mono', monospace;
}

.timeline-column:last-child {
    border-right: none;
}

/* Gantt Bars Container */
.gantt-bars {
    position: relative;
    min-width: max-content;
}

.gantt-category-row {
    display: flex;
    align-items: center;
    height: 40px;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.category-toggle {
    padding: 0 12px;
    display: flex;
    align-items: center;
    z-index: 2;
    position: relative;
}

.category-toggle .material-icons {
    font-size: 20px;
}

.category-label {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 12px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
    position: relative;
}

.task-count {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Category Progress Bar */
.category-progress-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 24px;
    border-radius: 4px;
    opacity: 0.4;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

.category-progress-text {
    position: relative;
    z-index: 2;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-family: 'IBM Plex Mono', monospace;
}

.gantt-row {
    position: relative;
    height: 50px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.gantt-bar {
    position: absolute;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gantt-bar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.2);
}

.gantt-bar-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px 0 0 6px;
    transition: width 0.3s ease;
    border-right: 2px solid rgba(255, 255, 255, 0.4);
}

.gantt-bar-text {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Modals */
.modal-content {
    border: 1px solid;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid;
}

.modal-title {
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid;
}

.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-range {
    height: 6px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .material-icons {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    border-radius: 5px;
    border: 2px solid;
}

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

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

.gap-2 {
    gap: 0.5rem;
}

.align-middle {
    vertical-align: middle;
}

/* Responsive */
@media (max-width: 768px) {
    .gantt-container {
        padding: 12px;
    }

    .gantt-timeline,
    .gantt-bars {
        min-width: 800px;
    }

    .task-actions,
    .category-actions {
        opacity: 1;
    }
}

/* Today Date Indicator */
.today-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #ef4444;
    z-index: 5;
    pointer-events: none;
}

.today-indicator::before {
    content: 'TODAY';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ef4444;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.today-indicator::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

/* Theme Selector */
.theme-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-select {
    min-width: 150px;
    font-size: 0.875rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Projects List */
.projects-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 12px;
}

.project-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.project-list-item:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.project-list-item.active {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.project-info {
    flex: 1;
}

.project-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.project-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.project-actions {
    display: flex;
    gap: 8px;
}

.project-actions .btn {
    font-size: 0.75rem;
    padding: 4px 12px;
}
