/* ==========================================================================
   ROCALINKS - SISTEMA DE DISEÑO & ESTILOS PREMIUM
   ========================================================================== */

:root {
    --bg-color: #0b0f19;
    --panel-bg: rgba(17, 25, 40, 0.75);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary: #8b5cf6; /* Violeta */
    --primary-hover: #a78bfa;
    --accent: #06b6d4; /* Cian */
    --accent-hover: #22d3ee;
    --success: #10b981;
    --danger: #ef4444;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
}

/* Fondos Decorativos Dinámicos */
.background-decor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: pulse 10s infinite alternate ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    bottom: -150px;
    left: -150px;
    animation-delay: 2s;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(20px, 30px); }
}

/* Contenedor Principal */
.app-container {
    width: 100%;
    max-width: 650px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
    animation: pulseLogo 4s infinite ease-in-out;
}

@keyframes pulseLogo {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--accent);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 350;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    margin-bottom: 25px;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 12px 20px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Contenido de Tabs */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* Inputs y Formularios */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.input-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    padding: 16px 16px 16px 48px;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

.input-wrapper input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.input-wrapper input:focus + .input-icon {
    color: var(--accent);
}

/* Botones */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    outline: none;
    padding: 16px;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.35);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Controles de Opciones / Proveedor */
.options-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: -4px;
    margin-bottom: 2px;
}

.provider-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.provider-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.provider-select:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.provider-select option {
    background: #0f172a;
    color: var(--text-primary);
}

/* Opciones del Generador QR */
.qr-options-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: -4px;
    margin-bottom: 2px;
}

.checkbox-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
    transition: var(--transition-smooth);
}

.checkbox-container:hover {
    color: var(--text-primary);
}

.checkbox-container input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Resultados */
.result-container {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: slideDown 0.4s ease-out;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-container h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--accent);
}

.provider-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent);
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.result-box {
    display: flex;
    gap: 10px;
}

.result-box input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 16px;
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    cursor: text;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 18px;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.quick-qr-section {
    margin-top: 12px;
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-text-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* QR Result Panel */
.qr-display-wrapper {
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    max-width: 240px;
    transition: transform 0.2s ease;
}

@keyframes qrPulse {
    0% { transform: scale(0.94); opacity: 0.6; }
    50% { transform: scale(1.03); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.qr-pulse {
    animation: qrPulse 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qr-caption {
    margin-top: 12px;
    font-size: 0.78rem;
    color: #4b5563;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-weight: 500;
}

.history-qr-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent);
    border-radius: 4px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.history-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-left: auto;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrcode img {
    max-width: 100%;
    height: auto;
}

.qr-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.qr-actions .btn-secondary {
    font-weight: 550;
    font-size: 0.9rem;
    gap: 8px;
}

/* Historial */
.history-section {
    padding: 25px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.history-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-clear:hover {
    color: var(--danger);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar personalizado para el historial */
.history-list::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.01);
}
.history-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}
.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

.empty-history {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
    padding: 20px 0;
    font-style: italic;
}

.history-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: var(--transition-smooth);
    animation: fadeIn 0.3s ease-out;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Permite que colapse el texto largo */
}

.history-original {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.history-short {
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-short:hover {
    text-decoration: underline;
}

.history-provider-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--primary-hover);
    border-radius: 4px;
    font-weight: 500;
    flex-shrink: 0;
}

.history-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon-sm {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.btn-icon-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.btn-icon-sm.btn-delete:hover {
    color: var(--danger);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(17, 25, 40, 0.9);
    border: 1px solid var(--accent);
    padding: 12px 24px;
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 550;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 999;
    transition: var(--transition-smooth);
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .glass-panel {
        padding: 20px;
    }
    .logo h1 {
        font-size: 2rem;
    }
}
