/* Version Controller Styles */

/* File Info Container - Floating Top Right */
.file-info-container {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px; /* Increased padding for better readability */
    border: 1px solid #30363d;
    border-radius: 8px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    min-width: 300px; /* Increased width to accommodate content better */
    height: 52px; /* Fixed height to ensure all elements align properly */
}

/* File Name Display */
.file-name {
    font-size: 0.9rem; /* Restore original desktop font size */
    font-weight: 600;
    color: #f0f6fc;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile-specific version control adjustments */
@media (max-width: 768px) {
    .file-info-container {
        flex-direction: row !important; /* Force horizontal layout on mobile */
        gap: 8px !important; /* Smaller gap on mobile */
        min-width: auto !important; /* Remove min-width constraint on mobile */
    }
    
    .file-name {
        font-size: 0.8rem !important; /* Smaller font on mobile */
        line-height: 1.2 !important;
    }
}

/* Version Indicator Button */
.version-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px; /* Increased padding to match container height */
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem; /* Slightly larger for better readability */
    color: #f0f6fc;
    background: #000000;
    min-width: fit-content;
    white-space: nowrap;
    height: 32px; /* Fixed height to match container proportions */
}

/* Mobile-specific version indicator adjustments */
@media (max-width: 768px) {
    .version-indicator {
        gap: 4px; /* Reduced gap on mobile */
        padding: 4px 6px; /* Reduced padding on mobile */
        font-size: 0.7rem; /* Smaller font on mobile */
        height: 24px; /* Fixed height on mobile */
        line-height: 1;
    }
}

.version-indicator:hover {
    background: #21262d;
    color: #f0f6fc;
}

.version-indicator:active {
    transform: translateY(1px);
}

.version-text {
    font-family: 'Space Grotesk', monospace;
    font-weight: 500;
}

.version-arrow {
    font-size: 0.9rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #8b949e;
    font-weight: 600;
    font-style: normal;
}

.version-arrow::before {
    content: 'i';
    font-family: serif;
    font-size: 0.8rem;
    line-height: 1;
}

.version-indicator:hover .version-arrow {
    background: var(--accent-primary-20);
    color: var(--accent-primary);
}

/* Branch Selector Styles */
.branch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid #30363d;
    height: 100%; /* Full height to match container */
}

.branch-label {
    font-size: 0.85rem; /* Slightly larger for better readability */
    color: #8b949e;
    font-weight: 500;
    white-space: nowrap;
}

.branch-selector {
    position: relative;
    display: flex;
    align-items: center;
    height: 32px; /* Match version indicator height */
}

/* Branch selector styles moved to unified-dropdowns.css for consistency */

/* Branch item styles moved to unified-dropdowns.css for consistency */

/* Message item for when no real branches exist */
.branch-item-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 4px;
    cursor: default;
}

.branch-message {
    font-family: 'Space Grotesk', monospace;
    font-weight: 500;
    color: var(--accent-warning-alt);
    font-size: 0.85rem;
}

.branch-message-desc {
    font-size: 0.75rem;
    color: #8b949e;
    font-style: italic;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Version Modal */
.version-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    animation: overlayFadeIn 0.3s ease-out;
}

.version-modal.show {
    opacity: 1;
    visibility: visible;
}

.version-modal-content {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    animation: modalSlideIn 0.3s ease-out;
}

.version-modal.show .version-modal-content {
    transform: translateY(0) scale(1);
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header */
.version-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #21262d;
    background: #060607;
    border-radius: 12px 12px 0 0;
}

.version-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #f0f6fc;
    flex: 1;
}

.version-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #8b949e;
    font-size: 18px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.version-modal-close:hover {
    background: #21262d;
    color: #f0f6fc;
}

.version-modal-close:active {
    background: #30363d;
}

/* Versions List */
.versions-list {
    max-height: 900px;
    overflow-y: auto;
    padding: 8px;
    background: #000000;
}

/* Version Item */
.version-item {
    padding: 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    margin-bottom: 4px;
    position: relative;
}

.version-item:hover {
    background: #1f2124;
}

/* Version Item Header */
.version-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.version-label {
    font-weight: 600;
    color: #f0f6fc;
    font-size: 0.95rem;
}

.version-date {
    font-size: 0.8rem;
    color: #8b949e;
    font-family: 'Space Grotesk', monospace;
}

/* Version Author */
.version-author {
    font-size: 0.85rem;
    color: #8b949e;
    margin-bottom: 4px;
}

/* Version Description */
.version-description {
    font-size: 0.9rem;
    color: #8b949e;
    line-height: 1.4;
}

/* Enhanced Changelog Formatting */
.changelog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: linear-gradient(135deg, #1a1d29 0%, #2d3748 100%);
    border-radius: 8px;
}

