/**
 * Sistema de Ayuda - RASTRAR
 * Estilos para la documentación y manual de usuario
 */

/* ============================================
   RESET Y LAYOUT PRINCIPAL
   ============================================ */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    display: flex;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* ============================================
   SIDEBAR DE NAVEGACIÓN
   ============================================ */

.help-sidebar {
    width: 300px;
    height: 100vh;
    background: rgba(26, 26, 46, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 25px 20px;
    flex-shrink: 0;
}

.help-sidebar h3 {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-sidebar h3 i {
    color: #FF6B35;
    font-size: 1.3rem;
}

/* Buscador */
.help-sidebar .search-box {
    position: relative;
    margin-bottom: 25px;
}

.help-sidebar .search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.help-sidebar .search-box input:focus {
    outline: none;
    border-color: #FF6B35;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.help-sidebar .search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.help-sidebar .search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

/* Tabla de contenidos */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 5px;
}

.toc-list a {
    display: block;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.toc-list a:hover {
    background: rgba(255, 107, 53, 0.1);
    color: #FF6B35;
    border-left-color: #FF6B35;
    padding-left: 20px;
}

.toc-list a.active {
    background: rgba(255, 107, 53, 0.2);
    color: #FF6B35;
    border-left-color: #FF6B35;
    font-weight: 600;
}

.toc-list .toc-level-2 {
    padding-left: 25px;
    font-size: 0.85rem;
}

.toc-list .toc-level-3 {
    padding-left: 40px;
    font-size: 0.8rem;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */

.help-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(38, 38, 58, 0.95) 100%);
}

.help-content-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 60px 80px 60px;
}

/* Header del contenido */
.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 20px;
}

.help-header h1 {
    color: white;
    font-size: 2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0;
}

.help-header h1 i {
    color: #FF6B35;
    font-size: 2rem;
}

.help-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.help-actions .btn {
    padding: 10px 18px;
    background: rgba(255, 107, 53, 0.2);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 10px;
    color: #FF6B35;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-actions .btn:hover {
    background: rgba(255, 107, 53, 0.3);
    border-color: #FF6B35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

/* ============================================
   MARKDOWN CONTENT STYLING
   ============================================ */

.markdown-body {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.8;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Headers */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: white;
    font-weight: 600;
    margin-top: 35px;
    margin-bottom: 20px;
    line-height: 1.3;
    scroll-margin-top: 20px;
}

.markdown-body h1 {
    font-size: 2.2rem;
    color: #FF6B35;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 107, 53, 0.3);
}

.markdown-body h2 {
    font-size: 1.8rem;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 107, 53, 0.2);
}

.markdown-body h3 {
    font-size: 1.4rem;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-body h4 {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
}

.markdown-body h5 {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
}

.markdown-body h6 {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

/* Párrafos y texto */
.markdown-body p {
    margin-bottom: 18px;
    line-height: 1.8;
}

.markdown-body strong {
    color: white;
    font-weight: 600;
}

.markdown-body em {
    color: rgba(255, 255, 255, 0.8);
}

/* Listas */
.markdown-body ul,
.markdown-body ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.markdown-body li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.markdown-body ul li::marker {
    color: #FF6B35;
}

.markdown-body ol li::marker {
    color: #FF6B35;
    font-weight: 600;
}

/* Código inline */
.markdown-body code {
    background: rgba(255, 107, 53, 0.15);
    color: #FF6B35;
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.9em;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

/* Bloques de código */
.markdown-body pre {
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 25px;
    overflow-x: auto;
    margin: 25px 0;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.markdown-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 0.9rem;
}

/* Botón copiar código */
.copy-code-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 107, 53, 0.2);
    border: 1px solid rgba(255, 107, 53, 0.3);
    color: #FF6B35;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    z-index: 10;
}

.copy-code-btn:hover {
    background: rgba(255, 107, 53, 0.3);
    border-color: #FF6B35;
}

/* Tablas */
.markdown-body table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background: rgba(26, 26, 46, 0.5);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: table;
}

.markdown-body th,
.markdown-body td {
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    word-wrap: break-word;
}

.markdown-body th {
    background: rgba(255, 107, 53, 0.25);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.markdown-body tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.markdown-body tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Blockquotes */
.markdown-body blockquote {
    border-left: 4px solid #FF6B35;
    padding: 15px 25px;
    margin: 25px 0;
    background: rgba(255, 107, 53, 0.05);
    border-radius: 0 8px 8px 0;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.markdown-body blockquote p {
    margin: 0;
}

/* Enlaces */
.markdown-body a {
    color: #FF6B35;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.markdown-body a:hover {
    color: #ff8554;
    border-bottom-color: #FF6B35;
}

/* Separador horizontal */
.markdown-body hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(255, 107, 53, 0.3), transparent);
    margin: 40px 0;
}

