/**
 * Version History Page Styling with Golden Ratio (φ = 1.618)
 *
 * Golden Ratio Applications:
 * - Section spacing: 2.618em (φ²) vs 1.618em (φ)
 * - Card widths: max-width relates to viewport by φ
 * - Typography scales: font sizes use φ ratios
 * - Grid proportions: 1.618:1 for content areas
 * - Spacing harmonics: padding/margins scaled by φ
 */

:root {
    --phi: 1.618;
    --phi-inverse: 0.618;
    --phi-squared: 2.618;

    /* Golden Ratio Spacing System */
    --space-xs: calc(0.382rem);      /* φ^-2 */
    --space-sm: calc(0.618rem);      /* φ^-1 */
    --space-md: calc(1rem);           /* base */
    --space-lg: calc(1.618rem);       /* φ */
    --space-xl: calc(2.618rem);       /* φ² */
    --space-xxl: calc(4.236rem);      /* φ³ */

    /* Version Colors */
    --version-110: #8b5cf6;  /* Purple - Telemetry */
    --version-103: #10b981;  /* Green - Atlas */
    --version-102: #3b82f6;  /* Blue - Metadata */

    /* Timeline Colors */
    --timeline-line: #e5e7eb;
    --timeline-dot: #d1d5db;
}

/* Version Timeline Container */
.version-timeline {
    position: relative;
    max-width: calc(100% / var(--phi));  /* Golden ratio width */
    margin: var(--space-xxl) auto;
    padding: var(--space-lg);
}

/* Timeline Vertical Line */
.version-timeline::before {
    content: '';
    position: absolute;
    left: calc(var(--space-lg) * 2);
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
        to bottom,
        var(--timeline-line) 0%,
        var(--timeline-dot) 50%,
        transparent 100%
    );
    border-radius: 2px;
}

/* Version Card */
.version-card {
    position: relative;
    margin-bottom: var(--space-xl);
    margin-left: calc(var(--space-lg) * 3);
    background: white;
    border-radius: calc(var(--space-md) * var(--phi-inverse));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--timeline-dot);
}

.version-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Timeline Dot */
.version-card::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-lg) * 3 - var(--space-md));
    top: var(--space-xl);
    width: calc(var(--space-lg) * var(--phi));
    height: calc(var(--space-lg) * var(--phi));
    background: white;
    border: 3px solid var(--timeline-dot);
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 2;
}

.version-card:hover::before {
    transform: scale(1.2);
    border-color: currentColor;
}

/* Version Badge Colors */
.version-card.expanded {
    border-left-color: var(--version-110);
}

.version-badge.v110 {
    background: linear-gradient(135deg, var(--version-110), #a78bfa);
}

.version-badge.v103 {
    background: linear-gradient(135deg, var(--version-103), #34d399);
}

.version-badge.v102 {
    background: linear-gradient(135deg, var(--version-102), #60a5fa);
}

/* Version Header */
.version-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xl);
    cursor: pointer;
    user-select: none;
    gap: var(--space-lg);
}

.version-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.version-info {
    flex: 1;
    min-width: 0;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    color: white;
    border-radius: calc(var(--space-md) * var(--phi));
    font-weight: 600;
    font-size: calc(0.9rem * var(--phi-inverse));
    margin-bottom: var(--space-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.version-badge i {
    font-size: 1em;
}

.version-header h2 {
    font-size: calc(1rem * var(--phi));  /* φ scaling */
    font-weight: 700;
    color: #1f2937;
    margin: var(--space-sm) 0;
    line-height: var(--phi);
}

.version-date {
    color: #6b7280;
    font-size: calc(0.9rem * var(--phi-inverse));
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.version-date i {
    color: #9ca3af;
}

.expand-icon {
    flex-shrink: 0;
    width: calc(var(--space-lg) * var(--phi));
    height: calc(var(--space-lg) * var(--phi));
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.version-card:hover .expand-icon {
    background: #e5e7eb;
}

.expand-icon i {
    color: #6b7280;
    transition: transform 0.3s ease;
}

/* Version Details */
.version-details {
    border-top: 1px solid #e5e7eb;
    padding: var(--space-xl);
    background: #fafafa;
}

.version-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(300px / var(--phi))), 1fr));
    gap: var(--space-xl);
}

/* Feature Section */
.feature-section {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--space-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.feature-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.feature-section h3 {
    font-size: calc(1rem * var(--phi-inverse) * var(--phi));
    font-weight: 600;
    color: #374151;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.feature-section h3 i {
    color: #6366f1;
    font-size: 1.1em;
}

/* Feature List */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    padding: var(--space-sm) 0;
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    line-height: var(--phi);
    color: #4b5563;
    font-size: 0.95rem;
}

.feature-list li i {
    color: #10b981;
    font-size: 0.9em;
    margin-top: 0.2em;
    flex-shrink: 0;
}

.feature-list.compact li {
    padding: calc(var(--space-xs) * var(--phi)) 0;
}

/* Module Chips */
.module-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.module-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: calc(var(--space-md) * var(--phi-inverse));
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
    transition: transform 0.2s ease;
}

