/* Utility Components and Common Elements */

/* Tooltip */
.tooltip {
    position: fixed;
    background: #161b22;
    color: var(--text-primary);
    padding: 16px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.8;
    pointer-events: none;
    z-index: 1000;
    max-width: 600px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: none;
    transform: translateY(10px);
}

.tooltip.show {
    opacity: 1;
    display: block;
    transform: translateY(0);
}

.tooltip h4 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tooltip .tooltip-name {
    flex: 1;
    margin-right: 8px;
}

.tooltip .alias-level-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background-color: #000000;
    color: var(--text-primary);
    display: inline-block;
    flex-shrink: 0;
}

.tooltip .alias-level-tag.core {
    background-color: #000000;
    color: var(--text-primary);
    font-weight: 600;
}

.tooltip .style-type-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background-color: #000000;
    color: var(--text-primary);
    display: inline-block;
    flex-shrink: 0;
}

.tooltip p {
    margin-bottom: 3px;
    margin-top: 3px;
}

.tooltip .type {
    font-size: 10px;
    color: #8b949e;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.tooltip-color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px solid #21262d;
    margin-left: 4px;
    vertical-align: middle;
    border-radius: 2px;
}

.tooltip-modes-list {
    padding-left: 8px;
    list-style: none;
}

.tooltip-modes-list li {
    margin: 4px 0;
    padding: 2px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border-default);
    color: var(--text-primary); /* Ensure consistent text color */
}

.tooltip-modes-list li:last-child {
    border-bottom: none;
}

/* Ensure all hex color values in tooltips have consistent text color */
.tooltip p,
.tooltip li {
    color: var(--text-primary);
}

/* Desktop Tooltip Connection Impact Styles */
.tooltip .impact-oneliner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Risk level colors for desktop */
.tooltip .impact-oneliner.risk-high {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

.tooltip .impact-oneliner.risk-medium {
    background: rgba(255, 204, 0, 0.15);
    border-color: rgba(255, 204, 0, 0.3);
    color: #ffcc00;
}

.tooltip .impact-oneliner.risk-low {
    background: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.3);
    color: #34c759;
}

/* Loading States */
.loading {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, 0);
    text-align: center;
    z-index: 100;
    background: transparent; 
    display: none;
    max-width: 600px;
}

.loading.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Custom Loading Animation */
.loading-animation-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 128px;
    height: 128px;
    min-height: 128px;
}

.loading-icon {
    position: relative;
    width: 10px;
    height: 10px;
    transform: scale(6);
}

.loading-top-bar-container {
    position: absolute;
    overflow: hidden;
    width: 10px;
    height: 2.67px;
    left: 0px;
    top: 0px;
}

.loading-top-bar {
    position: absolute;
    background: var(--text-primary);
    width: 10px;
    height: 2.67px;
    left: 0px;
    top: 0px;
    animation: topBarAnimation 3s ease-in-out infinite;
}

.loading-left-rect-container {
    position: absolute;
    overflow: hidden;
    width: 3.44px;
    height: 6.5px;
    left: 2.06px;
    top: 3.5px;
}

.loading-left-rect {
    position: absolute;
    background: var(--text-primary);
    width: 3.44px;
    height: 6.5px;
    left: 0px;
    top: 0px;
    animation: leftRectAnimation 3s ease-in-out infinite 0.4s;
}

.loading-right-rect-container {
    position: absolute;
    overflow: hidden;
    width: 3px;
    height: 2.67px;
    left: 6.41px;
    top: 4.34px;
}

.loading-right-rect {
    position: absolute;
    background: var(--text-primary);
    width: 3px;
    height: 2.67px;
    left: 0px;
    top: 0px;
    animation: rightRectAnimation 3s ease-in-out infinite 0.8s;
}

/* Animation keyframes */
@keyframes topBarAnimation {
    0% { transform: translateX(-10px); }
    25% { transform: translateX(0px); }
    75% { transform: translateX(0px); }
    100% { transform: translateX(10px); }
}

@keyframes leftRectAnimation {
    0% { transform: translateY(-6.5px); }
    25% { transform: translateY(0px); }
    75% { transform: translateY(0px); }
    100% { transform: translateY(6.5px); }
}

@keyframes rightRectAnimation {
    0% { transform: translateX(-4px) translateY(0px); }
    25% { transform: translateX(0px) translateY(0px); }
    75% { transform: translateX(0px) translateY(0px); }
    100% { transform: translateX(0px) translateY(-4px); }
}

.progress-details {
    margin-top: 8px;
    padding: 8px 16px;
    
    font-size: 13px;
    color: var(--text-muted);
    max-width: 480px;
    line-height: 1.4;
    text-align: center;
    font-style: italic;
}

.progress-details.highlight {
    color: var(--text-muted);
}

@keyframes fadeInOut {    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Tree Loading State Styles */
.tree-placeholder.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    min-height: 200px;
}

.tree-placeholder.loading-state .loading-animation-container {
    margin-bottom: 20px;
}

.tree-placeholder.loading-state .loading-progress {
    width: 100%;
}

.tree-placeholder.loading-state .loading-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.loading-step {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
}

.loading-step.active {
    color: var(--accent-color);
    opacity: 1;
    background: rgba(var(--accent-color-rgb), 0.1);
    font-weight: 500;
}

.loading-step.complete {
    color: var(--text-secondary);
    opacity: 0.8;
}

.loading-step.complete::before {
    content: '✓ ';
    color: var(--success-color, #22c55e);
}

/* Tree Empty State - matches initial app loading */
.tree-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
    text-align: center;
}

.empty-state-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state-icon {
    font-size: 24px;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* Error Display Styles */
.error-display-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    padding: 16px;
    text-align: center;
}

.error-display-container h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.error-message-detail {
    font-size: 14.4px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

.button-retry {
    margin-top: 16px;
    padding: 8px 16px;
    background: var(--accent-button);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14.4px;
    transition: background-color 0.2s;
}

.button-retry:hover {
    background: var(--accent-button-hover);
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        position: fixed;
        left: -280px;
        top: 72px;
        height: calc(100vh - 72px);
        z-index: 200;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100vw;
        left: -100vw;
    }
    
    .sidebar.open {
        left: 0;
    }
}
