/* ========================================================================
   3D Printer Loading Animation
   ======================================================================== */

.printer-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.printer-loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.printer-loader-container {
    text-align: center;
}

.loader-gif {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
}

.printer-loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.printer-loader-container {
    text-align: center;
}

/* 3D Printer */
.printer-3d {
    width: 200px;
    height: 200px;
    position: relative;
    margin: 0 auto 2rem;
    perspective: 1000px;
}

/* Printer Body */
.printer-body {
    position: absolute;
    width: 160px;
    height: 120px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotateX(-20deg) rotateY(20deg);
    transform-style: preserve-3d;
    animation: printerRotate 4s ease-in-out infinite;
}

@keyframes printerRotate {
    0%, 100% { transform: translate(-50%, -50%) rotateX(-20deg) rotateY(20deg); }
    50% { transform: translate(-50%, -50%) rotateX(-20deg) rotateY(40deg); }
}

/* Printer Main Box */
.printer-main {
    position: absolute;
    width: 160px;
    height: 100px;
    background: linear-gradient(135deg, #ffffff 0%, #e6f0ff 100%);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d;
}

.printer-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0));
    border-radius: 8px;
}

/* Printer Top */
.printer-top {
    position: absolute;
    width: 160px;
    height: 40px;
    background: linear-gradient(135deg, #0056D2 0%, #0080FF 100%);
    border-radius: 8px 8px 0 0;
    top: -40px;
    box-shadow: 0 5px 20px rgba(0, 86, 210, 0.4);
    transform-style: preserve-3d;
}

.printer-top::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Paper Tray */
.paper-tray {
    position: absolute;
    width: 100px;
    height: 60px;
    background: #ffffff;
    border: 3px solid #0056D2;
    border-radius: 4px;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

/* Paper Animation */
.paper {
    position: absolute;
    width: 80px;
    height: 100px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid #ddd;
    border-radius: 2px;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    animation: paperPrint 3s ease-in-out infinite;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.paper::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 4px;
    background: #0056D2;
    top: 20px;
    left: 10px;
    border-radius: 2px;
    opacity: 0;
    animation: textAppear 3s ease-in-out infinite;
}

.paper::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 4px;
    background: #0080FF;
    top: 30px;
    left: 10px;
    border-radius: 2px;
    opacity: 0;
    animation: textAppear 3s ease-in-out infinite 0.2s;
}

@keyframes paperPrint {
    0% { bottom: -100px; }
    50% { bottom: 10px; }
    100% { bottom: -100px; }
}

@keyframes textAppear {
    0%, 30% { opacity: 0; width: 0; }
    50% { opacity: 1; width: 60px; }
    100% { opacity: 1; width: 60px; }
}

/* Print Head */
.print-head {
    position: absolute;
    width: 40px;
    height: 12px;
    background: linear-gradient(135deg, #0056D2 0%, #0080FF 100%);
    border-radius: 6px;
    top: 20px;
    left: 10px;
    box-shadow: 0 3px 10px rgba(0, 86, 210, 0.5);
    animation: printHeadMove 2s ease-in-out infinite;
}

.print-head::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes printHeadMove {
    0%, 100% { left: 10px; }
    50% { left: 110px; }
}

/* LED Indicators */
.led-indicators {
    position: absolute;
    top: 10px;
    right: 15px;
    display: flex;
    gap: 8px;
}

.led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0.3;
}

.led.active {
    opacity: 1;
    animation: ledBlink 1s ease-in-out infinite;
}

.led.green {
    background: #10B981;
    box-shadow: 0 0 10px #10B981;
}

.led.blue {
    background: #3B82F6;
    box-shadow: 0 0 10px #3B82F6;
    animation-delay: 0.3s;
}

.led.orange {
    background: #F59E0B;
    box-shadow: 0 0 10px #F59E0B;
    animation-delay: 0.6s;
}

@keyframes ledBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Control Panel */
.control-panel {
    position: absolute;
    width: 60px;
    height: 40px;
    background: rgba(0, 86, 210, 0.1);
    border: 2px solid #0056D2;
    border-radius: 4px;
    top: 30px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.control-button {
    width: 40px;
    height: 6px;
    background: rgba(0, 86, 210, 0.3);
    border-radius: 3px;
}

/* Loading Text */
.loader-text {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loader-subtext {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 500;
}

/* Progress Bar */
.loader-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 2px;
    animation: progressMove 2s ease-in-out infinite;
}

@keyframes progressMove {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Dots Animation */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Paper Stack in Tray */
.paper-stack {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
}

.paper-sheet {
    width: 100%;
    height: 3px;
    background: #ffffff;
    border: 1px solid #ddd;
    margin-bottom: 2px;
    border-radius: 1px;
}

/* Ink Cartridges */
.ink-cartridges {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 4px;
}

.ink-cartridge {
    width: 12px;
    height: 20px;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.ink-cartridge.cyan { background: linear-gradient(to top, #06B6D4 0%, #06B6D4 70%, #e0e0e0 70%); }
.ink-cartridge.magenta { background: linear-gradient(to top, #EC4899 0%, #EC4899 70%, #e0e0e0 70%); }
.ink-cartridge.yellow { background: linear-gradient(to top, #F59E0B 0%, #F59E0B 70%, #e0e0e0 70%); }
.ink-cartridge.black { background: linear-gradient(to top, #1F2937 0%, #1F2937 70%, #e0e0e0 70%); }

/* 3D Shadow Effect */
.printer-shadow {
    position: absolute;
    width: 180px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    animation: shadowPulse 2s ease-in-out infinite;
}

@keyframes shadowPulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.3; }
    50% { transform: translateX(-50%) scale(1.1); opacity: 0.5; }
}

/* Responsive */
@media (max-width: 768px) {
    .printer-3d {
        width: 150px;
        height: 150px;
    }
    
    .printer-body {
        width: 120px;
        height: 90px;
    }
    
    .printer-main {
        width: 120px;
        height: 75px;
    }
    
    .printer-top {
        width: 120px;
        height: 30px;
        top: -30px;
    }
    
    .paper-tray {
        width: 75px;
        height: 45px;
    }
    
    .loader-text {
        font-size: 1.25rem;
    }
    
    .loader-subtext {
        font-size: 0.875rem;
    }
}
