/**
 * EE Project Timeline (Gantt Chart)
 *
 * Dark theme styling for the Gantt timeline in the Project View popup.
 * Matches the existing EE dark theme (bg #0f172a, surfaces #1e293b).
 *
 * @since 2.25.0
 */

/* ------------------------------------------------------------------ */
/* Container                                                          */
/* ------------------------------------------------------------------ */

.ee-timeline-wrap {
    margin-top: 24px;
    padding: 20px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
}

.ee-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ee-timeline-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ------------------------------------------------------------------ */
/* Project Start Datepicker                                           */
/* ------------------------------------------------------------------ */

.ee-timeline-start-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 16px;
}

.ee-timeline-start-label {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
    cursor: default;
}

.ee-timeline-start-input {
    padding: 4px 8px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 5px;
    color: #f1f5f9;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s;
    width: 130px;
    cursor: pointer;
}

.ee-timeline-start-input:focus {
    border-color: #3b82f6;
}

.ee-timeline-start-input:hover {
    border-color: #64748b;
}

.ee-timeline-start-input:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Dark theme calendar icon */
.ee-timeline-start-input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.ee-timeline-start-info {
    font-size: 12px;
    color: #94a3b8;
    margin-left: 16px;
    white-space: nowrap;
}

.ee-timeline-completion {
    font-size: 13px;
    color: #94a3b8;
    margin-left: auto;
}
.ee-timeline-completion strong {
    color: #22c55e;
    font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Verfahrens-Switch                                                  */
/* ------------------------------------------------------------------ */

.ee-verfahren-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    border-radius: 8px;
}

.ee-verfahren-label {
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
}

.ee-verfahren-pills {
    display: flex;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 8px;
    overflow: hidden;
}

.ee-verfahren-pill {
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    white-space: nowrap;
}

.ee-verfahren-pill:first-child {
    border-right: 1px solid #475569;
}

.ee-verfahren-pill:hover {
    color: #e2e8f0;
    background: rgba(59, 130, 246, 0.1);
}

.ee-verfahren-pill.active {
    background: #3b82f6;
    color: #fff;
    font-weight: 600;
}

.ee-verfahren-hint {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    margin-left: auto;
}

/* ------------------------------------------------------------------ */
/* Legend                                                              */
/* ------------------------------------------------------------------ */

.ee-gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    padding: 8px 0;
}

