/* ===== Base Reset & Background ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

.hidden { display: none !important; }

body {
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #e2e8f0;
    background: #0a0a1a;
    overflow-x: hidden;
}

.bg-animated {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
}

/* ===== App Container ===== */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.glass-card {
    background: rgba(15, 15, 35, 0.75);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(139, 92, 246, 0.06);
}

.app-card {
    width: 100%;
    max-width: 520px;
    padding: 32px;
}

/* ===== Header ===== */
.app-header {
    text-align: center;
    margin-bottom: 28px;
}

.app-icon {
    font-size: 36px;
    color: #8b5cf6;
    margin-bottom: 12px;
}

.app-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.app-subtitle {
    font-size: 13px;
    color: #94a3b8;
}

/* ===== Form Elements ===== */
.input-group {
    margin-bottom: 18px;
    position: relative;
}

.input-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.glass-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.glass-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
}

/* Options Row */
.options-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.glass-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: none;
}

.glass-select option {
    background: #1a1a2e;
    color: #e2e8f0;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 2px;
}

.color-label {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: #94a3b8;
}

/* ===== Buttons ===== */
.btn-generate {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    margin-bottom: 20px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45);
}

.btn-generate:active {
    transform: translateY(0);
}

/* ===== QR Output ===== */
.qr-output {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(139, 92, 246, 0.2);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
}

.qr-placeholder {
    text-align: center;
    color: #64748b;
}

.qr-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

.qr-placeholder p {
    font-size: 13px;
}

.qr-canvas {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-canvas img {
    border-radius: 8px;
}

/* ===== Download Actions ===== */
.download-actions {
    display: flex;
    gap: 10px;
}

.btn-download, .btn-copy-qr {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-download {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.btn-download:hover {
    background: rgba(52, 211, 153, 0.25);
}

.btn-copy-qr {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.btn-copy-qr:hover {
    background: rgba(139, 92, 246, 0.25);
}

/* ===== Floating Overlay Panel ===== */
.overlay-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: rgba(15, 15, 35, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
    padding: 20px;
    min-width: 260px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(139, 92, 246, 0.1);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #e2e8f0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.overlay-panel.collapsed { transform: translateY(calc(100% - 48px)); }

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.overlay-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.overlay-title .icon-3d { color: #8b5cf6; font-size: 18px; }

.overlay-toggle {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #a78bfa;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.overlay-toggle:hover { background: rgba(139, 92, 246, 0.3); }

.overlay-body { display: flex; flex-direction: column; gap: 10px; }

.overlay-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

.overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.btn-back {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    transform: translateX(-2px);
}

.btn-source {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-source:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45);
}

.open-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.overlay-desc .accent-text { color: #a78bfa; }

/* ===== Source Code Viewer ===== */
.source-viewer {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(10, 10, 26, 0.98);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.source-viewer.active { opacity: 1; visibility: visible; }

.source-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(15, 15, 35, 0.95);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.source-header-left { display: flex; align-items: center; gap: 12px; }

.source-filename {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #a78bfa;
    font-weight: 600;
}

.source-badge {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    color: #34d399;
    font-weight: 600;
}

.source-header-right { display: flex; align-items: center; gap: 8px; }

.btn-copy-source, .btn-close-source {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #94a3b8;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-copy-source:hover, .btn-close-source:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.source-body { flex: 1; overflow: auto; padding: 0; }
.source-body pre { margin: 0; padding: 24px; font-size: 13px; line-height: 1.6; }
.source-body code { font-family: 'JetBrains Mono', monospace; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .app-card { padding: 20px; }
    .options-row { grid-template-columns: 1fr; }
    .overlay-panel {
        bottom: 12px;
        right: 12px;
        left: 12px;
        min-width: unset;
        max-width: unset;
    }
    .source-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .source-body pre { padding: 16px; font-size: 11px; }
}
