/* ===================================
   C-Matrix Loading Screen
   Premium Cinematic Hacker Theme
   =================================== */

/* Full-Screen Overlay */
.boot-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0f1e;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

/* Hidden State */
.boot-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Glow Effect Before Exit */
.boot-loader.exiting {
    filter: brightness(1.3);
    transition: filter 0.3s ease;
}

/* Matrix Canvas Background */
.matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Scanline Overlay */
.scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 204, 0.03) 0px,
        rgba(0, 0, 0, 0.05) 1px,
        rgba(0, 255, 204, 0.03) 2px
    );
    pointer-events: none;
    animation: scanlineMove 8s linear infinite;
}

@keyframes scanlineMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* Vignette Overlay */
.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: radial-gradient(
        circle at center,
        transparent 0%,
        transparent 60%,
        rgba(10, 15, 30, 0.5) 100%
    );
    pointer-events: none;
}

/* Centered Terminal Panel */
.terminal-panel {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 650px;
    background: rgba(0, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 204, 0.4);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    box-shadow: 
        0 0 40px rgba(0, 255, 204, 0.2),
        0 0 80px rgba(0, 255, 204, 0.1),
        inset 0 0 60px rgba(0, 255, 204, 0.03);
    animation: terminalScaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    /* Fix overflow and text issues */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@keyframes terminalScaleIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Terminal Header */
.terminal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 255, 204, 0.2);
}

.terminal-dots {
    display: flex;
    gap: 0.5rem;
}

.terminal-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 255, 204, 0.3);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
}

.terminal-dots span:nth-child(1) {
    background: rgba(255, 95, 95, 0.6);
    box-shadow: 0 0 8px rgba(255, 95, 95, 0.4);
}

.terminal-dots span:nth-child(2) {
    background: rgba(255, 204, 0, 0.6);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.4);
}

.terminal-dots span:nth-child(3) {
    background: rgba(0, 255, 204, 0.6);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
}

.terminal-title {
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.75rem;
    color: rgba(0, 255, 204, 0.7);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
}

/* Terminal Body */
.terminal-body {
    min-height: 80px;
    margin-bottom: 2rem;
}

.terminal-line {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: clamp(0.85rem, 2vw, 1.05rem);
    color: #00ffcc;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.6);
    letter-spacing: 0.02em;
    line-height: 1.6;
    /* Allow text to wrap properly */
    flex-wrap: wrap;
    word-break: break-word;
}

.terminal-line .prompt {
    color: #00ffcc;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.8);
    flex-shrink: 0;
}

.terminal-line .text {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.terminal-line .cursor {
    display: inline-block;
    width: 8px;
    height: 18px;
    background: #00ffcc;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.8);
    animation: cursorBlink 0.8s ease-in-out infinite;
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Access Granted Message */
.terminal-line.access-granted .text {
    color: #00ff88;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.9);
    animation: accessGrantedPulse 0.3s ease-out;
}

@keyframes accessGrantedPulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 20px rgba(0, 255, 136, 0.9);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 0 30px rgba(0, 255, 136, 1);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 20px rgba(0, 255, 136, 0.9);
    }
}

/* Progress Container */
.progress-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Progress Bar */
.progress-bar {
    position: relative;
    flex: 1;
    height: 6px;
    background: rgba(0, 255, 204, 0.15);
    border-radius: 3px;
    overflow: visible;
    box-shadow: inset 0 0 10px rgba(0, 255, 204, 0.1);
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        rgba(0, 255, 204, 0.8),
        rgba(0, 255, 204, 1),
        rgba(0, 255, 136, 0.9));
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.7);
    border-radius: 3px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Progress Bar Pulse (>80%) */
.progress-fill.pulsing {
    animation: progressPulse 1s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(0, 255, 204, 0.7);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 255, 204, 1);
    }
}

