:root {
        --bg-color: #170d2b;
        --bg-gradient: linear-gradient(135deg, #1b0e35 0%, #2f1059 100%);
        --panel-bg: rgba(42, 27, 77, 0.6);
        --panel-border: rgba(255, 255, 255, 0.05);
        --input-bg: #11091e;
        --input-border: rgba(255, 255, 255, 0.1);
        --input-focus: #a855f7;
        --primary: #9333ea;
        --primary-hover: #a855f7;
        --text-main: #ffffff;
        --text-muted: #9ca3af;
        --error: #ef4444;
        --success: #10b981;
}

/* Reset y base */
*,
*::before,
*::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
}

body {
        font-family: 'Inter', system-ui, sans-serif;
        background: var(--bg-color);
        background-image: var(--bg-gradient);
        color: var(--text-main);
        min-height: 100vh;
        display: flex;
        flex-direction: column;
}

/* Contenedor principal responsive full-width-ish */
.container {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        padding: 3rem 2rem;
        flex: 1;
}

/* Header */
header {
        margin-bottom: 3rem;
        text-align: left;
}

.logo {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 0.5rem;
}

.logo span {
        font-size: 1.8rem;
        font-weight: 800;
        letter-spacing: 0.05em;
        background: linear-gradient(to right, #fff, #d8b4fe);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
}

.slogan {
        color: var(--text-muted);
        font-size: 1.1rem;
}

/* Layout de 2 columnas para Desktop */
.app-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
        align-items: flex-start;
}

@media (min-width: 900px) {
        .app-grid {
                grid-template-columns: 1fr 1fr;
                gap: 3rem;
        }
}

/* Paneles Estilo Glassmorphism */
.panel {
        background: var(--panel-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--panel-border);
        border-radius: 16px;
        padding: 2rem;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Párrafo informativo */
.info-block {
        background: rgba(255, 255, 255, 0.03);
        border-left: 4px solid var(--primary);
        padding: 1.25rem 1.5rem;
        border-radius: 0 12px 12px 0;
        margin-bottom: 2rem;
        font-size: 0.95rem;
        line-height: 1.6;
        color: var(--text-muted);
}

/* Toggle URL / WhatsApp */
.toggle-group {
        display: flex;
        gap: 0.75rem;
        margin-bottom: 2rem;
        background: var(--input-bg);
        padding: 0.5rem;
        border-radius: 12px;
        border: 1px solid var(--input-border);
}

.toggle-btn {
        flex: 1;
        padding: 0.8rem;
        border: none;
        border-radius: 8px;
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        font-weight: 600;
        font-size: 0.95rem;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn:hover {
        color: var(--text-main);
        background: rgba(255, 255, 255, 0.05);
}

.toggle-btn.active {
        background: var(--primary);
        color: #fff;
        box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Inputs */
.form-group {
        margin-bottom: 1.5rem;
}

label {
        display: block;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-muted);
        margin-bottom: 0.5rem;
}

input {
        width: 100%;
        padding: 1rem 1.25rem;
        background: var(--input-bg);
        border: 1px solid var(--input-border);
        color: var(--text-main);
        border-radius: 12px;
        font-size: 1rem;
        transition: all 0.2s;
}

input::placeholder {
        color: #4b5563;
}

input:focus {
        outline: none;
        border-color: var(--input-focus);
        box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

input.valid {
        border-color: var(--success);
}

input.error {
        border-color: var(--error);
}

.error-msg {
        font-size: 0.85rem;
        color: var(--error);
        margin-top: 0.5rem;
        min-height: 1.2em;
        display: block;
}

/* Botón generar */
.btn-generate {
        width: 100%;
        padding: 1rem;
        background: var(--primary);
        color: #fff;
        border: none;
        border-radius: 12px;
        font-size: 1.1rem;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s;
        box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
        margin-top: 1rem;
}

.btn-generate:hover:not(:disabled) {
        background: var(--primary-hover);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(147, 51, 234, 0.4);
}

.btn-generate:disabled {
        background: #374151;
        color: #9ca3af;
        box-shadow: none;
        cursor: not-allowed;
}

/* Preview QR (Panel Derecho) */
.result-panel {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        min-height: 100%;
}

.empty-state {
        color: var(--text-muted);
        font-size: 1.1rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        opacity: 0.5;
}

.empty-state svg {
        width: 48px;
        height: 48px;
        fill: currentColor;
}

.qr-result {
        width: 100%;
        animation: fadeIn 0.4s ease forwards;
        display: flex;
        flex-direction: column;
        align-items: center;
}

.qr-preview {
        background: #ffffff;
        padding: 1rem;
        border-radius: 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        margin-bottom: 1.5rem;
        display: inline-block;
}

.qr-preview canvas {
        width: 250px !important;
        height: 250px !important;
        display: block;
}

.qr-target-label {
        font-size: 0.9rem;
        color: var(--text-muted);
        margin: 0.5rem 0 2rem;
        word-break: break-all;
        background: rgba(0, 0, 0, 0.2);
        padding: 0.75rem 1rem;
        border-radius: 8px;
        width: 100%;
}

/* Botones descarga */
.download-buttons {
        display: flex;
        gap: 1rem;
        width: 100%;
        justify-content: center;
}

.btn-download {
        flex: 1;
        padding: 0.8rem 1rem;
        background: transparent;
        color: var(--text-main);
        border: 1px solid var(--input-border);
        border-radius: 10px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
}

.btn-download:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.3);
}

/* Utilidades */
.hidden {
        display: none !important;
}

@keyframes fadeIn {
        from {
                opacity: 0;
                transform: translateY(15px);
        }

        to {
                opacity: 1;
                transform: translateY(0);
        }
}

/* Responsive mobile */
@media (max-width: 480px) {
        .container {
                padding: 1.5rem 1rem;
        }

        .download-buttons {
                flex-direction: column;
        }

        .btn-download {
                width: 100%;
        }
}

/* Footer */
.app-footer {
        text-align: center;
        padding: 1.5rem;
        margin-top: auto;
        /* Pushes to bottom */
        font-size: 0.85rem;
        color: var(--text-muted);
}

.app-footer a {
        color: #fff;
        text-decoration: none;
        font-weight: 600;
        transition: opacity 0.2s;
}

.app-footer a:hover {
        opacity: 0.8;
}