/* Floating Widget Styles */
#floating-widget { z-index: 99999; }
#floating-bubble {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, #667eea, #27ae60);
    border-radius: 50%;
    box-shadow: 0 4px 18px rgba(102,126,234,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: box-shadow 0.2s;
    position: relative;
}
#floating-bubble:hover {
    box-shadow: 0 8px 32px rgba(39,174,96,0.18);
}
#floating-tooltip {
    display: none;
    position: absolute;
    right: 70px;
    bottom: 16px;
    background: #2c3e50;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1em;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    z-index: 10001;
}
#floating-popup-bg {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(44,62,80,0.25);
    z-index: 99998;
}
#floating-popup {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 40px;
    width: 370px;
    max-width: 95vw;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(44,62,80,0.18);
    padding: 28px 22px 18px 22px;
    z-index: 99999;
    overflow-y: auto;
    max-height: 80vh;
}
#floating-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #667eea;
    cursor: pointer;
}
.floating-widget-popup-content h2 {
    margin-top: 0;
    font-size: 1.2em;
    color: #667eea;
}
.floating-widget-popup-content ul {
    margin-bottom: 18px;
    font-size: 1em;
    line-height: 1.5;
}
.floating-widget-popup-content form input,
.floating-widget-popup-content form select,
.floating-widget-popup-content form textarea {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1em;
}
.floating-widget-popup-content form button[type="submit"] {
    background: linear-gradient(90deg,#667eea,#27ae60);
    color: #fff;
    font-weight: 600;
    padding: 10px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 4px;
}
.floating-widget-popup-content #widget-contact-success {
    display: none;
    color: #27ae60;
    margin-top: 10px;
    font-weight: 600;
}
@media (max-width: 600px) {
    #floating-popup {
        right: 2vw;
        left: 2vw;
        width: 96vw;
        min-width: unset;
        max-width: 98vw;
        padding: 18px 6vw 12px 6vw;
    }
    #floating-bubble {
        right: unset;
        left: unset;
        bottom: 10px;
        margin-right: 0;
        margin-left: 0;
    }
    #floating-widget {
        right: 10px !important;
        left: unset !important;
        bottom: 10px !important;
        width: 62px;
        height: 62px;
        min-width: 0;
        min-height: 0;
    }
}

/* Barra desplazadora interna para historial largo */
.floating-widget-popup-content ul {
    max-height: 160px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 6px;
}
.floating-widget-popup-content ul::-webkit-scrollbar {
    width: 6px;
    background: #f1f1f1;
}
.floating-widget-popup-content ul::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Normalizar font-family en textarea placeholder */
.floating-widget-popup-content textarea,
.floating-widget-popup-content textarea::placeholder {
    font-family: 'Poppins', sans-serif !important;
    font-size: 1em;
    color: #666;
}
/* (Eliminado tooltip visual de encabezado, restaurado a versión previa) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    --bg-color: #ffffff;
    --sidebar-bg: #f8f9fa;
    --text-color: #333333;
    --border-color: #e9ecef;
    --card-bg: #ffffff;
    --header-bg: #f1f3f4;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --sidebar-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --border-color: #404040;
    --card-bg: #333333;
    --header-bg: #404040;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.main-header {
    text-align: center;
    padding: 30px 20px;
    background: var(--bg-color);
    box-shadow: var(--shadow);
    position: relative;
}

.main-title {
    font-size: 3.5em;
    font-weight: 700;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.main-subtitle {
    font-size: 1.1em;
    color: var(--text-color);
    opacity: 0.8;
    font-weight: 300;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--primary-gradient);
    border: none;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    color: white;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-color);
    box-shadow: var(--shadow);
    min-height: calc(100vh - 140px);
}

/* Sidebar */
.sidebar {
    width: 25%;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
}

.sidebar h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.keyword-input, .meta-description {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: var(--card-bg);
    color: var(--text-color);
}

.keyword-input:focus, .meta-description:focus {
    outline: none;
    border-color: #667eea;
}