.ee-gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.ee-gantt-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ee-gantt-legend-bar {
    width: 24px;
    height: 8px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

.ee-gantt-legend-bar.planned {
    background: rgba(100, 116, 139, 0.3);
    border: 1px dashed #64748b;
}

.ee-gantt-legend-bar.real {
    background: #3b82f6;
}

/* ------------------------------------------------------------------ */
/* SVG Gantt Chart                                                    */
/* ------------------------------------------------------------------ */

.ee-gantt-container {
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    scrollbar-width: thin;
    scrollbar-color: #475569 #0f172a;
}

.ee-gantt-container::-webkit-scrollbar {
    height: 8px;
}

.ee-gantt-container::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.ee-gantt-container::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.ee-gantt-svg {
    display: block;
    min-width: 100%;
}

/* Phase label text */
.ee-gantt-label {
    fill: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    user-select: none;
}

/* Week column headers */
.ee-gantt-week-header {
    fill: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    user-select: none;
}

/* Month header */
.ee-gantt-month-header {
    fill: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    user-select: none;
}

/* Grid lines */
.ee-gantt-gridline {
    stroke: rgba(51, 65, 85, 0.5);
    stroke-width: 1;
}

.ee-gantt-gridline-month {
    stroke: #475569;
    stroke-width: 1.5;
}

/* Row background stripes */
.ee-gantt-row-bg {
    fill: transparent;
}

/* ------------------------------------------------------------------ */
/* Bars                                                               */
/* ------------------------------------------------------------------ */

/* Planned bar (colored, transparent, dashed) */
.ee-gantt-bar-planned {
    cursor: pointer;
    transition: fill 0.15s, stroke 0.15s;
}

.ee-gantt-bar-planned:hover {
    filter: brightness(1.3);
}

/* Real bar (solid, overlays planned) */
.ee-gantt-bar-real {
    cursor: pointer;
    transition: opacity 0.15s, filter 0.15s;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.ee-gantt-bar-real:hover {
    filter: brightness(1.15) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

/* Drag handles — visible on phase group hover */
.ee-gantt-handle {
    opacity: 0;
    cursor: ew-resize;
    transition: opacity 0.2s;
    pointer-events: all;
}

/* Show handles when hovering on the phase group */
g[id^="phase-"]:hover .ee-gantt-handle {
    opacity: 0.7;
}

.ee-gantt-handle:hover {
    opacity: 1 !important;
}

/* Active dragging state */
.ee-gantt-bar-planned.dragging {
    filter: brightness(1.4);
    stroke-width: 2;
}

/* ------------------------------------------------------------------ */
/* Today line                                                         */
/* ------------------------------------------------------------------ */

.ee-gantt-today-line {
    stroke: #ef4444;
    stroke-width: 2;
    stroke-dasharray: 6 4;
}

.ee-gantt-today-label {
    fill: #ef4444;
    font-size: 10px;
    font-weight: 700;
    user-select: none;
}

/* ------------------------------------------------------------------ */
/* Tooltip                                                            */
/* ------------------------------------------------------------------ */

.ee-gantt-tooltip {
    position: fixed;
    z-index: 100001;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: 260px;
    white-space: nowrap;
}

.ee-gantt-tooltip strong {
    color: #f8fafc;
    font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Phase Detail Popup                                                 */
/* ------------------------------------------------------------------ */

.ee-tl-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ee-tl-fadein 0.15s ease;
}

@keyframes ee-tl-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ee-tl-popup {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 12px;
    padding: 24px;
    min-width: 340px;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    color: #f1f5f9;
}

.ee-tl-popup-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ee-tl-popup-title .ee-tl-phase-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ee-tl-popup-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.ee-tl-popup-field {
    flex: 1;
}

.ee-tl-popup-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 4px;
}

.ee-tl-popup-field input[type="date"],
.ee-tl-popup-field input[type="number"],
.ee-tl-popup-field textarea {
    width: 100%;
    padding: 8px 10px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.ee-tl-popup-field input:focus,
.ee-tl-popup-field textarea:focus {
    border-color: #3b82f6;
}

.ee-tl-popup-field textarea {
    resize: vertical;
    min-height: 60px;
}

.ee-tl-popup-field .ee-tl-real-info {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
    font-style: italic;
}

.ee-tl-popup-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.ee-tl-popup-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.ee-tl-btn-cancel {
    background: #334155;
    color: #e2e8f0;
}

.ee-tl-btn-cancel:hover {
    background: #475569;
}

.ee-tl-btn-save {
    background: #3b82f6;
    color: #fff;
}

.ee-tl-btn-save:hover {
    background: #2563eb;
}

/* Read-only mode */
.ee-tl-popup-field input[readonly],
.ee-tl-popup-field textarea[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Duration badge on bar                                              */
/* ------------------------------------------------------------------ */

.ee-gantt-bar-duration {
    fill: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 768px) {
    .ee-timeline-wrap {
        padding: 12px;
    }

    .ee-verfahren-switch {
        flex-wrap: wrap;
    }

    .ee-verfahren-hint {
        width: 100%;
        margin-left: 0;
    }

    .ee-tl-popup {
        min-width: 280px;
        padding: 16px;
    }

    .ee-gantt-legend {
        gap: 10px;
    }
}

/* ------------------------------------------------------------------ */
/* Account Richtwerte Tab                                             */
/* ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ */
/* Defaults Gantt — Settings Tab                                      */
/* ------------------------------------------------------------------ */

.ee-def-verfahren-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--surface-secondary, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
}

.ee-def-verfahren-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    white-space: nowrap;
}

/* Re-use existing .ee-verfahren-pills for light theme override */
.ee-def-verfahren-switch .ee-verfahren-pills {
    background: var(--surface-primary, #fff);
    border: 1px solid var(--border-color, #cbd5e1);
}

.ee-def-verfahren-switch .ee-verfahren-pill {
    color: var(--text-secondary, #64748b);
}

.ee-def-verfahren-switch .ee-verfahren-pill:first-child {
    border-right: 1px solid var(--border-color, #cbd5e1);
}

.ee-def-verfahren-switch .ee-verfahren-pill.active {
    background: var(--primary-color, #3b82f6);
    color: #fff;
}

.ee-def-verfahren-switch .ee-verfahren-pill:hover:not(.active) {
    color: var(--text-primary, #1e293b);
    background: rgba(59, 130, 246, 0.08);
}

/* Gantt container in light theme context */
.ee-def-gantt-container {
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--surface-primary, #fff);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.ee-def-gantt-container::-webkit-scrollbar {
    height: 8px;
}

.ee-def-gantt-container::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.ee-def-gantt-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.ee-def-gantt-svg .ee-gantt-label {
    fill: var(--text-primary, #1e293b);
}

.ee-def-gantt-svg .ee-gantt-week-header {
    fill: var(--text-secondary, #64748b);
}

.ee-def-gantt-svg .ee-gantt-month-header {
    fill: var(--text-primary, #334155);
}

.ee-def-gantt-svg .ee-gantt-gridline {
    stroke: rgba(226, 232, 240, 0.8);
}

.ee-def-gantt-svg .ee-gantt-gridline-month {
    stroke: #cbd5e1;
}

.ee-def-gantt-svg .ee-gantt-row-bg {
    fill: transparent;
}

.ee-def-gantt-svg .ee-gantt-bar-duration {
    fill: #1e293b;
    text-shadow: none;
}

/* Save row */
.ee-def-save-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.ee-tl-defaults-save {
    padding: 8px 20px;
    background: var(--primary-color, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.ee-tl-defaults-save:hover {
    opacity: 0.9;
}

.ee-tl-defaults-status {
    font-size: 13px;
    color: var(--text-secondary, #94a3b8);
}