/* Imágenes */
.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ============================================
   BOTÓN SCROLL TO TOP
   ============================================ */

.scroll-top {
    position: fixed;
    bottom: 35px;
    right: 35px;
    width: 55px;
    height: 55px;
    background: rgba(255, 107, 53, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
    z-index: 1000;
}

.scroll-top:hover {
    background: #FF6B35;
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.6);
}

.scroll-top.visible {
    display: flex;
}

/* ============================================
   ESTADOS DE CARGA Y ERRORES
   ============================================ */

.loading {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.loading i {
    font-size: 3rem;
    animation: spin 1s linear infinite;
    color: #FF6B35;
    margin-bottom: 15px;
}

.loading p {
    font-size: 1rem;
    margin: 10px 0 0 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
    color: rgba(255, 255, 255, 0.4);
}

.no-results h3 {
    color: white;
    margin: 15px 0;
}

.no-results p {
    margin: 0;
    font-size: 0.95rem;
}

/* ============================================
   HIGHLIGHT DE BÚSQUEDA
   ============================================ */

mark {
    background: rgba(255, 107, 53, 0.4);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */

.help-sidebar::-webkit-scrollbar,
.help-content::-webkit-scrollbar {
    width: 8px;
}

.help-sidebar::-webkit-scrollbar-track,
.help-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.help-sidebar::-webkit-scrollbar-thumb,
.help-content::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 4px;
}

.help-sidebar::-webkit-scrollbar-thumb:hover,
.help-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.7);
}

/* Para Firefox */
.help-sidebar,
.help-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 53, 0.5) rgba(255, 255, 255, 0.05);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .help-content-inner {
        padding: 30px 40px 60px 40px;
    }
    
    .markdown-body h1 {
        font-size: 1.8rem;
    }
    
    .markdown-body h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .help-sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .help-sidebar.active {
        left: 0;
    }
    
    .help-content {
        width: 100%;
    }
    
    .help-content-inner {
        padding: 20px 25px 60px 25px;
    }
    
    .help-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .help-header h1 {
        font-size: 1.5rem;
    }
    
    .help-actions {
        width: 100%;
    }
    
    .help-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .markdown-body h1 {
        font-size: 1.6rem;
    }
    
    .markdown-body h2 {
        font-size: 1.3rem;
    }
    
    .markdown-body h3 {
        font-size: 1.1rem;
    }
    
    .markdown-body table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .markdown-body th,
    .markdown-body td {
        padding: 10px 12px;
    }
    
    .scroll-top {
        width: 50px;
        height: 50px;
        bottom: 25px;
        right: 25px;
    }
}

@media (max-width: 480px) {
    .help-content-inner {
        padding: 15px 20px 50px 20px;
    }
    
    .help-header h1 {
        font-size: 1.3rem;
    }
    
    .help-header h1 i {
        font-size: 1.3rem;
    }
    
    .help-actions .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .markdown-body {
        font-size: 0.95rem;
    }
    
    .markdown-body h1 {
        font-size: 1.4rem;
    }
    
    .markdown-body h2 {
        font-size: 1.2rem;
    }
    
    .markdown-body h3 {
        font-size: 1rem;
    }
    
    .markdown-body pre {
        padding: 15px;
        font-size: 0.85rem;
    }
}

/* ============================================
   ANIMACIONES Y TRANSICIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.markdown-body > * {
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   MODO IMPRESIÓN
   ============================================ */

@media print {
    html, body {
        height: auto;
        overflow: visible;
    }
    
    body {
        background: white;
        display: block;
    }
    
    .help-sidebar,
    .help-actions,
    .scroll-top {
        display: none !important;
    }
    
    .help-content {
        width: 100%;
        height: auto;
        overflow: visible;
    }
    
    .help-content-inner {
        max-width: 100%;
        padding: 0;
    }
    
    .markdown-body {
        color: black;
    }
    
    .markdown-body h1,
    .markdown-body h2,
    .markdown-body h3 {
        color: black;
        page-break-after: avoid;
    }
    
    .markdown-body pre {
        page-break-inside: avoid;
        border: 1px solid #ddd;
        background: #f5f5f5;
    }
    
    .markdown-body table {
        page-break-inside: avoid;
        border: 1px solid #ddd;
    }
    
    .markdown-body a {
        color: #0066cc;
        text-decoration: underline;
    }
}