/* Animations, classes utilitaires */

/* ========== ANIMATIONS ET UTILITAIRES ========== */

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes progress {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

@keyframes signalPulse {
    from {
        height: 0.3125rem; /* 5px */
        opacity: 0.5;
    }

    to {
        height: 1.25rem; /* 20px */
        opacity: 1;
    }
}

@keyframes signalAdjust {
    0%,
    100% {
        height: 0.3125rem; /* 5px */
        opacity: 0.3;
        transform: scaleY(0.5);
    }

    50% {
        height: 1.25rem; /* 20px */
        opacity: 1;
        transform: scaleY(1.2);
    }
}

@keyframes statusBlink {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Background transition overlay */
.background-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: signalDistortion 2s ease-in-out forwards;
}

@keyframes signalDistortion {
    0% {
        opacity: 0;
        transform: scale(1.02);
        filter: brightness(1) contrast(1) blur(0);
    }
    15% {
        opacity: 1;
        transform: scale(1.01);
        filter: brightness(1.2) contrast(1.3) blur(0.375rem);
    }
    30% {
        transform: scale(1.02);
        filter: brightness(1.1) contrast(1.4) blur(0.5rem);
    }
    45% {
        transform: scale(1.01);
        filter: brightness(1.1) contrast(1.3) blur(0.375rem);
    }
    60% {
        transform: scale(1);
        filter: brightness(1) contrast(1.2) blur(0.25rem);
    }
    75% {
        transform: scale(1);
        filter: brightness(1) contrast(1.1) blur(0.125rem);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1) contrast(1) blur(0);
    }
}

@keyframes signalNoise {
    0% {
        opacity: 0;
    }
    15% {
        opacity: 0.7;
    }
    30% {
        opacity: 0.5;
    }
    45% {
        opacity: 0.4;
    }
    60% {
        opacity: 0.3;
    }
    75% {
        opacity: 0.2;
    }
    100% {
        opacity: 0;
    }
}

@keyframes typewrite {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes bootFade {

    0%,
    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        pointer-events: none;
    }
}

@keyframes quickBootFade {

    0%,
    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        pointer-events: none;
    }
}

/* Animation pour la bordure du player en reconnexion */
@keyframes pulse-border {
    0%, 100% {
        border-color: var(--theme-primary);
    }
    50% {
        border-color: var(--alert-color);
    }
}

/* Animation pour la vérification de signature */
@keyframes checkingPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

/* Animation spin spécifique pour éléments centrés */
@keyframes spin-centered {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Image transition overlay */
.image-transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    animation: signalDistortion 2s ease-in-out forwards;
}

/* --- Classes utilitaires --- */
.blink {
    animation: blink 1s infinite;
}

.typing {
    white-space: nowrap;
    overflow: hidden;
    animation: typewrite var(--transition-fast) steps(60, end);
}

.visually-hidden {
    position: absolute;
    width: 0.0625rem; /* 1px */
    height: 0.0625rem; /* 1px */
    padding: 0;
    margin: -0.0625rem; /* -1px */
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Terminal Classes */
.terminal-line {
    padding: 0.125rem 0; /* 2px */
    font-family: 'VT323', monospace;
    line-height: var(--line-height-tight);
}

.terminal-line:not(:first-child) {
    margin-top: 0.125rem; /* 2px */
}

.terminal-line.success {
    color: var(--theme-success);
    text-shadow: 0 0 0.3125rem var(--theme-success); /* 5px */
}

.terminal-line.error {
    color: var(--theme-error);
    text-shadow: 0 0 0.3125rem var(--theme-error); /* 5px */
}

.terminal-line.info {
    color: var(--message-info);
    text-shadow: 0 0 0.3125rem var(--message-info); /* 5px */
}

.terminal-line.alert {
    color: var(--message-alert);
    text-shadow: 0 0 0.3125rem var(--message-alert); /* 5px */
}

.terminal-line.system {
    color: var(--message-system);
    text-shadow: 0 0 0.3125rem var(--message-system); /* 5px */
}

.terminal-line.anomaly {
    color: var(--message-anomaly);
    text-shadow: 0 0 0.3125rem var(--message-anomaly); /* 5px */
}

.terminal-line .user-text, 
.directory-text,
.terminal-line .path-text {
    font-family: inherit;  /* Hérite de .terminal-line (VT323) */
    font-size: inherit;    /* Hérite de .terminal-line */
    line-height: inherit;  /* Hérite de .terminal-line */
}

/* Swipe Navigation Styles */
.modal-image-container.touch-active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 13, 26, 0.1);
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-image-container.swipe-left::after,
.modal-image-container.swipe-right::after {
    content: '◈';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-primary);
    opacity: 0.8;
    pointer-events: none;
    animation: pulse 2s infinite;
}

.modal-image-container.swipe-left::after {
    right: 0.9375rem; /* 15px */
}

.modal-image-container.swipe-right::after {
    left: 0.9375rem; /* 15px */
}

/* Scrollbar styling */
.terminal-output::-webkit-scrollbar,
.terminal-style-content::-webkit-scrollbar {
    width: 0.5rem; /* 8px */
}

.terminal-output::-webkit-scrollbar-track,
.terminal-style-content::-webkit-scrollbar-track {
    background: var(--bg-terminal);
}

.terminal-output::-webkit-scrollbar-thumb,
.terminal-style-content::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-color);
    border-radius: var(--radius-sm); /* 4px */
}

/* Mobile View Close Button */
.mobile-view-close {
    position: fixed;
    top: var(--space-sm); /* 10px → 0.5rem */
    right: var(--space-sm); /* 10px → 0.5rem */
    width: var(--control-size-lg); /* 44px → 3rem */
    height: var(--control-size-lg); /* 44px → 3rem */
    background: var(--bg-terminal);
    border: var(--border-thin) solid var(--button-border); /* 1px → var(--border-thin) */
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 901;
    transition: all var(--transition-normal);
}

/* Mobile view close button hover - desktop only with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .mobile-view-close:hover {
        background: var(--button-hover-bg);
        border-color: var(--theme-error);
        color: var(--theme-error);
    }
}
 
/* Touch feedback for mobile */
.mobile-view-close:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}