/* ========================================
   RESPONSIVE.CSS - Mobile-First Design
   ======================================== */

/* === BASE MOBILE STYLES === */
/* Estos estilos se aplican a todos los tamaños */

/* === BREAKPOINTS ===
   Mobile:  320px - 767px
   Tablet:  768px - 1023px
   Desktop: 1024px+
   Large:   1440px+
*/

/* === RESPONSIVE TYPOGRAPHY === */

:root {
    /* Fluid typography usando clamp() */
    --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
    --font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --font-size-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --font-size-3xl: clamp(2rem, 1.7rem + 1.5vw, 2.5rem);
    --font-size-4xl: clamp(2.5rem, 2rem + 2.5vw, 3.5rem);

    /* Touch Targets - Google Lighthouse standard 48px */
    --min-touch-target: 48px;


    /* Spacing fluido */
    --spacing-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 0.4rem + 0.5vw, 1rem);
    --spacing-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --spacing-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    --spacing-xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
}

/* === MOBILE FIRST (320px - 767px) === */

/* Container */
.container {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin: 0 auto;
    /* Safe Area Insets for notched phones */
    padding-left: env(safe-area-inset-left, 1rem);
    padding-right: env(safe-area-inset-right, 1rem);
}

/* Prevent horizontal scroll globally on mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Responsive Tables */
.table-container, 
table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Header Mobile */
header {
    padding: 0.75rem 1rem;
}

/* GLOBAL: Hide mobile icons on desktop */
.mobile-only-notif-zone {
    display: none;
}

/* Fix for mobile header icons spacing */
.header-mobile-icons {
    gap: 15px !important;
}

/* Library & Bible Search Optimizations (Mobile) */
@media (max-width: 767px) {

    .library-toolbar,
    .form-group-row,
    .search-panel .form-group,
    .bible-search-box,
    .search-tabs {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1rem !important;
        gap: 0.8rem !important;
    }

    .library-toolbar>div,
    .form-group-row>div,
    .search-panel .form-group>input,
    .bible-search-box>div,
    .bible-search-box>input,
    .bible-search-box>select,
    .search-tabs>button {
        width: 100% !important;
        min-width: unset !important;
        flex: unset !important;
    }

    .library-toolbar .btn,
    .form-group-row .btn,
    .search-panel .btn,
    .bible-search-box .btn {
        width: 100% !important;
        margin-top: 0.2rem;
        min-height: 48px;
    }

    /* Stack buttons in toolbar */
    .library-toolbar div[style*="display: flex"],
    .bible-search-box div[style*="display: flex"] {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
}

.header-content {
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    width: auto;
    justify-content: flex-start;
    flex-shrink: 1;
}

/* Version movil: Logo click habilitado pero refinado */
@media (max-width: 1024px) {
    .logo-section {
        pointer-events: auto;
        cursor: pointer;
        z-index: 10;
        max-width: 60%;
    }

    .brand-text h1 {
        font-size: 1.1rem;
        letter-spacing: -0.5px;
    }
}

/* Version movil: Logo adjustments */
@media (max-width: 480px) {

    /* Hide specific text parts to save space */
    .brand-text p {
        display: none !important;
    }

    .brand-text h1 {
        font-size: 1rem;
        /* prevent wrapping */
        white-space: nowrap;
    }

    .logo-section img {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }
}

/* On very small screens (or if icons crowd), hide the text entirely */
@media (max-width: 380px) {
    .brand-text {
        display: none !important;
    }
}

/* Navigation Mobile - Hamburger Menu Refinements */
nav {
    width: auto;
}

nav ul {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

nav ul li {
    width: 100%;
}

nav ul li a {
    display: block;
    padding: 0.75rem;
    text-align: center;
    width: 100%;
}

/* Header Actions Mobile */
.header-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-status-zone {
    width: 100%;
    justify-content: space-between;
    padding: 0.5rem 1rem;
}

.user-controls {
    width: 100%;
    justify-content: space-between;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

/* ========================================
   MOBILE SIDEBAR DRAWER STYLES
   ======================================== */

.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: min(300px, 85vw);
    height: 100dvh;
    background: rgba(20, 27, 58, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2001;
    transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1), opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 15px 0 50px rgba(0, 0, 0, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.mobile-sidebar-drawer.active {
    left: 0;
}

/* === MODERN PREMIUM MOBILE DRAWER === */
.sidebar-drawer-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, rgba(20, 27, 58, 0.95), rgba(10, 14, 39, 0.95));
}

.drawer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.drawer-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.drawer-title h2 {
    font-size: 1.4rem;
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drawer-title p {
    font-size: 0.8rem;
    margin: 0;
    color: var(--accent-gold);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.drawer-close {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.drawer-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
    transform: rotate(90deg);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: rgba(10, 14, 39, 0.5);
    background-image: linear-gradient(to bottom, rgba(10, 14, 39, 0.2) 0%, transparent 10%, transparent 90%, rgba(10, 14, 39, 0.2) 100%);
}

.drawer-main-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 1.2rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    text-decoration: none;
    border-radius: 16px;
    background: var(--gradient-primary);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-main-btn:active {
    transform: scale(0.96);
}

.drawer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.drawer-list-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-align: left;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
}

.drawer-list-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--accent-primary);
    border-radius: 0 4px 4px 0;
    transition: height 0.3s ease;
}

.drawer-list-item i {
    width: 28px;
    text-align: center;
    font-size: 1.3rem;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.drawer-list-item:hover,
.drawer-list-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: white;
    border-color: rgba(99, 102, 241, 0.2);
    padding-left: 1.8rem;
}

.drawer-list-item:hover::before,
.drawer-list-item.active::before {
    height: 60%;
}

.drawer-list-item:hover i {
    transform: translateX(3px) rotate(5deg);
    background: rgba(99, 102, 241, 0.2);
}

.drawer-list-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
    color: white;
    font-weight: 800;
    border-left: 4px solid var(--accent-primary);
    padding-left: 2rem;
}

