/* ============================================================
   SIGUEME.NET — COMPONENTES
   Ticker, header, cards, badges, botones
   ============================================================ */

/* ------------------------------------------------------------
   TICKER
   ------------------------------------------------------------ */
.sg-ticker {
    background: var(--brand-primary);
    color: var(--text-inverse);
    padding: 10px 0;
    font-size: var(--fs-sm);
    overflow: hidden;
}

.sg-ticker-inner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);
}

.sg-ticker-label {
    background: var(--brand-hot);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: var(--fw-extrabold);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sg-ticker-dot {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.sg-ticker-content {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: var(--fw-medium);
}

.sg-ticker-content a {
    color: var(--text-inverse);
    transition: opacity var(--transition-fast);
}

.sg-ticker-content a:hover {
    opacity: 0.8;
}

/* ------------------------------------------------------------
   HEADER
   ------------------------------------------------------------ */
.sg-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sg-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: var(--space-lg);
}

.sg-logo {
    font-size: 26px;
    font-weight: var(--fw-black);
    letter-spacing: -1px;
    color: var(--brand-primary);
    flex-shrink: 0;
}

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

.sg-main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.sg-main-nav a {
    padding: 8px 14px;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    border-radius: 6px;
    transition: all var(--transition-fast);
    color: var(--text-muted);
    white-space: nowrap;
}

.sg-main-nav a:hover,
.sg-main-nav a.active {
    background: var(--bg-body);
    color: var(--brand-primary);
}

.sg-search-box {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    gap: var(--space-sm);
    width: 220px;
    flex-shrink: 0;
    transition: background var(--transition-fast);
}

.sg-search-box:focus-within {
    background: #fff;
    box-shadow: 0 0 0 2px var(--brand-accent);
}

.sg-search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: var(--fs-sm);
    width: 100%;
    color: var(--text-primary);
}

.sg-search-box input::placeholder {
    color: var(--text-muted);
}

.sg-search-box kbd {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    font-family: inherit;
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .sg-main-nav,
    .sg-search-box {
        display: none;
    }
}

/* ------------------------------------------------------------
   BARRA DE SECCIONES (tabs scrollables)
   ------------------------------------------------------------ */
.sg-sections-bar {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 73px;
    z-index: 90;
}

