/* ===========================
   LiveOps Gantt Chart - UX States (Phase 1 Enhanced)
   Shared styles for empty, init, loading, and rendered states
   Based on experiments/new-version
   =========================== */

/* ===========================
   CSS VARIABLES
   =========================== */
:root {
    --primary-color: #764ba2;
    --primary-color-rgb: 193, 150, 255;
    --gradient-start: #c196ff;
    --gradient-end: #764ba2;
    --page-background: #f7f9ff;
}

/* ===========================
   ROOT CONTAINER
   =========================== */
.liveops-gantt-root {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--page-background);
}

.highcharts-background{
    fill: var(--page-background) !important;
}

.highcharts-scrollable-mask {
    fill: var(--page-background) !important;
}

/* ===========================
   CHART CONTROLS (Phase 1)
   =========================== */
.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chart-controls.visible {
    opacity: 1;
    pointer-events: auto;
}

.chart-controls-title {
    font-family: 'Lato', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chart-title-text {
    display: inline-block;
}

.chart-title-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    font-size: 7px;
    font-weight: 600;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(var(--primary-color-rgb), 0.2);
}

.chart-controls-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toggle-yaxis-btn,
.toggle-view-btn,
.fullscreen-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-yaxis-btn:hover,
.toggle-view-btn:hover,
.fullscreen-btn:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.toggle-yaxis-btn.active,
.toggle-view-btn.active {
    border-color: var(--primary-color);
    background: #e7f0ff;
    color: var(--primary-color);
}

.toggle-yaxis-btn .material-symbols-outlined,
.toggle-view-btn .material-symbols-outlined,
.fullscreen-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Y-Axis Label with Tooltip */
.y-axis-label {
    cursor: help;
    display: inline-block;
}

/* Load More Button */
.load-more-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.3);
}

.load-more-btn.visible {
    display: flex;
}

.load-more-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.4);
}

.load-more-btn:active:not(:disabled) {
    transform: translateY(0);
}

.load-more-btn:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    box-shadow: none;
}

.load-more-btn.loading {
    pointer-events: none;
}

.load-more-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: load-more-spin 0.8s linear infinite;
}

.load-more-btn.loading .load-more-spinner {
    display: block;
}

.load-more-btn.loading .load-more-text {
    display: none;
}

@keyframes load-more-spin {
    to {
        transform: rotate(360deg);
    }
}