.drawer-list-item.active i {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* Drawer Bottom Bar - Glassy & Professional */
.drawer-bottom-bar {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    /* Better distribution */
    gap: 0.5rem;
}

.drawer-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: 1rem;
}

.drawer-icon-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: translateY(-3px);
}

.notification-badge-container .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--secondary-bg);
}

.lang-flag-icon {
    width: 18px;
    border-radius: 2px;
}

.lang-code {
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 4px;
}

.drawer-login-btn {
    padding: 0.6rem 1.5rem;
    background: var(--gradient-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drawer-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #4f46e5, #9333ea);
}

/* Ensure no overlap */
.mobile-sidebar-drawer {
    box-sizing: border-box;
}

/* STRICTLY HIDE OLD HEADER ELEMENTS ON MOBILE */
@media (max-width: 1024px) {

    /* Hide the header nav container only, not the drawer nav */
    header nav,
    #main-nav {
        display: none !important;
    }

    /* Botón de menú a la derecha */
    /* Botón de menú a la derecha */
    .mobile-menu-btn {
        /* Remove absolute ordering to rely on DOM order or flex logic */
        /* order: 1 !important; -> removed to let natural flow work if structure is consistent */
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: flex !important;
        z-index: 1001;
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-menu-btn:active {
        transform: scale(0.92);
        background: rgba(255, 255, 255, 0.1);
    }

    /* OCULTAR ELEMENTOS QUE DEBEN ESTAR EN EL MENÚ LATERAL */
    .header-actions,
    .user-controls,
    .ai-status-zone,
    .lang-selector,
    .theme-toggle,
    .auth-buttons,
    .header-offline-btn,
    #auth-header-container,
    .drawer-icon-btn {
        display: none !important;
    }

    /* SHOW MOBILE NOTIF ZONE (Icons + Bell) */
    .mobile-only-notif-zone {
        display: flex !important;
        align-items: center;
        margin-left: auto !important;
        /* Push to right */
        gap: 15px !important;
        margin-right: 15px !important;
        /* Pushing away from retry button or edge */
        flex-shrink: 0;
        /* Ensure icons don't squash */
    }

    /* Ensure icons inside the header zone are visible */
    .header-mobile-icons .drawer-icon-btn {
        display: flex !important;
    }

    /* Responsive Ad visibility */
    .desktop-only,
    .desktop-only-sky,
    .sky-ad-left,
    .sky-ad-right {
        display: none !important;
    }

    .mobile-only-ad {
        display: block !important;
        visibility: visible !important;
    }

    /* Mejora de espaciado en secciones de IA para móviles - Evitar solapamiento con anuncios */
    #view-tools,
    #view-ai-assistant {
        padding-top: 4rem !important;
        /* Espacio extra al inicio de la sección para bajar el contenido */
    }

    #view-tools>div:first-child,
    #view-ai-assistant .section-title {
        margin-bottom: 3.5rem !important;
        margin-top: 1rem !important;
    }

    .ad-container-sidebar {
        margin-bottom: 4rem !important;
        margin-top: 1rem !important;
    }

    .mobile-ad-spot {
        margin: 4rem auto !important;
        padding: 0 1rem;
    }

    .section-title {
        margin-bottom: 1.5rem !important;
        letter-spacing: -0.5px;
    }
}

/* === PREMIUM/ADMIN AD-FREE MODE === */
/* Estas reglas ocultan anuncios inmediatamente si la clase premium-mode está activa */
body.premium-mode .sky-ad-left,
body.premium-mode .sky-ad-right,
body.premium-mode .mobile-sky-strip,
body.premium-mode .ad-container,
body.premium-mode .ad-container-mobile,
body.premium-mode .ad-container-sidebar,
body.premium-mode .mobile-ad-spot,
body.premium-mode .sky-ad-item,
body.premium-mode iframe[src*="highperformanceformat"],
body.premium-mode iframe[src*="effectivegatecpm"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Resetear espacios extra cuando no hay anuncios */
body.premium-mode #view-tools,
body.premium-mode #view-ai-assistant {
    padding-top: 1.5rem !important;
}

/* Hero Mobile */
.hero-ai {
    padding: 3rem 1rem 4rem;
    text-align: center;
    background: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
}

.hero-ai h1 {
    font-size: var(--font-size-3xl);
    line-height: 1.2;
}

.hero-ai p {
    font-size: var(--font-size-base);
}

/* Search Hub Mobile */
.search-hub {
    flex-direction: column;
    gap: 0.5rem;
}

/* Bible Search Box Mobile */
.bible-search-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1.5rem !important;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.bible-search-box input {
    width: 100% !important;
}

.bible-search-box .btn {
    width: 100% !important;
    padding: 1rem !important;
}

.bible-search-box.reference-mode {
    gap: 1.5rem;
}

.search-hub input {
    width: 100%;
    padding: 1rem;
    font-size: var(--font-size-base);
}

.search-hub button {
    width: 100%;
    padding: 1rem;
}

/* Prompt Grid Mobile */
.prompt-grid {
    flex-direction: column;
    gap: 0.75rem;
}

