/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1b26;
    color: #a9b1d6;
    padding: 20px;
}

/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

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

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Main Terminal Wrapper */
.wrapper {
    background: #24283b;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* Terminal Header */
.terminal-header {
    background: #1a1b26;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #414868;
}

.terminal-title {
    color: #a9b1d6;
    font-size: 0.9rem;
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.close {
    background: #f7768e;
}

.minimize {
    background: #e0af68;
}

.maximize {
    background: #9ece6a;
}

/* Header Content */
header {
    padding: 25px 30px 15px;
    text-align: center;
}

.ascii-art {
    font-size: 0.5rem;
    line-height: 1.2;
    color: #7aa2f7;
    white-space: pre;
    margin-bottom: 15px;
    overflow: auto;
    max-width: 100%;
}

.subtitle {
    color: #a9b1d6;
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0.8;
}

/* Terminal Text */
.terminal-text {
    padding: 10px 30px;
}

.terminal-line {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 8px;
    line-height: 1.5;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
    animation-delay: var(--delay, 0s);
}

.terminal-prompt {
    color: #73daca;
    margin-right: 10px;
    white-space: nowrap;
}

.command {
    color: #bb9af7;
}

.terminal-output {
    color: #a9b1d6;
    margin-left: 15px;
    font-size: 0.9rem;
}

/* Form Styles */
.form {
    padding: 20px 30px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: #1a1b26;
    border-radius: 6px;
    padding: 0 15px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: #7aa2f7;
}

.form input {
    flex: 1;
    background: transparent;
    border: none;
    color: #a9b1d6;
    font-size: 0.95rem;
    padding: 12px 15px;
    outline: none;
    width: 100%;
}

.form input::placeholder {
    color: #565f89;
}

.generate-btn {
    width: 100%;
    padding: 12px 0;
    background: #7aa2f7;
    color: #1a1b26;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.generate-btn:hover {
    background: #6b90e5;
    transform: translateY(-2px);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: translateY(0);
}

/* QR Code Section */
.qr-code {
    padding: 20px 30px 30px;
    display: none;
}

.wrapper.active .qr-code {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}

.wrapper.closing .qr-code {
    animation: fadeOut 0.3s ease forwards;
}

.processing-text {
    color: #e0af68;
    position: relative;
}

.processing-text::after {
    content: "";
    animation: dots 1.5s infinite;
}

.success {
    color: #9ece6a;
}

.wrapper.processing .processing,
.wrapper.success .success {
    display: flex;
}

.qr-container {
    background: #1a1b26;
    border-radius: 8px;
    padding: 25px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #414868;
    min-height: 250px;
    transition: opacity 0.3s ease;
}

.qr-container img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 0;
    background: #1a1b26;
    color: #7aa2f7;
    font-weight: bold;
    border: 2px solid #7aa2f7;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.download-btn:hover {
    background: #7aa2f7;
    color: #1a1b26;
}

.download-btn:active {
    transform: scale(0.98);
}

.download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.download-btn .icon {
    font-size: 1.2rem;
}

.downloading {
    position: relative;
    overflow: hidden;
}

.downloading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(122, 162, 247, 0.2), transparent);
    animation: downloadProgress 1.5s infinite;
}

/* Footer Styles */
footer {
    padding: 15px 30px;
    border-top: 1px solid #414868;
}

.command-blinker {
    display: inline-block;
    color: #a9b1d6;
    animation: blink 1s infinite;
}

/* Utility Classes */
.shake {
    animation: shake 0.5s ease;
    border-color: #f7768e !important;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .wrapper {
        width: 95%;
    }
    
    .terminal-line {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .wrapper {
        border-radius: 6px;
    }
    
    header {
        padding: 20px 20px 10px;
    }
    
    .terminal-text, 
    .form, 
    .qr-code,
    footer {
        padding: 15px 20px;
    }
    
    .ascii-art {
        font-size: 0.4rem;
    }
    
    .terminal-prompt {
        font-size: 0.8rem;
    }
    
    .form input {
        font-size: 0.85rem;
        padding: 10px;
    }
    
    .generate-btn,
    .download-btn {
        padding: 10px 0;
        font-size: 0.85rem;
    }
    
    .qr-container {
        padding: 15px;
        min-height: 200px;
    }
}

@media (max-width: 400px) {
    .ascii-art {
        font-size: 0.35rem;
    }
    
    .terminal-title {
        font-size: 0.8rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
}