.load-more-info {
    font-family: 'Lato', sans-serif;
    font-size: 12px;
    color: #666;
    margin: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.load-more-info.visible {
    opacity: 1;
}

.load-more-info span {
    font-weight: 600;
    color: var(--gradient-start);
}

/* ===========================
   TIMELINE CONTAINER (Phase 1)
   =========================== */
.timeline {
    display: flex;
    background: var(--page-background);
    flex-direction: column;
    padding: 0;
    box-shadow: none;
    border: none;
    border-radius: 0;
    position: relative;
    min-height: 600px;
}

.viewMode {
    border-radius: 0 !important;
    border: none;
    min-height: 600px;
}

.sideSheetMode {
    max-height: 600px;
    min-height: 600px;
}

.defaultMode {
    min-height: 600px !important;
    height: 600px !important;
}

.defaultMode .nav-container {
    display: flex;
}

.hidden {
    display: none;
}

section.timeline {
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* ===========================
   INNER CHART - Full dimensions
   =========================== */
.innerChart {
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
}

.innerChart:not(.hidden) {
    opacity: 1;
}

.subCharts {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ===========================
   STATE-BASED VISIBILITY (Phase 1)
   =========================== */
/* Hide chart when in empty/init/loading/error states */
.timeline.empty .innerChart,
.timeline.init .innerChart,
.timeline.loading .innerChart,
.timeline.error .innerChart {
    opacity: 0;
    pointer-events: none;
}

/* Show chart when rendered */
.timeline.rendered .innerChart {
    opacity: 1;
    pointer-events: auto;
}

/* Show empty state only when timeline has .empty class */
.timeline.empty .empty-state {
    display: flex !important;
    opacity: 1 !important;
}

/* Show init state only when timeline has .init class */
.timeline.init .init-state {
    display: flex !important;
    opacity: 1 !important;
}

/* Show loading state only when timeline has .loading class */
.timeline.loading .skeleton-overlay {
    display: flex !important;
    opacity: 1 !important;
}

/* Show error state only when timeline has .error class */
.timeline.error .error-state {
    display: flex !important;
    opacity: 1 !important;
}

/* ===========================
   LEGACY CHART CONTAINER (backward compatibility)
   =========================== */
.liveops-gantt-chart {
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.liveops-gantt-chart.fade-out {
    opacity: 0;
}

/* ===========================
   EMPTY STATE (Phase 1)
   =========================== */
.empty-state,
.liveops-gantt-empty {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.empty-state.active,
.liveops-gantt-empty.active {
    display: flex;
    opacity: 1;
}

.empty-icon,
.liveops-gantt-empty-icon {
    width: 80px;
    height: 80px;
    color: #bdc3c7;
    margin-bottom: 16px;
}

.empty-message,
.liveops-gantt-empty-message {
    font-size: 1.2rem;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.empty-hint,
.liveops-gantt-empty-hint {
    font-size: 0.95rem;
    color: #95a5a6;
}

/* ===========================
   INIT STATE (Phase 1)
   =========================== */
.init-state,
.liveops-gantt-init {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.init-state.active,
.liveops-gantt-init.active {
    display: flex;
    opacity: 1;
}

.init-icon,
.liveops-gantt-init-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: rotate-slow 2s linear infinite;
}

.init-message,
.liveops-gantt-init-message {
    font-size: 1.1rem;
    font-weight: 500;
    color: #3498db;
    margin-bottom: 4px;
}

.init-hint {
    font-size: 0.9rem;
    color: #7f8c8d;
}

@keyframes rotate-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Legacy animation name for backward compatibility */
@keyframes liveops-rotate-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================
   SKELETON LOADER (Phase 1)
   =========================== */
.skeleton-overlay,
.liveops-gantt-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--page-background);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 40px;
}

.skeleton-overlay.active,
.liveops-gantt-loading.active {
    display: flex;
    opacity: 1;
}

.skeleton-gantt {
    width: 100%;
    max-width: 900px;
}

.skeleton-header {
    display: flex;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.skeleton-header-item {
    flex: 1;
    height: 20px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    margin-right: 10px;
}

.skeleton-header-item:last-child {
    margin-right: 0;
}

.skeleton-rows {
    display: flex;
    flex-direction: column;
}

.skeleton-row {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.skeleton-label {
    width: 150px;
    height: 20px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-timeline {
    flex: 1;
    height: 20px;
    margin-left: 20px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.1s;
}

.skeleton-task-label {
    width: 150px;
    height: 32px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-task-bar {
    height: 32px;
    margin-left: 20px;
    background: linear-gradient(90deg, #d0d0e0 25%, #e0e0f0 50%, #d0d0e0 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
}

.skeleton-bar {
    height: 32px;
    background: linear-gradient(90deg, #d0d0e0 25%, #e0e0f0 50%, #d0d0e0 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
    /* Width and margin-left are set inline for varied timeline appearance */
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Legacy spinner (backward compatibility) */
.liveops-gantt-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: liveops-spin 0.8s linear infinite;
}

.liveops-gantt-loading-message,
.loading-message {
    margin-top: 20px;
    font-size: 1rem;
    font-weight: 500;
    color: #555;
}

@keyframes liveops-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================
   ERROR STATE (Phase 1)
   =========================== */
.error-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff5f5;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 40px;
}

.error-state.active {
    display: flex;
    opacity: 1;
}

.error-icon {
    width: 80px;
    height: 80px;
    color: #e74c3c;
    margin-bottom: 20px;
    animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #c0392b;
    margin-bottom: 12px;
    text-align: center;
}

.error-message {
    font-size: 1rem;
    color: #7f8c8d;
    text-align: center;
    margin-bottom: 24px;
    max-width: 400px;
}

.btn-retry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: #e74c3c;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.btn-retry:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-retry:active {
    transform: translateY(0);
}

.retry-icon {
    width: 20px;
    height: 20px;
}

/* ===========================
   PREVIEW STATE (Bubble Editor)
   =========================== */
.liveops-gantt-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
    background: #fafafa;
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 40px 20px;
    box-sizing: border-box;
}

.liveops-gantt-preview-icon {
    width: 100px;
    height: 100px;
    color: #bdc3c7;
    margin-bottom: 20px;
}

.liveops-gantt-preview-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-align: center;
}

.liveops-gantt-preview-subtitle {
    font-size: 1rem;
    color: #7f8c8d;
    margin-bottom: 4px;
    text-align: center;
}

.liveops-gantt-preview-hint {
    font-size: 0.9rem;
    color: #95a5a6;
    text-align: center;
}

/* ===========================
   BAR ICONS (Centered in bars - Phase 1 TASK 1.3)
   =========================== */
.bar-icons-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0;
}

.bar-icon-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bar-icon {
    font-size: 14px;
    line-height: 1;
}

.bar-count {
    font-size: 11px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

/* ===========================
   CONTRIBUTOR ICONS (Legacy - kept for compatibility)
   =========================== */
.custom-icons {
    display: flex;
    align-items: center;
    gap: 2px;
}

.custom-icon {
    width: 16px;
    height: 15px;
    margin-left: 5px;
    padding: 1px;
    border-radius: 50%;
    background-color: #fff;
}

span.custom-icon {
    text-align: center;
    font-size: 9px;
}

.contributor {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}

.flex-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.flex-child {
    display: flex;
    align-items: center;
}

.divider {
    width: 1px;
    height: 12px;
    background-color: #C8C5D0;
    margin: 0 3px;
}

/* ===========================
   EXTERNAL DEPENDENCY ICON & MODAL
   =========================== */
.external-dependency-icon {
    position: relative;
    display: inline-block;
}

.external-dependency-icon .fab {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.external-dependency-icon .fab:hover + .modal,
.external-dependency-icon .modal:hover {
    display: block !important;
}

.external-dependency-icon .modal {
    position: absolute;
    left: 0;
    top: 20px;
    background: white;
    border: 1px solid #C8C5D0;
    border-radius: 4px;
    padding: 8px 12px;
    min-width: 200px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    white-space: nowrap;
}

.external-dependency-icon .modal .inner-content {
    font-size: 11px;
    line-height: 1.4;
}

.external-dependency-icon .modal .inner-content > div > div:first-child {
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
}

.external-dependency-icon .modal .inner-content > div > div:last-child {
    color: #666;
}

/* ===========================
   HIGHCHARTS OVERRIDES
   =========================== */
.highcharts-credits {
    display: none;
}

.highcharts-tooltip {
    pointer-events: none;
    z-index: 9999;
}

.highcharts-tooltip-box {
    fill: rgba(255, 255, 255, 0.98);
    stroke: #C8C5D0;
    stroke-width: 2;
}

/* Grid lines */
/* X-axis grid lines - KEEP VISIBLE (vertical lines for dates) */
.highcharts-xaxis-grid .highcharts-grid-line {
    stroke: #E0E0E0 !important;
    stroke-width: 1 !important;
    display: block !important;
}

/* Y-axis grid lines - HIDE (horizontal lines) */
.highcharts-yaxis-grid .highcharts-grid-line {
    stroke: transparent !important;
    stroke-width: 0 !important;
    display: none !important;
}

/* Keep axis lines visible */
.highcharts-axis-line {
    stroke: #E0E0E0 !important;
    stroke-width: 1 !important;
}

/* Axis labels - always visible */
.highcharts-axis-labels {
    visibility: visible !important;
}

.highcharts-xaxis-labels text {
    fill: #333 !important;
    font-family: 'Lato', sans-serif !important;
    font-size: 12px !important;
}

.highcharts-yaxis-labels text {
    fill: #333 !important;
    font-family: 'Lato', sans-serif !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

/* Scrollbar styling */
.highcharts-scrollbar {
    cursor: pointer;
}

.highcharts-scrollbar-track {
    fill: #f0f0f0;
    stroke: #e0e0e0;
    stroke-width: 1;
}

.highcharts-scrollbar-thumb {
    fill: var(--primary-color);
    stroke: var(--primary-color);
    stroke-width: 0;
    rx: 4;
    ry: 4;
}

.highcharts-scrollbar-button {
    fill: #e0e0e0;
    stroke: #e0e0e0;
}

.highcharts-scrollbar-arrow {
    fill: #666;
}

/* Navigator */
.highcharts-navigator {
    cursor: pointer;
}

.highcharts-navigator-mask-inside {
    fill: rgba(var(--primary-color-rgb), 0.1);
    fill-opacity: 0.1;
}

.highcharts-navigator-outline {
    stroke: var(--primary-color);
    stroke-width: 1;
}

.highcharts-navigator-handle {
    fill: var(--primary-color);
    stroke: var(--primary-color);
}

/* Range selector input boxes */
.highcharts-range-input text {
    fill: #333 !important;
    font-family: 'Lato', sans-serif !important;
    font-weight: 700 !important;
}

.highcharts-input-group .highcharts-range-input:focus {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px;
}

/* Range selector button styling */
.highcharts-button-box {
    stroke: #dee2e6;
    stroke-width: 2;
}

.highcharts-button-pressed .highcharts-button-box,
.highcharts-button-hover .highcharts-button-box {
    stroke: var(--primary-color);
}

/* Scrollable plot area */
.highcharts-scrollable-plot-area {
    overflow: auto !important;
}

/* Ensure chart container allows scrolling */
.innerChart {
    overflow: visible !important;
}

/* ===========================
   MATERIAL SHAPES (for Materials Output view)
   =========================== */
.material-event-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: -2px;
}

.material-shape {
    display: inline-block;
    width: 23px;
    height: 23px;
    margin-right: 8px;
    border: 1px solid #00000061;
}

.material-shape.circle {
    border-radius: 50%;
}

.material-shape.triangle {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 23px solid;
    background-color: transparent;
    border-top: none;
    position: relative;
}

/* Add a pseudo-element for the black border around triangle */
.material-shape.triangle::after {
    content: '';
    position: absolute;
    top: 1px;
    left: -13px;
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 24px solid #000;
    z-index: -1;
}

.material-event-container .a_name {
    color: #000;
    font-weight: normal;
    z-index: 300;
}

