:root {
    --bg-color: #050811;
    --panel-bg: rgba(18, 24, 38, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --secondary-hover: #db2777;
    --accent-color: #06b6d4;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --input-bg: rgba(15, 23, 42, 0.7);
    --input-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 15px 35px 0 rgba(0, 0, 0, 0.4);
    --glow-primary: 0 0 25px rgba(99, 102, 241, 0.5);
    --glow-secondary: 0 0 25px rgba(236, 72, 153, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Advanced Background animated blobs */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: float 25s infinite alternate ease-in-out;
}

.blob-1 {
    top: -15%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--primary-color), transparent 70%);
}

.blob-2 {
    bottom: -15%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--secondary-color), transparent 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 30%;
    left: 30%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--accent-color), transparent 70%);
    opacity: 0.3;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33% { transform: translate(10%, 15%) scale(1.1) rotate(10deg); }
    66% { transform: translate(-5%, 5%) scale(0.9) rotate(-5deg); }
    100% { transform: translate(-10%, -15%) scale(1) rotate(0deg); }
}

/* Split Main Layout */
.main-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Hero Section */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    max-height: 800px;
    animation: slideInLeft 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 2rem;
    position: relative;
}

.logo i {
    color: var(--primary-color);
    filter: drop-shadow(0 0 15px var(--primary-color));
    animation: bounceIcon 3s infinite ease-in-out;
}

.logo h1 {
    font-size: 3rem;
    margin: 0;
    letter-spacing: -2px;
}

.logo span {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-tagline {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1rem;
}

.gradient-text {
    background: linear-gradient(to right, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 3rem;
}

/* 3D Image Container */
.image-wrapper {
    width: 100%;
    max-width: 500px;
    position: relative;
    transform-style: preserve-3d;
}

.hero-3d-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
    transform: translateZ(50px);
    animation: slowFloat 6s infinite ease-in-out;
}

@keyframes slowFloat {
    0%, 100% { transform: translateZ(50px) translateY(0); }
    50% { transform: translateZ(50px) translateY(-15px); }
}

@keyframes bounceIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px) scale(1.1); }
}

/* App Wrapper & Glass Container */
.app-wrapper {
    flex: 1.2;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.app-container {
    width: 100%;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: 30px;
    padding: 3rem;
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}

/* Animations for Container */
.slide-in-right {
    opacity: 0;
    animation: slideInRight 1s 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stagger-item {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.4s; }
.stagger-item:nth-child(2) { animation-delay: 0.5s; }
.stagger-item:nth-child(3) { animation-delay: 0.6s; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.panel-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.input-group label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

textarea, select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

textarea {
    resize: none;
}

textarea:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: var(--glow-primary);
    background: rgba(15, 23, 42, 0.9);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem top 50%;
    background-size: 0.65rem auto;
}

select option {
    background-color: #0f172a;
}

/* Customization Section */
.customization-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--input-border);
}

.customization-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.color-controls, .style-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.style-controls {
    margin-bottom: 0;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    padding: 0.5rem 0.8rem;
    gap: 0.8rem;
    transition: all 0.3s ease;
}

.color-picker-wrapper:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    background: none;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.color-value {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Preview Panel */
.preview-panel {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--input-border);
}

.qr-preview-container {
    position: relative;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d; /* For Tilt */
}

/* The QR Canvas logic */
#qr-canvas {
    border-radius: 16px;
    overflow: hidden;
    transform: translateZ(30px); /* Popping out inside the tilt */
}

#qr-canvas svg, #qr-canvas canvas {
    display: block;
    border-radius: 14px;
}

/* Glass Reflection over QR */
.glass-reflection {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    animation: shine 6s infinite;
    pointer-events: none;
    border-radius: 24px;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

/* Scanning animation effect over QR */
.scanning-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color), 0 0 30px var(--primary-color);
    opacity: 0.6;
    animation: scan 2.5s infinite linear;
    pointer-events: none;
    border-radius: 50%;
    transform: translateZ(40px);
}

@keyframes scan {
    0% { top: 5%; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { top: 95%; opacity: 0; }
}

/* Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s;
}

.btn:active::after {
    transform: translate(-50%, -50%) scale(1);
    transition: 0s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    color: white;
    box-shadow: var(--glow-primary);
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-4px) scale(1.02);
}

/* Footer */
.app-footer {
    width: 100%;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 1.1rem;
    position: relative;
    z-index: 10;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.app-footer i {
    color: var(--secondary-color);
    animation: pulse 2s infinite;
    margin: 0 4px;
}

.app-footer strong {
    color: var(--text-main);
    letter-spacing: 2px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(236, 72, 153, 0.5));
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Entrance Animations */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* History Modal & Icons */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--glass-shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--input-border);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--secondary-color);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-item {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.history-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.history-data {
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-history {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: flex-end;
}

.btn-small {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    width: auto;
}

/* Ultra Responsive Design */
@media (max-width: 1200px) {
    .main-layout {
        gap: 2rem;
    }
    .hero-tagline {
        font-size: 2.8rem;
    }
}

@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
        padding: 2rem 1rem;
        gap: 3rem;
    }

    .hero-section {
        max-height: none;
        align-items: center;
        text-align: center;
    }

    .hero-content {
        align-items: center;
    }

    .image-wrapper {
        max-width: 400px;
        margin: 2rem 0;
    }

    .app-wrapper {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .preview-panel {
        flex-direction: column;
    }

    .action-buttons {
        width: 100%;
        flex-direction: row;
    }

    .color-controls, .style-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hero-tagline {
        font-size: 2.2rem;
    }

    .logo {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .hero-tagline {
        font-size: 1.8rem;
    }

    .image-wrapper {
        max-width: 100%;
    }
}