/* Progress Shine Effect */
.progress-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: progressShine 2s linear infinite;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Progress Percentage */
.progress-percentage {
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.875rem;
    color: #00ffcc;
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.6);
    font-weight: 600;
    min-width: 3.5rem;
    text-align: right;
}

/* Skip Button */
.skip-loader-btn {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10001;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 234, 255, 0.25);
    border: 2px solid rgba(0, 234, 255, 0.6);
    border-radius: 8px;
    color: #00eaff;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 234, 255, 0.3);
    /* Ensure visibility */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.skip-loader-btn i {
    font-size: 0.85rem;
}

.skip-loader-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(0, 234, 255, 0.1);
    border-color: rgba(0, 234, 255, 0.3);
    box-shadow: none;
}

.skip-loader-btn:hover:not(:disabled),
.skip-loader-btn:focus-visible:not(:disabled) {
    background: rgba(0, 234, 255, 0.4);
    border-color: rgba(0, 234, 255, 0.9);
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(0, 234, 255, 0.6), 0 0 40px rgba(0, 234, 255, 0.3);
}

.skip-loader-btn:focus-visible {
    outline: 3px solid #00eaff;
    outline-offset: 3px;
}

/* ===================================
   Responsive Design
   =================================== */

/* Mobile Small (320px - 480px) */
@media screen and (max-width: 480px) {
    .terminal-panel {
        width: 92%;
        max-width: none;
        padding: 1.25rem 1rem;
        margin: 0 auto;
    }
    
    .terminal-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    
    .terminal-dots {
        gap: 0.4rem;
    }
    
    .terminal-dots span {
        width: 9px;
        height: 9px;
    }
    
    .terminal-title {
        font-size: 0.65rem;
        letter-spacing: 0.08em;
    }
    
    .terminal-line {
        font-size: 0.8rem;
        gap: 0.4rem;
    }
    
    .terminal-body {
        min-height: 60px;
        margin-bottom: 1.25rem;
    }
    
    .progress-container {
        gap: 0.75rem;
    }
    
    .progress-bar {
        height: 5px;
    }
    
    .progress-percentage {
        font-size: 0.75rem;
        min-width: 2.75rem;
    }
    
    .skip-loader-btn {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.5rem 0.875rem;
        font-size: 0.7rem;
    }
    
    .skip-loader-btn i {
        font-size: 0.65rem;
    }
}

/* Tablet (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .terminal-panel {
        width: 90%;
        max-width: 550px;
        padding: 1.5rem 1.75rem;
    }
    
    .terminal-title {
        font-size: 0.7rem;
    }
    
    .terminal-line {
        font-size: 0.9rem;
    }
    
    .terminal-body {
        min-height: 70px;
    }
    
    .progress-bar {
        height: 5px;
    }
    
    .progress-percentage {
        font-size: 0.825rem;
    }
    
    .skip-loader-btn {
        top: 1.25rem;
        right: 1.25rem;
        padding: 0.625rem 1.125rem;
        font-size: 0.8rem;
    }
}

/* Landscape Mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .terminal-panel {
        padding: 1rem 1.5rem;
        max-width: 500px;
    }
    
    .terminal-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }
    
    .terminal-body {
        min-height: 50px;
        margin-bottom: 1rem;
    }
    
    .terminal-line {
        font-size: 0.8rem;
    }
    
    .skip-loader-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.4rem 0.75rem;
        font-size: 0.7rem;
    }
}

/* ===================================
   Accessibility - Reduced Motion
   =================================== */
@media (prefers-reduced-motion: reduce) {
    .boot-loader,
    .terminal-panel,
    .terminal-line,
    .skip-loader-btn {
        animation: none !important;
        transition: none !important;
    }
    
    .matrix-canvas,
    .scanline-overlay {
        display: none;
    }
    
    .terminal-panel {
        opacity: 1;
        transform: none;
    }
    
    .cursor {
        animation: none;
        opacity: 1;
    }
    
    .progress-fill,
    .progress-shine {
        transition: none;
        animation: none;
    }
}