.changelog-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.changelog-info {
    flex: 1;
}

.changelog-version {
    font-weight: 600;
    color: #f0f6fc;
    font-size: 1rem;
    margin-bottom: 2px;
}

.changelog-date {
    font-size: 0.9rem;
    color: #8b949e;
    font-family: 'Space Grotesk', monospace;
}

.changelog-section {
    margin-bottom: 16px;
    border-radius: 6px;
    background: var(--accent-primary-03);
    border: 1px solid var(--accent-primary-10);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--accent-primary-08);
    border-bottom: 1px solid var(--accent-primary-10);
    font-weight: 600;
    color: #f0f6fc;
    font-size: 0.95rem;
}

.section-icon {
    font-size: 1rem;
    line-height: 1;
}

.section-content {
    padding: 16px;
    color: #c9d1d9;
    line-height: 1.5;
}

.subsection {
    margin-bottom: 16px;
}

.subsection:last-child {
    margin-bottom: 0;
}

.subsection-header {
    font-weight: 600;
    color: #f0f6fc;
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.change-list {
    margin: 0;
    padding-left: 20px;
    color: #c9d1d9;
}

.change-list li {
    margin-bottom: 6px;
    line-height: 1.4;
    position: relative;
}

.change-list li:last-child {
    margin-bottom: 0;
}

.change-list li::marker {
    color: var(--accent-primary);
}

/* Enhanced change type styling */
.change-list.updated-items li::marker {
    color: #f7b731;
}

.change-list.removed-items li::marker {
    color: #ff6b6b;
}

.change-list.added-lines li::marker {
    color: var(--accent-success-alt);
}

.change-list.modified-lines li::marker {
    color: var(--accent-warning-alt);
}

.change-list.removed-lines li::marker {
    color: var(--accent-error-secondary);
}

.line-changes-section {
    border-left: 4px solid #17a2b8;
}

.line-changes-section .section-header {
    background: rgba(23, 162, 184, 0.1);
    border-bottom-color: rgba(23, 162, 184, 0.2);
}

/* Change type indicators - removed bullet points from subsection headers */

/* Line change styling */
.added-lines li {
    border-left: 3px solid var(--accent-success-alt);
    background: var(--accent-success-10);
    padding-left: 12px;
    margin-left: -12px;
}

.modified-lines li {
    border-left: 3px solid var(--accent-warning-alt);
    background: rgba(255, 193, 7, 0.1);
    padding-left: 12px;
    margin-left: -12px;
}

.removed-lines li {
    border-left: 3px solid var(--accent-error-secondary);
    background: rgba(220, 53, 69, 0.1);
    padding-left: 12px;
    margin-left: -12px;
    text-decoration: line-through;
    opacity: 0.8;
}

.no-description {
    color: #8b949e;
    font-style: italic;
    font-size: 0.9rem;
}

.plain-description {
    color: #c9d1d9;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Enhanced version item styling for changelog */
.version-item .version-description {
    max-height: none;
    overflow: visible;
}

/* Detailed Version Modal */
.version-detail-modal .version-modal-content {
    max-width: 800px;
    max-height: 90vh;
}

.version-detail-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--accent-primary-10);
    color: var(--accent-primary);
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 600;
}

.back-button:hover {
    background: var(--accent-primary-20);
    color: var(--accent-primary-bright);
}

.back-button:active {
    background: var(--accent-primary-30);
}

.version-details-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #000000;
}