.meta-description {
    resize: vertical;
    min-height: 80px;
    font-family: 'Poppins', sans-serif;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    margin-top: 5px;
    color: #666;
}

.char-counter.warning {
    color: #f39c12;
}

.char-counter.error {
    color: #e74c3c;
}

.serp-preview {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.serp-preview h4 {
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 14px;
}

.serp-title {
    color: #1a0dab;
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 8px;
    text-decoration: none;
    cursor: pointer;
}

.serp-url {
    color: #006621;
    font-size: 14px;
    margin-bottom: 8px;
}

.serp-description {
    color: #545454;
    font-size: 14px;
    line-height: 1.4;
}

[data-theme="dark"] .serp-title {
    color: #8ab4f8;
}

[data-theme="dark"] .serp-url {
    color: #9aa0a6;
}

[data-theme="dark"] .serp-description {
    color: #bdc1c6;
}

.score-summary {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.total-score {
    text-align: center;
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.score-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #27ae60);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.metrics {
    margin-top: 20px;
}

.metric {
    background: var(--card-bg);
    margin-bottom: 15px;
    border-radius: 8px;
    /* overflow: hidden; */
    box-shadow: var(--shadow);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--header-bg);
    cursor: pointer;
    transition: background 0.3s;
}

.metric-header:hover {
    background: var(--border-color);
}

.metric-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.metric-status {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    white-space: nowrap;
    box-sizing: border-box;
    word-break: keep-all;
    text-align: center;
    margin: 0 auto;
}

.status-red { background: #e74c3c; }
.status-yellow { background: #f39c12; }
.status-green { background: #27ae60; }

.metric-details {
    padding: 15px;
    display: none;
    border-top: 1px solid var(--border-color);
}

.metric-details.active {
    display: block;
}

.info-icon {
    cursor: help;
    color: #667eea;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e8f0fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    position: relative;
}

.tooltip {
    position: relative;
    z-index: 9999;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 280px;
    background-color: #2c3e50;
    color: white;
    text-align: left;
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    min-width: 220px;
    max-width: 320px;
    white-space: normal;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    pointer-events: none;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Editor */
.editor-container {
    width: 75%;
    display: flex;
    flex-direction: column;
}

.editor-header {
    background: var(--card-bg);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.editor-header h1 {
    color: var(--text-color);
    margin-bottom: 10px;
}


/* Barra de herramientas normal (sin sticky/fixed) */
.editor-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px 10px 20px;
    margin-bottom: 0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    position: static;
    top: auto;
    z-index: auto;
}

.toolbar-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    color: var(--text-color);
}

/* Guardar botón especial */
.toolbar-btn[onclick*="saveContent"] {
    background: #27ae60;
    color: #fff;
    font-weight: 600;
    border: none;
}
.toolbar-btn[onclick*="saveContent"]:hover {
    background: #219150;
    color: #fff;
}

.toolbar-btn:hover {
    background: var(--header-bg);
    border-color: #667eea;
}

.toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pdf-btn {
    background: var(--primary-gradient);
    color: white !important;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    margin-left: auto;
}

.pdf-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    color: #667eea !important;
    background: #f8f9fa;
}

.editor {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}


.wysiwyg-editor {
    width: 100%;
    min-height: 500px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    font-family: 'Georgia', serif;
    transition: border-color 0.3s;
    background: var(--card-bg);
    color: var(--text-color);
    overflow-y: auto;
    margin-top: 0;
}

.wysiwyg-editor:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}



.wysiwyg-editor h1, .wysiwyg-editor h2, .wysiwyg-editor h3 {
    margin: 20px 0 10px 0;
    color: var(--text-color);
}

[data-theme="dark"] .wysiwyg-editor h1,
[data-theme="dark"] .wysiwyg-editor h2,
[data-theme="dark"] .wysiwyg-editor h3 {
    color: #fff !important;
}

[data-theme="dark"] .wysiwyg-editor h1,
[data-theme="dark"] .wysiwyg-editor h2,
[data-theme="dark"] .wysiwyg-editor h3 {
    color: #fff;
}

.wysiwyg-editor h1 { font-size: 2em; }
.wysiwyg-editor h2 { font-size: 1.5em; }
.wysiwyg-editor h3 { font-size: 1.2em; }

.wysiwyg-editor p {
    margin-bottom: 15px;
}

.wysiwyg-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: var(--shadow);
}

.wysiwyg-editor:empty:before {
    content: "Comienza a escribir tu contenido aquí...";
    color: #999;
    font-style: italic;
}

.word-count {
    background: var(--header-bg);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-color);
}

