/* ==========================================================================
   ENTROPY SHOPIFY - MAIN STYLE
   ========================================================================== */

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--p-font-size);
    line-height: var(--p-line-height);
    -webkit-font-smoothing: antialiased;
    overflow: hidden; /* Hide root scroll, let sidebar and content scroll */
}

img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--border-radius, 8px);
    margin: var(--spacing-md, 16px) 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
}

/* ----- SCROLLBAR INVISIBLE (Estilo macOS) ----- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}
*:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* ----- LAYOUT ----- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.top-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    z-index: 20;
    flex-shrink: 0;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.language-selector {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--caption-font-size);
    font-family: var(--font-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.language-selector:focus {
    outline: none;
}

.search-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: var(--transition-fast);
}
.search-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden; /* Contains sidebar and content */
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-normal);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
}

.nav-group-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
}
.sidebar-content > div:first-child > .nav-group-title {
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: var(--caption-font-size);
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 4px;
}
.nav-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}
.nav-item.active {
    background-color: transparent;
    color: var(--accent);
    font-weight: 500;
}

/* Sidebar Footer (3 links) */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}
.sidebar-footer .nav-item {
    gap: 12px;
}

/* Animations */
.nav-sub-list-container {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease-out;
}
.nav-sub-list-container.open {
    grid-template-rows: 1fr;
}
.nav-sub-list-inner {
    overflow: hidden;
}
.chevron {
    transition: transform 0.3s ease-out;
    transform: rotate(90deg); /* Open state (pointing down) */
}
.nav-group-title.collapsed .chevron {
    transform: rotate(0deg); /* Collapsed state (pointing right) */
}

/* Content Area */
.content-area {
    flex: 1;
    background-color: var(--bg-primary);
    overflow-y: auto;
    padding: 48px;
    padding-bottom: 80px;
    position: relative;
    scroll-behavior: smooth;
}

.content-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Markdown Rendering Styles */
.markdown-body h1 {
    font-size: var(--h1-font-size);
    font-weight: var(--h1-font-weight);
    margin-bottom: 24px;
    line-height: 1.2;
}
.markdown-body h2 {
    font-size: var(--h2-font-size);
    line-height: 1.3;
    margin-top: 48px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}
.markdown-body p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}
.markdown-body a {
    color: var(--accent);
    text-decoration: underline;
}
.markdown-body a:hover {
    text-decoration: underline;
}
.markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
    color: var(--text-secondary);
}

/* Code Blocks */
.markdown-body pre {
    background-color: #000 !important;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}
.markdown-body code {
    font-family: monospace;
    font-size: 14px;
}
.markdown-body p code {
    background-color: var(--hover-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}

/* Icons */
.icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Search Modal */
.search-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}
.search-modal-overlay.active {
    display: flex;
}
.search-modal {
    width: 100%;
    max-width: 600px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}
.search-input-wrapper {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    font-family: var(--font-body);
}
.search-input:focus {
    outline: none;
}
.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
}
.search-result-item {
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
}
.search-result-item:hover {
    background: var(--hover-bg);
}
.search-result-title {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}
.search-result-excerpt {
    color: var(--text-secondary);
    font-size: var(--caption-font-size);
}

/* TOC Sidebar */
.toc-sidebar {
    width: 250px;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    padding: 48px 24px;
    flex-shrink: 0;
    overflow-y: auto;
    display: none; /* Hidden by default for smaller screens */
}

.toc-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toc-link {
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    line-height: 1.4;
    transition: var(--transition-fast);
}

.toc-link:hover {
    color: var(--text-primary);
}

.toc-link.h3 {
    padding-left: 16px;
}

/* Responsiveness */
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 10;
        width: 100%;
        max-width: 320px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .mobile-menu-toggle {
        display: block;
    }
    .content-area {
        padding: 24px;
        padding-bottom: 80px;
    }
}

@media (min-width: 1200px) {
    .toc-sidebar {
        display: block;
    }
}

/* Version History Specific Styles */
.version-history-page h1 {
    margin-top: 64px;
    margin-bottom: 24px;
}
.version-history-page h1:first-child {
    margin-top: 0;
}

/* ==========================================================================
   UPDATES PAGE
   ========================================================================== */
.updates-page h1 {
    font-size: var(--h1-font-size);
    font-weight: var(--h1-font-weight);
    margin-bottom: 32px;
}
.updates-page h1:first-child {
    margin-top: 0;
}

.updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.update-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    flex-direction: column;
}

.update-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.update-card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #000;
    border-bottom: 1px solid var(--border-color);
}

.update-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.update-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    align-self: flex-start;
}

.update-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
    font-family: var(--font-heading);
}

.update-desc {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
}

/* Badge Icons & States */
.badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.badge-icon svg {
    width: 14px;
    height: 14px;
}

.dot-icon {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
}

.pill-icon {
    width: 12px;
    height: 8px;
    background: currentColor;
    border-radius: 4px;
    animation: pulse-badge 1.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

/* en_espera: Gris plateado */
.badge-en_espera {
    background: rgba(161, 161, 170, 0.1);
    color: #A1A1AA;
}

/* en_progreso: Cian */
.badge-en_progreso {
    background: var(--accent-bg);
    color: var(--accent);
}

/* verificando: Morado suave */
.badge-verificando {
    background: rgba(168, 85, 247, 0.1);
    color: #A855F7;
}

/* completado: Verde esmeralda */
.badge-completado {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ==========================================================================
   VOTE PAGE
   ========================================================================== */
.vote-page {
    max-width: 600px;
    margin: 0 auto;
}
.vote-page h1 {
    font-size: var(--h1-font-size);
    margin-bottom: 16px;
    text-align: center;
}
.vote-desc {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}
.vote-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg-sidebar);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.vote-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    transition: border-color var(--transition-fast);
}
.vote-input:focus {
    border-color: var(--accent);
}
.vote-textarea {
    resize: vertical;
    min-height: 120px;
}
.vote-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}
.vote-btn:hover {
    opacity: 0.9;
}
.vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.vote-error {
    color: #ef4444;
    font-size: 14px;
    text-align: center;
}

/* Options List Phase 3 */
.vote-options-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 8px;
}
.vote-option {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.vote-option:hover {
    border-color: rgba(255,255,255,0.2);
}
.vote-option input[type="radio"] {
    margin-top: 4px;
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}
.vote-option input[type="radio"]:checked + .vote-option-content h4 {
    color: var(--accent);
}
.vote-option-content h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
}
.vote-option-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Wait State / Countdown */
.vote-wait-container {
    text-align: center;
    padding: 64px 24px;
}
.vote-wait-icon {
    width: 48px;
    height: 48px;
    stroke: var(--accent);
    margin-bottom: 24px;
}
.vote-wait-container h2 {
    font-size: var(--h3-font-size);
    margin-bottom: 24px;
}
.vote-countdown {
    font-family: monospace;
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-sidebar);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: inline-block;
}
.vote-success {
    text-align: center;
    padding: 64px 24px;
}