.prompt-card {
    width: 100%;
    padding: 1rem 1.25rem;
}

/* Marketing Studio Mobile */
.marketing-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    padding: 1rem !important;
}

.editor-card,
.preview-card {
    padding: 1.25rem !important;
}

/* Daily Widgets Mobile */
.daily-widgets {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
}

/* App Layout Mobile */
.app-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.sidebar {
    position: static;
    width: 100%;
    padding: 1rem;
}

.main-content {
    padding: 1rem;
}

/* Sermon List Mobile */
.sermon-list {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.sermon-card {
    padding: 1.25rem;
}

/* AI Tools Grid Mobile Optimization */
#tools-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
    padding: 0.5rem 0 !important;
}

#tools-grid .sermon-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: auto !important;
    padding: 1.5rem !important;
}

#tools-grid .sermon-card h3 {
    font-size: 1.15rem !important;
    text-align: center;
}

#tools-grid .sermon-card p {
    text-align: center;
    font-size: 0.85rem !important;
}

.sermon-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sermon-actions .icon-btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 120px;
    justify-content: center;
}

/* Form Mobile */
.form-group input,
.form-group select,
.form-group textarea {
    font-size: 16px !important; /* Forces 16px to prevent iOS auto-zoom on focus */
    padding: 12px;
}

/* Optimized touch buttons */
.btn, 
.icon-btn,
button {
    min-height: var(--min-touch-target);
    min-width: var(--min-touch-target);
}

/* === AUTH & LOGIN MOBILE OPTIMIZATION === */
@media (max-width: 600px) {
    .login-landing {
        padding: 0;
        background: var(--primary-bg);
        /* Opaque background on mobile for better focus */
    }

    .login-card {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        border: none;
        padding: 2.5rem 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow-y: auto;
    }

    .login-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }

    .login-card h1 {
        font-size: 1.5rem;
    }

    .auth-tabs {
        margin-bottom: 2rem !important;
    }

    .btn-google {
        height: 52px !important;
        /* Larger touch target */
    }

    .login-card input {
        height: 52px !important;
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }

    #turnstile-container {
        transform: scale(0.85);
        /* Shrink a bit for small screens */
        margin: 10px 0;
    }
}

/* Base Touch Target check for mobile */
@media (max-width: 1024px) {

    button,
    .btn,
    a.drawer-list-item,
    input,
    select {
        min-height: var(--min-touch-target, 44px);
    }
}

/* Button Groups Mobile */
.btn-group {
    flex-direction: column;
    gap: 0.75rem;
}

.btn-group .btn {
    width: 100%;
}

/* AI Actions Bar Mobile */
.ai-actions-bar {
    flex-direction: column;
}

.ai-actions-bar .btn {
    width: 100%;
}

/* Asegurar que los botones de IA sean táctiles en móvil */
@media (max-width: 1024px) {

    .ai-actions-bar button,
    .ai-actions-bar .btn {
        min-height: 48px;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
    }

    /* Botón principal de generar sermón completo */
    #btn-ai-full-sermon {
        min-height: 52px !important;
        font-size: 1rem !important;
        font-weight: 600;
    }

    /* Botones secundarios de IA */
    #btn-ai-outline,
    #btn-ai-illustrate,
    #btn-ai-theology,
    #btn-ai-expand {
        min-height: 44px !important;
        font-size: 0.9rem !important;
    }

    /* Efecto visual al tocar (feedback táctil) */
    .ai-actions-bar button:active,
    .ai-actions-bar .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Asegurar que los botones deshabilitados no sean táctiles */
    .ai-actions-bar button:disabled,
    .ai-actions-bar .btn:disabled {
        pointer-events: none;
        touch-action: none;
    }
}

/* Footer Mobile */
footer {
    width: 100%;
    padding: 2rem 1rem;
    background: var(--gradient-card);
    /* Ensure background matches */
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    width: 100%;
}

footer nav ul {
    flex-direction: column;
    gap: 1rem;
    padding: 0;
    width: 100%;
}

/* Botón de Login en el drawer - Estilo unificado y premium */
.drawer-login-btn {
    padding: 0.6rem 1.5rem;
    background: var(--gradient-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure social media is still centered */
.social-media {
    width: 100%;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Ensure no horizontal scroll on mobile */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Header Adjustments for Full Width */
header {
    width: 100%;
    max-width: 100vw;
}

header .header-content {
    width: 100%;
    padding: 0;
}

/* Bible Search Mobile Adaptation */
@media (max-width: 767px) {

    #mode-text .form-group,
    #mode-reference .form-group-row {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    #mode-text input,
    #mode-text button,
    #mode-reference select,
    #mode-reference input,
    #mode-reference button {
        width: 100% !important;
        margin: 0 !important;
        height: 50px !important;
    }

    #mode-reference .form-group {
        width: 100% !important;
        min-width: 100% !important;
    }

    #mode-text .form-group button {
        order: 2;
        /* Ensure button is always below the input */
    }
}

/* Touch Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger tap targets for touch devices */
    button,
    a,
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .hover-lift:hover,
    .hover-glow:hover,
    .hover-scale:hover {
        transform: none;
        box-shadow: none;
    }
}

/* === BIBLE SEARCH RESPONSIVITY === */
#mode-text .form-group {
    flex-direction: column;
    gap: 1.5rem !important;
}

#mode-text .form-group input {
    width: 100% !important;
}

#mode-text .form-group button {
    width: 100% !important;
    padding: 1rem !important;
}

/* === TABLET (768px - 1023px) === */

