/* HTML to Elementor - Web App Styles */

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --secondary: #4a5568;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-card: #ffffff;
    
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 1rem;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.card-header h3 svg {
    color: var(--primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

/* Textarea */
textarea {
    width: 100%;
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
    background: #f8f9fa;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Info Content */
.info-content {
    padding: 1.5rem;
}

.info-item {
    display: flex;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.info-item strong {
    min-width: 120px;
    color: var(--text-secondary);
    font-weight: 600;
}

.info-item span {
    color: var(--text-primary);
    word-break: break-all;
}

/* Preview */
.preview-container {
    padding: 1.5rem;
    background: #f8f9fa;
    min-height: 300px;
}

#previewFrame {
    width: 100%;
    min-height: 300px;
    height: 400px;
    resize: vertical;
    overflow: auto;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
}

/* Code Blocks */
pre {
    margin: 0;
    padding: 1.5rem;
    background: #1e1e1e;
    overflow-x: auto;
    max-height: 400px;
}

code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #d4d4d4;
    line-height: 1.6;
}

/* Export Section */
.export-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.export-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.modal-body ul,
.modal-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

.modal-body p {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

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

/* Modal wide (copy JSON) */
.modal-content--wide {
    max-width: 860px;
}

.copy-modal-hint {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: #2c5282;
    line-height: 1.6;
}

.copy-modal-hint kbd {
    display: inline-block;
    background: #2d3748;
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

.copy-json-textarea {
    width: 100%;
    height: 320px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    background: #1a202c;
    color: #68d391;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    resize: vertical;
    outline: none;
    cursor: text;
    user-select: all;
}

.copy-modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-start;
    align-items: center;
}

/* ── Warnings block (sistema de avisos de conversión) ── */
.warnings-block {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.warning-item {
    font-size: 0.8rem;
    color: var(--warning);
    background: rgba(237, 137, 54, 0.08);
    border: 1px solid rgba(237, 137, 54, 0.2);
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    line-height: 1.4;
}

/* ── Feedback visual botón copiar ── */
.btn-icon.copied {
    color: var(--success);
    transform: scale(1.15);
    transition: var(--transition);
}

/* ── Botón nav icono (dark mode) ── */
.btn-nav--icon {
    padding: 0.5rem;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ══════════════════════════════════════════════════════
   DARK MODE
══════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg-primary:   #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card:      #0f3460;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-muted:   #718096;
    --border:       #2d3748;
    --shadow:       0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
    --shadow-lg:    0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.3);
}

[data-theme="dark"] body {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

[data-theme="dark"] .card-header {
    background: linear-gradient(to right, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    border-bottom-color: var(--border);
}

[data-theme="dark"] textarea,
[data-theme="dark"] input {
    background: #1a1a2e;
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .info-content,
[data-theme="dark"] .info-item {
    color: var(--text-primary);
}

[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--border);
}

[data-theme="dark"] .footer {
    background: #0f0f1a;
    border-top-color: var(--border);
}

[data-theme="dark"] .export-section {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] pre {
    background: #0d0d1a;
}

/* ══════════════════════════════════════════════════════
   PANEL HISTORIAL
══════════════════════════════════════════════════════ */
.history-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
}

.history-overlay.active {
    display: block;
}

.history-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--border);
}

.history-panel.active {
    right: 0;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.history-panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.history-panel-header .modal-close {
    color: white;
    opacity: 0.8;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    margin-top: 2rem;
}

.history-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.history-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.2rem;
    transition: color 0.2s;
}

.history-delete:hover { color: var(--danger); }

.history-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-restore {
    width: 100%;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 2rem;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .export-buttons {
        flex-direction: column;
    }
}

/* ══════════════════════════════════════════════════════
   KO-FI BUTTON
══════════════════════════════════════════════════════ */
.btn-kofi {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #72a4f2;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-kofi:hover {
    background: #5a8fdf;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(114,164,242,0.4);
}

/* ══════════════════════════════════════════════════════
   APPRECIATION BANNER (donación tras 3ª conversión)
══════════════════════════════════════════════════════ */
.appreciation-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 340px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    z-index: 9000;
    animation: slideIn 0.4s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.appreciation-close {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
}

.appreciation-close:hover { color: white; }

.appreciation-content {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.appreciation-emoji { font-size: 1.75rem; line-height: 1; }

.appreciation-content strong { display: block; font-size: 0.95rem; margin-bottom: 0.2rem; }
.appreciation-content p { font-size: 0.82rem; opacity: 0.9; margin: 0; }

.btn-kofi-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: white;
    color: #72a4f2;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}

.btn-kofi-banner:hover {
    background: #fff5f5;
    transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════
   FEEDBACK MODAL
══════════════════════════════════════════════════════ */
.modal-content--feedback {
    max-width: 520px;
}

.feedback-intro {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.feedback-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.feedback-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    user-select: none;
}

.feedback-option:hover {
    border-color: var(--primary);
    background: rgba(102,126,234,0.04);
}

.feedback-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.feedback-field {
    margin-bottom: 1rem;
}

.feedback-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.feedback-field textarea,
.feedback-field input[type="email"] {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.feedback-field textarea:focus,
.feedback-field input[type="email"]:focus {
    outline: none;
    border-color: var(--primary);
}

.feedback-note {
    font-size: 0.8rem;
    color: var(--primary);
    background: rgba(102,126,234,0.07);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 1.25rem;
}

.feedback-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════
   UNAUTHORIZED BANNER
══════════════════════════════════════════════════════ */
.unauthorized-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
}

.unauthorized-banner a {
    color: white;
    font-weight: 700;
    text-decoration: underline;
}

/* Dark mode overrides para nuevos componentes */
[data-theme="dark"] .feedback-option {
    background: var(--bg-secondary);
}

[data-theme="dark"] .feedback-option:hover {
    background: rgba(102,126,234,0.1);
}