.sg-sections-scroll {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sg-sections-scroll::-webkit-scrollbar {
    display: none;
}

.sg-section-tab {
    padding: 8px 16px;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.sg-section-tab:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.sg-section-tab.active {
    background: var(--brand-primary);
    color: var(--text-inverse);
}

.sg-section-tab .count {
    background: rgba(255, 255, 255, 0.2);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: var(--fw-bold);
}

.sg-section-tab:not(.active) .count {
    background: var(--bg-body);
    color: var(--text-muted);
}

/* ------------------------------------------------------------
   BREADCRUMB
   ------------------------------------------------------------ */
.sg-breadcrumb {
    padding: var(--space-lg) 0 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.sg-breadcrumb a {
    transition: color var(--transition-fast);
}

.sg-breadcrumb a:hover {
    color: var(--brand-primary);
}

.sg-breadcrumb .sep {
    margin: 0 var(--space-sm);
    opacity: 0.5;
}

.sg-breadcrumb .current {
    color: var(--text-primary);
    font-weight: var(--fw-semibold);
}

/* ------------------------------------------------------------
   BADGE (categoría en card)
   ------------------------------------------------------------ */
.sg-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: var(--fw-extrabold);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #fff;
    background: var(--brand-primary);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sg-badge.devocionales { background: #16a085; }
.sg-badge.predicas     { background: #2980b9; }
.sg-badge.bosquejos    { background: #8e44ad; }
.sg-badge.jovenes      { background: #e67e22; }
.sg-badge.mujeres      { background: #d81b60; }
.sg-badge.estudios     { background: #34495e; }
.sg-badge.liderazgo    { background: #c0392b; }
.sg-badge.salmos       { background: #7f8c8d; }
.sg-badge.reflexiones { background: #ec681d; }

.sg-badge.featured {
    background: var(--brand-accent);
    color: #000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------
   BOTONES
   ------------------------------------------------------------ */
.sg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-family: inherit;
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    border: none;
    line-height: 1.2;
}

.sg-btn-primary {
    background: var(--brand-accent);
    color: #000;
}

.sg-btn-primary:hover {
    background: var(--brand-accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.sg-btn-dark {
    background: var(--brand-primary);
    color: #fff;
}

.sg-btn-dark:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-2px);
}

.sg-btn-outline {
    background: transparent;
    color: var(--brand-primary);
    border: 2px solid var(--brand-primary);
}

.sg-btn-outline:hover {
    background: var(--brand-primary);
    color: #fff;
}

/* ------------------------------------------------------------
   CARD GENÉRICA
   ------------------------------------------------------------ */
.sg-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sg-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
}

.sg-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e0e0e0;
}

.sg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.sg-card:hover .sg-card-image img {
    transform: scale(1.06);
}

.sg-card-body {
    padding: var(--space-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sg-card-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-extrabold);
    line-height: var(--lh-snug);
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    transition: color var(--transition-fast);
}

.sg-card:hover .sg-card-title {
    color: var(--brand-primary);
}

.sg-card-excerpt {
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--text-muted);
    margin-bottom: var(--space-md);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sg-card-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.sg-card-meta .dot {
    color: var(--border-strong);
}

.sg-card-meta .author-name {
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}

/* ------------------------------------------------------------
   SECTION HEADER (título de sección dentro de página)
   ------------------------------------------------------------ */
.sg-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    gap: var(--space-md);
    flex-wrap: wrap;
}

.sg-section-header h2 {
    font-size: var(--fs-xl);
    font-weight: var(--fw-black);
    letter-spacing: -0.5px;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sg-section-header h2::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--brand-accent);
    border-radius: 2px;
}

.sg-section-header .sg-view-all {
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    transition: gap var(--transition-base);
}

.sg-section-header .sg-view-all:hover {
    gap: 12px;
}

/* ------------------------------------------------------------
   AD SLOT (placeholder para AdSense)
   ------------------------------------------------------------ */
.sg-ad-slot {
    background: #f9f9f9;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: var(--space-md) 0;
}

/* ------------------------------------------------------------
   IMAGEN CON FALLBACK (data-fallback)
   ------------------------------------------------------------ */
img[data-fallback] {
    background: #e0e0e0;
}

/* ------------------------------------------------------------
   HEADER CON MENÚ DESPLEGABLE
   ------------------------------------------------------------ */
.sg-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sg-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: var(--space-lg);
}

.sg-logo {
    font-size: 26px;
    font-weight: var(--fw-black);
    letter-spacing: -1px;
    color: var(--brand-primary);
    flex-shrink: 0;
}
.sg-logo span { color: var(--brand-accent); }

/* Lista del menú */
.sg-main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.sg-nav-list {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

.sg-nav-item {
    position: relative;
    flex-shrink: 0;
}

/* Link o botón del menú */
.sg-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.2;
}

.sg-nav-link:hover {
    background: var(--bg-body);
    color: var(--brand-primary);
}

.sg-nav-item.active > .sg-nav-link {
    color: var(--brand-primary);
    background: var(--bg-body);
}

/* Caret (flecha) */
.sg-caret {
    transition: transform var(--transition-fast);
    opacity: 0.7;
    flex-shrink: 0;
}
.sg-nav-item.has-dropdown:hover .sg-caret,
.sg-nav-item.has-dropdown.open .sg-caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown */
.sg-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--transition-fast),
                transform var(--transition-fast),
                visibility var(--transition-fast);
    z-index: 200;
}

.sg-nav-item.has-dropdown:hover > .sg-dropdown,
.sg-nav-item.has-dropdown:focus-within > .sg-dropdown,
.sg-nav-item.has-dropdown.open > .sg-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Items del dropdown */
.sg-dropdown li {
    list-style: none;
}

.sg-dropdown a {
    display: block;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.sg-dropdown a:hover {
    background: var(--brand-primary);
    color: #fff;
    padding-left: 18px;
}

.sg-dropdown a.active {
    background: var(--bg-body);
    color: var(--brand-primary);
    font-weight: var(--fw-bold);
}

/* Pequeño triángulo superior */
.sg-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    transform: rotate(45deg);
}

/* ------------ RESPONSIVE ------------ */
@media (max-width: 1100px) {
    .sg-nav-link {
        padding: 8px 10px;
        font-size: 13px;
    }
}

@media (max-width: 900px) {
    /* En móvil ocultamos el menú y el buscador; se abrirá con hamburguesa (Fase 2) */
    .sg-main-nav,
    .sg-search-box {
        display: none;
    }
}

/* ============================================================
   MENÚ MÓVIL (hamburguesa + drawer)
   ============================================================ */

/* --- Botón hamburguesa --- */
.sg-mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.sg-mobile-toggle:hover {
    background: var(--bg-body);
}
.sg-mobile-toggle-bar {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--brand-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.sg-mobile-toggle[aria-expanded="true"] .sg-mobile-toggle-bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}
.sg-mobile-toggle[aria-expanded="true"] .sg-mobile-toggle-bar:nth-child(2) {
    opacity: 0;
}
.sg-mobile-toggle[aria-expanded="true"] .sg-mobile-toggle-bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* --- Overlay --- */
.sg-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}
.sg-mobile-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Panel lateral --- */
.sg-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 88vw;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.sg-mobile-menu.open {
    transform: translateX(0);
}

/* Bloquear scroll del body cuando el menú está abierto */
body.sg-no-scroll {
    overflow: hidden;
}

/* --- Cabecera del panel --- */
.sg-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}
.sg-mobile-header .sg-logo {
    font-size: 22px;
}
.sg-mobile-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-body);
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.sg-mobile-close:hover {
    background: var(--brand-primary);
    color: #fff;
}

/* --- Buscador móvil --- */
.sg-mobile-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 20px;
    padding: 12px 16px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}
.sg-mobile-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    min-width: 0;
}