@media (min-width: 768px) {
    #mode-text .form-group {
        flex-direction: row;
        gap: 1rem !important;
    }

    #mode-text .form-group button {
        width: auto !important;
    }

    .container {
        padding-left: 2rem;
        padding-right: 2rem;
        max-width: 1200px;
    }

    /* Header Tablet */
    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .logo-section {
        width: auto;
    }

    nav {
        width: auto;
    }

    nav ul {
        flex-direction: row;
        gap: 1.5rem;
    }

    nav ul li {
        width: auto;
    }

    nav ul li a {
        width: auto;
        text-align: left;
    }

    .header-actions {
        width: auto;
        flex-direction: row;
    }

    .user-controls {
        width: auto;
        border-left: 1px solid var(--border-color);
        border-top: none;
        padding-left: 1.2rem;
        padding-top: 0;
    }

    /* Hero Tablet */
    .hero-ai {
        padding: 3rem 2rem 4rem;
    }

    /* Search Hub Tablet */
    .search-hub {
        flex-direction: row;
    }

    .bible-search-box {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .bible-search-box.reference-mode {
        flex-wrap: wrap;
    }

    .bible-search-box input {
        width: auto !important;
    }

    .bible-search-box .btn {
        width: auto !important;
        padding: 0.8rem 1.5rem !important;
    }

    .search-hub input {
        width: auto;
    }

    .search-hub button {
        width: auto;
    }

    /* Prompt Grid Tablet */
    .prompt-grid {
        flex-direction: row;
        gap: 1rem;
    }

    .prompt-card {
        width: auto;
    }

    /* Daily Widgets Tablet */
    .daily-widgets {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* App Layout Tablet */
    .app-layout {
        grid-template-columns: 250px 1fr;
    }

    /* Sermon List Tablet */
    .sermon-list {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Button Groups Tablet */
    .btn-group {
        flex-direction: row;
    }

    .btn-group .btn {
        width: auto;
    }

    .ai-actions-bar {
        flex-direction: row;
    }

    .ai-actions-bar .btn {
        width: auto;
    }

    /* Footer Tablet */
    footer nav ul {
        flex-direction: row;
    }
}

/* === DESKTOP (1025px+) === */

@media (min-width: 1025px) {
    .container {
        max-width: 1400px;
    }

    /* Header Desktop */
    header {
        padding: 0.8rem 2rem;
    }

    /* Hide Hamburger on Desktop */
    .mobile-menu-btn {
        display: none;
    }

    /* Show Nav on Desktop */
    nav ul {
        display: flex;
        flex-direction: row;
        width: auto;
        border: none;
        background: transparent;
        box-shadow: none;
        margin-top: 0;
    }

    /* Hero Desktop */
    .hero-ai {
        padding: 4rem 1rem 6rem;
    }

    .hero-ai h1 {
        font-size: var(--font-size-4xl);
    }

    /* Daily Widgets Desktop */
    .daily-widgets {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    /* App Layout Desktop */
    .app-layout {
        grid-template-columns: 300px 1fr;
        gap: 2rem;
    }

    .sidebar {
        display: block;
        /* Show fixed sidebar only on desktop */
        padding: 1.5rem;
    }

    .main-content {
        padding: 2rem;
    }

    /* Sermon List Desktop */
    .sermon-list {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Sermon Actions Desktop - Single row */
    .sermon-actions .icon-btn {
        flex: 0 0 auto;
        min-width: auto;
    }

    /* Hide Mobile Sidebar Overlay/Drawer on Desktop */
    .mobile-sidebar-drawer,
    .mobile-sidebar-overlay {
        display: none !important;
    }
}

/* === TABLET & MOBILE (Up to 1024px) === */
@media (max-width: 1024px) {

    /* Hide Fixed Sidebar, Use Drawer */
    .sidebar {
        display: none;
    }

    .app-layout {
        grid-template-columns: 1fr;
        /* Full width content */
    }

    .mobile-menu-btn {
        display: block;
        /* Ensure hamburger is visible */
    }

    header {
        z-index: 2500 !important;
        /* Ensure dropdowns inside header are above drawer(2001) and overlay(2000) */
    }
}

/* ========================================
   MOBILE OPTIMIZATIONS FOR TOOLS & RESOURCES
   ======================================== */

/* Recursos Page - Mobile Sidebar as Horizontal Tabs */
@media (max-width: 1024px) {

    /* Convert vertical sidebar to horizontal tabs */
    .sidebar {
        display: block !important;
        /* Override the hide */
        width: 100%;
        padding: 0;
        margin-bottom: 1.5rem;
        background: transparent;
        border-radius: 0;
    }

    .sidebar h2 {
        display: none;
        /* Hide title in mobile */
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
        /* Modo Lista Vertical en Móvil */
        gap: 0.75rem;
        padding: 0.5rem;
        background: var(--secondary-bg);
        border-radius: 12px;
        border: 1px solid var(--border-color);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .sidebar-menu::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari */
    }

    .sidebar-menu li {
        width: 100%;
    }

    .sidebar-menu button {
        width: 100%;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 0.8rem;
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid transparent;
        transition: all 0.2s;
    }

    .sidebar-menu button.active {
        background: var(--gradient-primary);
        border-color: var(--accent-primary);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }

    /* Tools Grid - Mobile Responsive */
    #tools-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Library Grid - Mobile Responsive */
    #library-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Sermon Cards - Mobile Optimized */
    .sermon-card {
        padding: 1.25rem;
    }

    /* Search Panel - Mobile Stacked */
    .search-panel .form-group-row {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .search-panel .form-group {
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Library Toolbar - Mobile Stacked */
    .library-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    .library-toolbar>div {
        width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
    }

    /* Library Item (Sermon Card) Mobile Specifics */
    .sermon-card.library-item-list {
        background: var(--card-bg) !important;
        border-radius: 12px !important;
        margin-bottom: 0.5rem;
    }

    .list-item-main {
        min-width: 120px !important;
    }

    .list-item-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.4rem !important;
    }

    .list-item-actions button {
        padding: 0.5rem !important;
        min-width: 44px !important;
    }

    /* Ensure Library Grid doesn't break */
    #library-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .library-item-grid {
        width: 100% !important;
    }

    /* Stack buttons inside the action group */
    .library-toolbar input,
    .library-toolbar select,
    .library-toolbar .btn-group,
    .library-toolbar button {
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        /* Keep existing margin: 0 */
    }

    /* Stack the inner button group (Grid/List/Search) */
    .library-toolbar .btn-group,
    .library-toolbar div[style*="display: flex; gap: 0.5rem;"] {
        flex-direction: column !important;
        width: 100% !important;
    }

    .library-toolbar div[style*="display: flex; gap: 0.5rem;"] button {
        margin-bottom: 0.25rem;
    }

    /* AI Response Buttons */
    .sermon-card .btn-sm {
        padding: 0.8rem !important;
        font-size: 0.95rem !important;
        min-height: 48px;
    }

    /* Library Stats Dashboard - Mobile Stacked */
    .library-stats-dashboard {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .stat-card-mini {
        width: 100% !important;
    }

    /* AI Chat Container - Mobile Full Width */
    .ai-chat-container {
        max-width: 100% !important;
        padding: 1rem !important;
    }

    /* AI Presets - Mobile Wrap */
    .ai-presets {
        flex-wrap: wrap !important;
    }

    .ai-presets button {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 140px;
    }

    /* Bible Search - Mobile Optimized */
    .search-tabs {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .search-tabs button {
        width: 100% !important;
    }

    /* Form Group Row - Mobile Stack */
    .form-group-row {
        flex-direction: column !important;
    }

    .form-group-row .form-group {
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* Section Headers - Mobile Compact */
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .section-header button {
        width: 100%;
    }

    /* Mobile Footer full-width */
    footer {
        width: 100vw !important;
        position: relative !important;
        left: 50% !important;
        right: 50% !important;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
        background: var(--gradient-card) !important;
        border-top: 1px solid var(--border-color) !important;
        padding: 3rem 1.5rem !important;
        box-sizing: border-box !important;
        text-align: center;
    }

    .footer-content {
        width: 100%;
        max-width: 100% !important;
    }
}

/* ========================================
   MOBILE TOUCH OPTIMIZATIONS FOR TOOLS
   ======================================== */

@media (max-width: 1024px) {

    /* Tool Cards - Touch Friendly */
    .sermon-card,
    .widget-card,
    .prompt-card {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
    }

    /* Tool Buttons - Touch Targets */
    .sermon-card button,
    .widget-card button {
        min-height: 48px;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
        touch-action: manipulation;
    }

    /* Active State Feedback */
    .sermon-card:active,
    .widget-card:active,
    .prompt-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Prevent Text Selection on Touch */
    .sermon-card,
    .widget-card,
    .prompt-card,
    .sidebar-menu button {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}

/* ========================================
   MOBILE SPECIFIC LAYOUTS
   ======================================== */

@media (max-width: 768px) {

    /* Extra small screens - Single column everything */
    .daily-widgets,
    .sermon-list,
    #tools-grid,
    #library-grid {
        grid-template-columns: 1fr !important;
    }

    /* Compact spacing */
    .main-content {
        padding: 0.75rem !important;
    }

    /* Bible & Library Fixes for extra narrow mobile */
    .bible-search-box,
    .library-toolbar,
    .form-group-row,
    #view-bible .form-group-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }

    .library-stats-dashboard {
        grid-template-columns: 1fr !important;
    }

    .form-group-item {
        width: 100% !important;
    }

    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Smaller font sizes for very small screens */
    .section-title {
        font-size: 1.5rem !important;
    }

    /* Compact cards */
    .sermon-card,
    .widget-card {
        padding: 1rem !important;
    }

    /* Stack all button groups */
    .btn-group,
    .ai-actions-bar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .btn-group .btn,
    .ai-actions-bar .btn {
        width: 100% !important;
    }

    /* Stats Section Mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        margin-bottom: 2rem !important;
    }

    .stat-card {
        padding: 2rem 1rem !important;
        border-radius: 20px !important;
    }

    .stat-val {
        font-size: 2.2rem !important;
    }

    .stats-section {
        padding: 3rem 0 !important;
    }

    .stats-chart-container {
        height: 280px !important;
        padding: 15px !important;
        border-radius: 16px !important;
    }

    .section-header h2 {
        font-size: 2rem !important;
    }

    /* Ad scaling for mobile to prevent cutoff */
    .ad-container iframe {
        transform-origin: center center;
    }

    @media (max-width: 768px) {
        .ad-container div[style*="width: 728px"] {
            transform: scale(0.5);
            margin: -45px 0;
            /* Adjust margin to compensate for scale space */
            transform-origin: center center;
        }
    }

    @media (max-width: 480px) {
        .ad-container div[style*="width: 728px"] {
            transform: scale(0.42);
            margin: -60px 0;
        }
    }

    .mobile-ad-spot {
        display: none !important;
    }
}

/* ========================================
   LANDSCAPE MODE OPTIMIZATIONS
   ======================================== */

@media (max-width: 1024px) and (orientation: landscape) {

    /* Optimize for landscape mobile/tablet */
    .sidebar-menu {
        padding: 0.4rem;
    }

    .sidebar-menu button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* Reduce vertical spacing in landscape */
    .main-content {
        padding: 1rem !important;
    }

    .hero-ai {
        padding: 1.5rem 1rem 2rem !important;
    }
}

/* ========================================
   ACCESSIBILITY - HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
    .sidebar-menu button {
        border: 2px solid var(--border-color);
    }

    .sidebar-menu button.active {
        border-color: var(--accent-primary);
        border-width: 3px;
    }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    .mobile-sidebar-drawer,
    .mobile-sidebar-overlay,
    .sidebar-menu button,
    .sermon-card,
    .widget-card {
        transition: none !important;
        animation: none !important;
    }
}

/* === RESPONSIVE SKY ADS (Side Rails) === */

@media (min-width: 1025px) {

    /* Fixed header compensation */
    #app-content {
        padding-top: 80px;
        /* Space for fixed header */
        position: relative;
        max-width: 1100px;
        /* Reduced to leave more room for ads */
        margin: 0 auto;
        min-height: 100vh;
    }

    .desktop-only-sky {
        display: block !important;
        position: absolute;
        top: 160px;
        z-index: 100;
    }

    /* Full-width header fix */
    header {
        position: fixed !important;
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        margin: 0 !important;
        padding: 0.5rem 2rem !important;
    }

    .header-content {
        max-width: 100% !important;
        padding: 0 1rem;
    }

    /* Header adjustments for smaller desktops */
    @media (max-width: 1440px) {
        #app-content {
            max-width: 900px;
            /* Reduced further to ensure ads don't overlap sensitive content */
        }

        .container {
            padding: 0 1rem !important;
        }

        .app-layout {
            grid-template-columns: 240px 1fr !important;
            /* Much narrower sidebar */
            gap: 1.2rem !important;
        }

        .main-content {
            padding: 1.5rem !important;
            max-width: 100% !important;
            overflow: visible !important;
        }

        /* Shifting ads as per user suggestion to use left space */
        .sky-ad-left {
            left: -175px !important;
        }

        /* Right ad is gone in Recursos, but we keep the class for other pages */
        .sky-ad-right {
            right: -175px !important;
        }

        /* Restore stats cards layout */
        .library-stats-dashboard {
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
            gap: 1rem !important;
        }

        header {
            padding: 0.5rem 1rem !important;
        }

        .header-content {
            gap: 0.5rem !important;
        }

        nav ul {
            gap: 0.8rem !important;
        }

        .logo-section {
            gap: 0.4rem !important;
        }

        .logo-section img {
            width: 34px !important;
            /* Smaller logo */
            height: 34px !important;
        }

        .brand-text h1 {
            font-size: 0.95rem !important;
        }

        .brand-text p {
            display: none;
            /* Hide subtitle to save vertical/horizontal space */
        }

        nav a {
            font-size: 0.76rem !important;
            /* Slightly more compact */
            white-space: nowrap;
        }

        .btn-register {
            display: inline-flex !important;
            padding: 0.35rem 0.7rem !important;
            font-size: 0.72rem !important;
        }

        .btn-login {
            padding: 0.35rem 0.7rem !important;
            font-size: 0.72rem !important;
        }

        .header-actions {
            gap: 0.2rem !important;
        }

        .user-controls {
            gap: 0.3rem !important;
            padding-left: 0.4rem !important;
        }

        .ai-status-zone {
            padding: 3px 6px !important;
            transform: scale(0.85);
            margin-right: 2px !important;
        }

        .lang-selector span {
            display: none !important;
        }

        .notification-badge-container,
        .theme-toggle,
        .lang-selector {
            transform: scale(0.8);
            margin: 0 -2px;
        }
    }

    .sky-ad-left {
        left: -175px;
    }

    .sky-ad-right {
        right: -175px;
    }

    /* Full-width footer like header */
    footer {
        width: 100vw !important;
        position: relative !important;
        left: 50% !important;
        right: 50% !important;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
        background: var(--gradient-card) !important;
        border-top: 1px solid var(--border-color) !important;
        padding: 5rem 2rem !important;
        /* Increased padding */
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4) !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .footer-content {
        max-width: 1100px;
        margin: 0 auto;
        position: relative;
        z-index: 2;
    }

    /* Additional footer polish */
    footer .sponsor-link a {
        padding: 0.7rem 1.5rem !important;
        border-radius: 50px !important;
        font-weight: 600 !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        transition: all 0.3s ease !important;
    }

    footer .sponsor-link a:hover {
        background: var(--accent-primary) !important;
        box-shadow: var(--shadow-glow) !important;
        transform: translateY(-2px);
    }

    footer .app-version {
        opacity: 0.6;
        letter-spacing: 1px;
        text-transform: uppercase;
        margin-bottom: 1.5rem !important;
    }

    footer p {
        font-size: 0.85rem !important;
        opacity: 0.8;
    }

    /* Scaling for smaller desktops (1280px to 1440px) */
    @media (max-width: 1550px) {
        .sky-ad-left {
            left: -165px;
            transform: scale(0.75);
            transform-origin: right top;
        }

        .sky-ad-right {
            right: -165px;
            transform: scale(0.75);
            transform-origin: left top;
        }
    }

    @media (max-width: 1280px) {

        .sky-ad-left,
        .sky-ad-right {
            transform: scale(0.65);
            top: 140px;
        }

        .sky-ad-left {
            left: -155px;
        }

        .sky-ad-right {
            right: -155px;
        }
    }

    /* Scaling for desktops */
    @media (max-width: 1440px) {
        #app-content {
            max-width: 950px;
            margin: 0 auto;
        }

        .sky-ad-left {
            left: -165px !important;
            transform: scale(0.7);
        }

        .sky-ad-right {
            right: -165px !important;
            transform: scale(0.7);
        }
    }

    @media (max-width: 1366px) {
        #app-content {
            max-width: 900px;
            margin: 0 auto;
        }

        .sky-ad-left {
            left: -150px !important;
            transform: scale(0.6);
        }
    }

    /* Hide RIGHT ad earlier if it's the one causing trouble */
    @media (max-width: 1280px) {
        .sky-ad-right {
            display: none !important;
        }

        #app-content {
            max-width: 1000px;
            /* Allow more space since right ad is gone */
            margin-right: auto;
            margin-left: 20px;
            /* Shift content slightly left to use left space */
        }
    }

    /* Hide both ads on screens where they definitely overlap (under 1100px) */
    @media (max-width: 1100px) {
        .desktop-only-sky {
            display: none !important;
        }

        #app-content {
            margin: 0 auto;
            max-width: 100%;
        }
    }
}

/* Mobile Sky Strip Styles (Global) */
.mobile-sky-strip {
    display: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 30px 15px;
    margin: 2rem 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.sky-ad-item {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.sky-ad-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

@media (max-width: 1024px) {
    .desktop-only-sky {
        display: none !important;
    }

    .mobile-sky-strip {
        display: none !important;
    }
}

/* Adjustments for extra small screens */
@media (max-width: 400px) {
    .mobile-sky-strip {
        flex-direction: column;
        padding: 20px 10px;
    }

    .sky-ad-item {
        width: 100%;
        max-width: 170px;
        padding: 5px;
    }
}

/* === ADAPTABLE PROMO CARDS === */
.promo-card {
    background: var(--gradient-card);
    padding: 1.8rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.promo-card:hover {
    border-color: var(--accent-primary);
}

.promo-card.centered {
    text-align: center;
}

.promo-card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.promo-card h3 {
    font-size: 1.35rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    font-weight: 700;
}

.promo-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 750px;
    margin: 0 auto 1.5rem;
}

/* Book Promo Specifics */
.book-promo-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
}

.book-promo-image {
    flex: 0 0 200px;
    max-width: 200px;
    margin: 0 auto;
}

.book-promo-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

.book-promo-info {
    flex: 1 1 350px;
}

.book-promo-meta {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.book-promo-description {
    margin-top: 1.5rem !important;
    padding-top: 1.5rem !important;
    border-top: 1px solid var(--border-color) !important;
    text-align: left !important;
}

/* Responsive adjustments for promos */
@media (max-width: 768px) {
    .promo-card {
        padding: 1.5rem 1.2rem;
    }

    .promo-card h3 {
        font-size: 1.2rem;
    }

    .book-promo-container {
        flex-direction: column;
        text-align: center;
    }

    .book-promo-image {
        max-width: 160px;
    }

    .book-promo-description {
        text-align: center !important;
    }
}

@media (max-width: 480px) {
    .promo-card-icon {
        font-size: 2rem;
    }

    .promo-card h3 {
        font-size: 1.1rem;
    }

    .promo-card p {
        font-size: 0.85rem;
    }
}

/* === NOTIFICATION DROPDOWN MOBILE FIX === */
@media (max-width: 1024px) {
    .notif-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 350px !important;
        max-height: 80vh !important;
        background: #1e293b !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
        z-index: 2200 !important;
        /* Above drawer */
        border-radius: 16px !important;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
    }

    .notif-dropdown.hidden {
        display: none !important;
    }

    .notif-header {
        padding: 1.25rem !important;
        background: rgba(15, 23, 42, 0.95) !important;
    }

    .notif-list {
        max-height: 50vh !important;
        overflow-y: auto !important;
    }

    /* Backdrop for notification modal */
    .notif-dropdown::before {
        content: '';
        position: fixed;
        top: -1000px;
        left: -1000px;
        width: 5000px;
        height: 5000px;
        background: rgba(0, 0, 0, 0.6);
        z-index: -1;
        backdrop-filter: blur(4px);
    }
}

/* === LOGIN BUTTON FIX === */
.drawer-login-btn {
    min-width: 80px;
    width: auto;
    max-width: none !important;
    /* Override previous inline styles */
    white-space: nowrap;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.drawer-login-btn img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* === PREMIUM STATS DASHBOARD === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.stat-card {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem 1.5rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Subtle border */
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-val {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    margin-bottom: 0.5rem;
    line-height: 1;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

/* Specific Card Colors */
.stat-card.users .stat-icon {
    color: #818cf8;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15), transparent);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-card.sermons .stat-icon {
    color: #fbbf24;
    background: radial-gradient(circle at center, rgba(251, 191, 36, 0.15), transparent);
    border-color: rgba(251, 191, 36, 0.3);
}

.stat-card.visits .stat-icon {
    color: #34d399;
    background: radial-gradient(circle at center, rgba(52, 211, 153, 0.15), transparent);
    border-color: rgba(52, 211, 153, 0.3);
}

/* Chart Container Mobile */
.stats-chart-container {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    margin: 3rem auto !important;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
        gap: 1.5rem;
    }

    .stat-val {
        font-size: 2.5rem;
    }

    .stats-chart-container {
        height: 250px !important;
        /* Shorter chart on mobile */
        padding: 10px !important;
    }
}

/* Referral Custom Alias Mobile */
@media (max-width: 768px) {
    .custom-alias-wrapper {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .custom-alias-wrapper input,
    .custom-alias-wrapper button {
        width: 100% !important;
        flex: unset !important;
        height: 48px !important;
        /* Touch target */
    }

    .custom-alias-wrapper button {
        margin-top: 0.5rem;
    }
}/* ========================================
   MOBILE FIXES - Correcciones Específicas para Móvil
   ======================================== */

/* Sidebar Icons Fix - FORCE VISIBILITY */
@media (max-width: 1024px) {

    .sidebar-top-actions,
    .sidebar-main-row,
    .sidebar-quick-toggles,
    .sidebar-credit-banner,
    .drawer-icon-btn {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
    }

    .sidebar-credit-banner {
        margin-top: 15px !important;
        width: 100% !important;
    }

    /* Force Language Toggles Visibility */
    .sidebar-quick-toggles .drawer-icon-btn {
        width: 50px !important;
        height: 50px !important;
    }
}

/* === HEADER MOBILE - SIMPLIFICADO === */
@media (max-width: 1024px) {

    /* Ocultar elementos redundantes que ya están en el menú lateral */
    header .ai-status-zone,
    header .user-controls,
    header .lang-selector,
    header .theme-toggle,
    header .header-offline-btn,
    header .auth-buttons,
    header .header-actions:not(.mobile-notif-container) {
        display: none !important;
    }

    /* Asegurar que la zona de notificaciones y el menú estén a la derecha */
    .header-content {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.5rem 1rem !important;
        flex-wrap: nowrap !important;
    }

    /* Contenedor para alinear a la derecha */
    .mobile-only-notif-zone {
        display: none !important;
        /* Por defecto oculto, se activa en media query inferior si es necesario */
    }

    /* Activar solo cuando realmente estemos en móvil */
    @media (max-width: 1024px) {
        .mobile-only-notif-zone {
            display: flex !important;
            align-items: center !important;
            margin-left: auto !important;
            gap: 15px !important;
            margin-right: 15px !important;
            flex-shrink: 0 !important;
        }
    }

    .mobile-menu-btn {
        display: flex !important;
        position: relative !important;
        z-index: 1001 !important;
        flex-shrink: 0 !important;
    }

    /* Ajuste de logo para que no se aplaste */
    .logo-section {
        flex: 0 1 auto !important;
        max-width: 50% !important;
    }

    .logo-section img {
        height: 32px !important;
        width: auto !important;
    }

    .brand-text h1 {
        font-size: 1rem !important;
    }
}

/* === SIDEBAR DRAWER FIX === */
/* Asegurar que el menú lateral NO se vea recortado o por debajo de la cabecera */
.mobile-sidebar-drawer {
    z-index: 9999 !important;
    /* Por encima de la cabecera (1000) */
    top: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    position: fixed !important;
    transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1) !important;
    /* Evitar que cualquier margen superior lo baje */
    margin-top: 0 !important;
}

.mobile-sidebar-overlay {
    z-index: 9998 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* === OFFLINE.HTML - NOTAS RESPONSIVAS === */
@media (max-width: 768px) {

    /* Convertir el grid de 2 columnas a 1 columna en móvil */
    #offline-notes>div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        height: auto !important;
        min-height: 60vh !important;
    }

    /* Sidebar de notas - Hacer horizontal en móvil */
    #offline-notes>div>div:first-child {
        width: 100% !important;
        max-height: 200px !important;
        order: 2;
    }

    /* Editor de notas - Prioridad visual */
    #offline-notes>div>div:last-child {
        width: 100% !important;
        min-height: 400px !important;
        order: 1;
    }

    /* === PROGRAMA DE REFERIDOS RESPONSIVO === */
    .referral-widget-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center;
    }

    .ref-info-col,
    .ref-action-col {
        width: 100% !important;
    }

    .ref-stats-dashboard {
        flex-direction: column !important;
        gap: 1.2rem !important;
        align-items: center !important;
        background: rgba(255, 255, 255, 0.03) !important;
        padding: 1.5rem !important;
    }

    .ref-stats-dashboard .stat-box {
        border-left: none !important;
        padding-left: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        padding-bottom: 0.8rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .ref-stats-dashboard .stat-box:last-child {
        border-bottom: none;
    }

    .copy-group {
        flex-direction: column !important;
        background: transparent !important;
        border: none !important;
        gap: 10px;
    }

    .copy-group input {
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        width: 100% !important;
        text-align: center;
    }

    .copy-group button {
        width: 100% !important;
        padding: 12px !important;
        border-radius: 12px !important;
        height: 50px !important;
    }

    /* Rediseño de hitos */
    .ref-milestones {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    /* === BIBLIOTECA COMUNITARIA RESPONSIVA === */
    .library-stats-dashboard {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        padding: 0 5px;
    }

    .stat-card-mini {
        padding: 0.8rem !important;
        flex-direction: column !important;
        text-align: center;
        gap: 0.5rem !important;
        min-height: 100px;
    }

    .stat-card-mini .stat-icon {
        width: 32px !important;
        height: 32px !important;
        margin: 0 auto;
    }

    .stat-card-mini h3 {
        font-size: 1.1rem !important;
        margin: 0 !important;
    }

    .stat-card-mini span {
        font-size: 0.7rem !important;
        line-height: 1.2;
    }

    #view-library {
        padding-top: 1.5rem !important;
    }
}