.image-upload {
    display: none;
}

.image-tips {
    background: #e8f5e8;
    border: 1px solid #27ae60;
    border-radius: 6px;
    padding: 10px;
    margin-top: 10px;
    font-size: 12px;
    color: #155724;
}

[data-theme="dark"] .image-tips {
    background: #1e3a1e;
    border-color: #27ae60;
    color: #d4edda;
}

.footer {
    text-align: center;
    padding: 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 14px;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5em;
    }
    
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .editor-container {
        width: 100%;
        order: 1;
    }
}

#suggestions {
    margin-top: 20px;
}


/* Sugerencias sticky en el sidebar */

/* Sugerencias SIEMPRE visibles en el costado izquierdo */
.suggestion-box {
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: static;
    top: auto;
    left: auto;
    z-index: auto;
    width: auto;
    max-width: 100%;
}

@media (max-width: 900px) {
  .editor-toolbar {
    top: auto;
    width: 100%;
    max-width: 100vw;
    margin-left: 0;
    left: 0;
    position: static;
  }
  .suggestion-box {
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 100vw;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    border-top: none;
    position: static;
  }
}

[data-theme="dark"] .suggestion-box {
    background: #3d3b00;
    color: #fff3cd;
}

.suggestion-box h4 {
    margin-bottom: 10px;
    color: #856404;
}

[data-theme="dark"] .suggestion-box h4 {
    color: #fff3cd;
}

.suggestion-box ul {
    margin: 0;
    padding-left: 20px;
}

.suggestion-box li {
    margin: 8px 0;
    color: #856404;
}

[data-theme="dark"] .suggestion-box li {
    color: #fff3cd;
}

/* FAQ Section */
.faq-section {
    background: var(--bg-color);
    padding: 60px 20px;
    border-top: 1px solid var(--border-color);
}

.faq-container {
    max-width: 1000px;
    margin: 0 auto;
}

.faq-title {
    text-align: center;
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 40px;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.faq-item {
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.faq-question {
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg);
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.faq-question:hover {
    background: var(--border-color);
}

.faq-icon {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    transition: transform 0.3s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
    background: #667eea;
    color: white;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    background: var(--card-bg);
}

.faq-answer.active {
    max-height: 500px;
    padding: 20px 25px;
}

.faq-answer p {
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 15px;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer ul {
    color: var(--text-color);
    padding-left: 20px;
    line-height: 1.6;
}

.faq-answer li {
    margin-bottom: 8px;
    font-size: 15px;
}

/* Responsive FAQ */
@media (max-width: 768px) {
    .faq-section {
        padding: 40px 15px;
    }
    
    .faq-title {
        font-size: 2em;
    }
    
    .faq-question {
        padding: 15px 20px;
        font-size: 15px;
    }
    
    .faq-answer.active {
        padding: 15px 20px;
    }
}

.wysiwyg-editor ul,
.wysiwyg-editor ol {
    margin-left: 2em;
    padding-left: 1.5em;
    margin-bottom: 15px;
}

.wysiwyg-editor li {
    margin-bottom: 6px;
    line-height: 1.6;
    font-size: 16px;
}

.criterion-score {
    display: block;
    font-size: 12px;
    color: #667eea;
    margin-bottom: 4px;
    font-weight: 600;
    opacity: 0.8;
}

@media (max-width: 900px) {
  .criterion-score {
    font-size: 11px;
  }
}