.version-metadata {
    background: var(--accent-primary-05);
    border: 1px solid var(--accent-primary-10);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.metadata-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.metadata-row:last-child {
    margin-bottom: 0;
}

.metadata-label {
    font-weight: 600;
    color: #8b949e;
    min-width: 80px;
    font-size: 0.9rem;
}

.metadata-value {
    color: #f0f6fc;
    font-family: 'Space Grotesk', monospace;
    flex: 1;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #30363d;
}

.detailed-changelog {
    border-radius: 8px;
    padding: 0;
}

/* Enhanced changelog in detailed view */
.detailed-changelog .changelog-header {
    margin-bottom: 20px;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    
}

.detailed-changelog .changelog-section {
    margin-bottom: 20px;
}

.detailed-changelog .section-content {
    padding: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .file-info-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        min-width: auto;
        flex-direction: column;
        gap: 8px;
        padding: 8px 12px;
    }
    
    .file-name {
        max-width: none;
        text-align: left;
        font-size: 0.85rem;
    }
    
    .version-indicator {
        align-self: center;
        padding: 8px 12px;
    }
      .version-modal-content {
        width: 95%;
        margin: 20px;
        max-height: 85vh;
    }
    
    .changelog-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .section-header {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .section-content {
        padding: 12px;
    }
    
    .branch-container {
        margin-left: 8px;
        padding-left: 8px;
    }
    
    .branch-label {
        display: none;
    }
    
    .branch-dropdown {
        right: -50px;
        min-width: 250px;
    }
}

    .file-name {
        color: #f9fafb;
    }
    

    
    .version-modal-content {
        background: #1f2937;
    }
    
    .version-modal-header {
        border-bottom-color: #374151;
    }
    
    .version-modal-header h3 {
        color: #f9fafb;
    }
    
    .version-modal-close {
        color: #d1d5db;
    }
    
    .version-modal-close:hover {
        background: #374151;
        color: #f9fafb;
    }
      .version-item:hover {
        background: #374151;
    }
    
    .version-label {
        color: #f9fafb;
    }
    
    .version-date,
    .version-author {
        color: #d1d5db;
    }
    
    .version-description {
        color: #9ca3af;
    }


/* Smart Branch Manager Indicators */

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Background preload indicator */
.background-preload-indicator {
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.background-preload-indicator::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Branch switch indicators */
#branchSwitchIndicator {
    backdrop-filter: blur(4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.2s ease;
}

#branchSwitchIndicator::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

/* Spin animation for loading spinners */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced branch current button states */
.branch-current.loading {
    opacity: 0.7;
    pointer-events: none;
}

.branch-current.loading .branch-arrow {
    animation: pulse 1s ease-in-out infinite;
}

/* Success indicators */
.preload-complete-indicator {
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Instant switch enhancement */
.instant-switch .file-info-container {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

/* Branch cache status indicator (optional for debugging) */
.branch-cache-status {
    position: fixed;
    bottom: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 999;
    opacity: 0.6;
    display: none; /* Hidden by default */
}

.branch-cache-status.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Enhanced transitions for smooth switching */
.version-transition {
    transition: all 0.3s ease;
}

.version-transition.switching {
    opacity: 0.8;
    transform: scale(0.98);
}

/* Responsive adjustments for indicators */
@media (max-width: 768px) {
    .background-preload-indicator,
    .preload-complete-indicator {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
    
    #branchSwitchIndicator {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Remove the old branch count badge since we don't want it */
.file-info-container::after {
    display: none !important;
}

.file-info-container[data-branch-count]:not([data-branch-count="0"])::after {
    display: none !important;
}

/* Fast branch switching loading states */
.tree-placeholder.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    min-height: 200px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #374151;
    border-top: 2px solid var(--accent-primary-alt);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tree-placeholder.loading-state span {
    opacity: 0.8;
    font-weight: 500;
}

/* Branch switching feedback */
.branch-switching-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.branch-switching-content {
    background: #1f2937;
    padding: 24px 32px;
    border-radius: 8px;
    border: 1px solid #374151;
    color: white;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.branch-switching-content .loading-spinner {
    margin: 0 auto 16px auto;
}

.branch-switching-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #f3f4f6;
}

.branch-switching-content p {
    margin: 0;
    font-size: 14px;
    color: #9ca3af;
}

/* Branch notification system */
.branch-notification {
    position: fixed;
    bottom: 140px;
    right: 20px;
    z-index: 10001;
    background: #4CAF50;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInNotification 0.3s ease-out;
}

.branch-notification.error {
    background: #f44336;
}

.branch-notification.warning {
    background: #ff9800;
}

.branch-notification button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.branch-notification button:hover {
    opacity: 0.8;
}

@keyframes slideInNotification {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error state improvements */
.tree-placeholder.error-state {
    background: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
    padding: 30px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tree-placeholder.error-state.fatal {
    background: #3f51b5;
    border-color: #303f9f;
    color: white;
}

.tree-placeholder.error-state .error-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.tree-placeholder.error-state .error-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.tree-placeholder.error-state .error-details {
    margin: 15px 0;
    text-align: left;
    background: rgba(0,0,0,0.1);
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9em;
}

.tree-placeholder.error-state .error-details p {
    margin: 5px 0;
}

.tree-placeholder.error-state .recovery-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.tree-placeholder.error-state button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.tree-placeholder.error-state .retry-button,
.tree-placeholder.error-state .primary-button {
    background: #2196F3;
    color: white;
}

.tree-placeholder.error-state .retry-button:hover,
.tree-placeholder.error-state .primary-button:hover {
    background: #1976D2;
}

.tree-placeholder.error-state .secondary-button {
    background: #757575;
    color: white;
}

.tree-placeholder.error-state .secondary-button:hover {
    background: #616161;
}

.tree-placeholder.error-state .emergency-button {
    background: #f44336;
    color: white;
    font-size: 1.1em;
    padding: 12px 20px;
}

.tree-placeholder.error-state .emergency-button:hover {
    background: #d32f2f;
}