.module-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.module-chip i {
    font-size: 0.9em;
}

.module-desc {
    color: #6b7280;
    font-size: 0.9rem;
    font-style: italic;
    line-height: var(--phi);
}

/* Command List */
.command-list {
    background: #f9fafb;
    padding: var(--space-lg);
    border-radius: var(--space-sm);
    border-left: 3px solid #6366f1;
    line-height: calc(var(--phi) * 1.2);
}

.command-list code {
    background: #1f2937;
    color: #10b981;
    padding: calc(var(--space-xs) * var(--phi)) var(--space-sm);
    border-radius: var(--space-xs);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 500;
}

.command-list span {
    color: #6b7280;
    margin-left: var(--space-sm);
}

/* Stats Badges */
.stats-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: calc(var(--space-md) * var(--phi));
    font-size: 0.85rem;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.stat-badge:hover {
    transform: scale(1.05);
}

.stat-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.stat-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.stat-badge.primary {
    background: #ede9fe;
    color: #5b21b6;
}

.stat-badge i {
    font-size: 1em;
}

/* Atlas Grid */
.atlas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.atlas-type {
    background: #f9fafb;
    padding: var(--space-lg);
    border-radius: var(--space-md);
    border: 1px solid #e5e7eb;
}

.atlas-type h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.atlas-type h4 i {
    color: #10b981;
}

.atlas-chip {
    display: inline-block;
    background: white;
    color: #4b5563;
    padding: calc(var(--space-xs) * var(--phi)) var(--space-sm);
    margin: var(--space-xs) var(--space-xs) 0 0;
    border-radius: var(--space-xs);
    font-size: 0.8rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.atlas-chip:hover {
    background: #f3f4f6;
    border-color: #10b981;
}

/* Metadata Grid */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
}

.metadata-item {
    text-align: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, #f9fafb, #ffffff);
    border-radius: var(--space-md);
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.metadata-item:hover {
    border-color: #3b82f6;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.15);
}

.metadata-item .count {
    display: block;
    font-size: calc(2rem * var(--phi-inverse));
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: var(--space-xs);
}

.metadata-item .label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: var(--space-xs);
}

.metadata-item small {
    display: block;
    color: #6b7280;
    font-size: 0.75rem;
}

/* Version Footer */
.version-footer {
    margin-top: var(--space-xxl);
    padding: var(--space-xl);
    background: linear-gradient(135deg, #f0f9ff, #fef3c7);
    border-radius: var(--space-lg);
    text-align: center;
    border: 2px solid #dbeafe;
}

.version-footer p {
    margin: var(--space-sm) 0;
    color: #374151;
    line-height: var(--phi);
}

.version-footer p:first-child {
    font-weight: 600;
}

.version-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.version-footer a:hover {
    color: #1e40af;
    text-decoration: underline;
}

.version-footer i {
    margin-right: var(--space-xs);
}

/* Responsive Design - Golden Ratio Breakpoints */
@media (max-width: 1024px) {
    .version-timeline {
        max-width: 90%;
    }

    .version-grid {
        grid-template-columns: 1fr;
    }

    .atlas-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .version-timeline::before {
        left: var(--space-lg);
    }

    .version-card {
        margin-left: calc(var(--space-lg) * 2);
    }

    .version-card::before {
        left: calc(-1 * var(--space-lg) * 2 - var(--space-xs));
        width: var(--space-lg);
        height: var(--space-lg);
    }

    .version-header {
        padding: var(--space-lg);
        flex-direction: column;
        align-items: flex-start;
    }

    .version-header h2 {
        font-size: calc(1.1rem);
    }

    .expand-icon {
        align-self: flex-end;
        margin-top: var(--space-md);
    }

    .version-details {
        padding: var(--space-lg);
    }

    .metadata-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-badges {
        flex-direction: column;
    }

    .stat-badge {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .version-timeline {
        padding: var(--space-sm);
        margin: var(--space-lg) auto;
    }

    .version-badge {
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
    }

    .version-header h2 {
        font-size: 1rem;
    }

    .module-chips {
        flex-direction: column;
    }

    .metadata-grid {
        grid-template-columns: 1fr;
    }

    .command-list {
        font-size: 0.75rem;
    }
}

/* Animation for expanding/collapsing */
.version-details {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print Styles */
@media print {
    .version-timeline::before {
        background: #000 !important;
    }

    .version-card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000;
    }

    .version-details {
        display: block !important;
    }

    .expand-icon {
        display: none;
    }
}