/* --- Lista de navegación --- */
.sg-mobile-nav {
    flex: 1;
    padding: 8px 0 40px;
}
.sg-mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sg-mobile-item {
    border-bottom: 1px solid var(--border);
}
.sg-mobile-item:last-child {
    border-bottom: none;
}
.sg-mobile-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    text-decoration: none;
}
.sg-mobile-link:hover {
    background: var(--bg-body);
    color: var(--brand-primary);
}
.sg-mobile-item.active > .sg-mobile-link {
    color: var(--brand-primary);
    background: var(--bg-body);
}
.sg-mobile-caret {
    transition: transform 0.3s ease;
    color: var(--text-muted);
    flex-shrink: 0;
}
.sg-mobile-item.open > .sg-mobile-accordion-toggle .sg-mobile-caret {
    transform: rotate(180deg);
    color: var(--brand-primary);
}

/* --- Submenú desplegable (acordeón) --- */
.sg-mobile-submenu {
    max-height: 0;
    overflow: hidden;
    background: var(--bg-body);
    transition: max-height 0.35s ease;
}
.sg-mobile-item.open > .sg-mobile-submenu {
    max-height: 600px;
}
.sg-mobile-submenu li {
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.sg-mobile-submenu li:last-child {
    border-bottom: none;
}
.sg-mobile-submenu a {
    display: block;
    padding: 13px 24px 13px 40px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}
.sg-mobile-submenu a::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: background 0.2s ease;
}
.sg-mobile-submenu a:hover {
    color: var(--brand-primary);
    background: rgba(255,255,255,0.6);
    padding-left: 44px;
}
.sg-mobile-submenu a:hover::before {
    background: var(--brand-accent);
}
.sg-mobile-submenu a.active {
    color: var(--brand-primary);
    font-weight: 700;
}
.sg-mobile-submenu a.active::before {
    background: var(--brand-primary);
}

/* --- Mostrar hamburguesa solo en móvil --- */
@media (max-width: 900px) {
    .sg-mobile-toggle {
        display: flex;
    }
    /* Ya está oculto el nav y search desde antes */
}

/* ============================================================
   FIX: Prevenir desbordamiento del grid de 2 columnas
   ============================================================ */
.sg-biblia-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.sg-biblia-layout > .sg-biblia-main,
.sg-biblia-layout > .sg-sidebar-wrapper {
    min-width: 0;
}

@media (max-width: 900px) {
    .sg-biblia-layout {
        grid-template-columns: 1fr;
    }
}