/* Metro Core Components - Single Source of Truth
 * Base metro component styles - the foundation for all metro visualizations
 * This file contains ONLY the core, reusable components with no context-specific logic.
 */

/* Container wrappers */
.metro-container {
    max-width: 320px;
    margin: 40px auto;
}

.metro-indicator {
    background: var(--color-white);
    padding: 40px var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--elevation-1);
    display: flex;
    justify-content: center;
}

/* Metro line - vertical bar with completed path */
.metro-steps {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    padding-left: 25px; /* Spacing between line and labels */
    min-width: 200px;

    /* CSS Variables - Inverted: light = incomplete path, dark = completed/current */
    --metro-line-color: #f9b233;          /* Light orange for incomplete path */
    --metro-completed-color: #f26522;     /* Dark red-orange for completed path */
    --metro-current-color: #f26522;       /* Dark red-orange for current step */
    --metro-future-text-color: #2e318f;   /* Dark blue for future steps */
    --metro-current-label-color: #ec2424; /* Red for current station label */
}

/* Base line; actual gradient is injected via CSS variable from JS */
.metro-steps::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 14px;
    background: var(--metro-line-background, var(--metro-line-color));
    border-radius: 5px;
    z-index: 0;
}

/* Step element - individual station */
.metro-step {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    min-height: 28px;
    z-index: 2;
}

/* Interchange station - white circle with black border, centered on line */
.metro-interchange {
    width: 30px;
    height: 30px;
    border-radius: 9999px;
    background: var(--color-white);
    border: 4px solid var(--color-text-dark);
    position: absolute;
    left: -33px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
}

/* Normal station - horizontal hinge bar extending from line */
.metro-hinge {
    width: 12px;
    height: 12px;
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 0 3px 3px 0;
    z-index: 3;
}

/* Terminal station - white square with line color border, centered on line */
.metro-terminal {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-white);
    border: 4px solid;
    position: absolute;
    left: -37px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
}

/* Station label text */
.metro-label {
    margin-left: 8px;
    font-size: var(--font-size-md);
    font-weight: 400;
}

/* Remove underline from links that are metro labels */
a.metro-label {
    text-decoration: none;
}

a.metro-label:hover {
    text-decoration: none;
}

/* State classes - Completed */
.metro-step.completed .metro-hinge {
    background: var(--metro-completed-color);
}

.metro-step.completed .metro-interchange {
    border-color: var(--metro-completed-color);
    box-shadow: 0 0 0 1px var(--metro-completed-color);
}

.metro-step.completed .metro-label {
    color: var(--metro-completed-color);
}

/* State classes - Current */
.metro-step.current .metro-hinge {
    background: var(--metro-current-color);
}

.metro-step.current .metro-label {
    color: var(--metro-current-label-color);
    font-weight: 700;
}

/* State classes - Upcoming */
.metro-step.upcoming .metro-hinge {
    background: var(--metro-line-color);
}

.metro-step.upcoming .metro-label {
    color: var(--metro-future-text-color);
}

/* Terminal station labels - black, bigger, and thicker
 * Must come AFTER state classes to override upcoming/current/completed states
 * Higher specificity to ensure it overrides state-based colors
 */
.metro-step.upcoming:has(.metro-terminal) .metro-label,
.metro-step.current:has(.metro-terminal) .metro-label,
.metro-step.completed:has(.metro-terminal) .metro-label,
.metro-step:has(.metro-terminal) .metro-label,
.metro-step .metro-terminal ~ .metro-label,
.metro-label.category-name {
    color: var(--color-text-dark) !important;
    font-size: var(--font-size-2xl);
    font-weight: 800;
}

/* State classes - Hovered */
.metro-step.hovered .metro-label {
    color: var(--metro-current-label-color);
    font-weight: 600;
    transition: color var(--transition-base), font-weight var(--transition-base);
}

.metro-step.hovered .metro-hinge {
    background: var(--metro-current-color);
    transition: background var(--transition-base);
}

.metro-step.hovered .metro-interchange {
    border-color: var(--metro-current-color);
    box-shadow: 0 0 0 1px var(--metro-current-color);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

/* Control buttons */
.metro-controls {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
}

.metro-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--color-secondary);
    background: var(--color-white);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-secondary);
    transition: all var(--transition-base);
    padding: 0;
}

.metro-btn:hover {
    background: var(--color-secondary);
    color: var(--color-white);
    transform: translateY(-1px);
    box-shadow: var(--elevation-2);
}

.metro-btn:active {
    transform: translateY(0);
    box-shadow: var(--elevation-1);
}

.metro-btn:focus {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}
