/* ePaper Reader Design System - Professional newspaper aesthetic */

/* Email Validation Styles */
.email-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.email-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.bg-background-light.dark\:bg-background-dark.flex.items-center.justify-center.min-h-screen.p-4.sm\:p-6.pt-2.sm\:pt-4.lg\:pt-2.px-4.sm\:px-6.lg\:px-8.pb-4.sm\:pb-6.lg\:pb-8 {
    min-height: 75vh;
}

.email-loading {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    background-image: linear-gradient(45deg, transparent 33%, rgba(255,255,255,.2) 33%, rgba(255,255,255,.2) 66%, transparent 66%);
    background-size: 20px 20px;
    animation: email-loading 1s linear infinite;
}

@keyframes email-loading {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

.email-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block !important;
    width: 100%;
    clear: both;
    font-weight: 500;
    line-height: 1.4;
    position: relative;
    left: 0;
    right: 0;
}

/* Ensure the subscribe form and its elements display properly */
#subscribe-form {
    display: flex;
    flex-direction: column !important;
    gap: 10px !important;
}

/* Container for input and button to be side by side */
#subscribe-form .input-button-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    align-items: flex-start !important;
}

#subscribe-form input {
    flex: 1 !important;
    width: auto !important;
    margin-bottom: 0 !important;
}

#subscribe-form button {
    flex-shrink: 0 !important;
    width: auto !important;
    margin-bottom: 0 !important;
    white-space: nowrap !important;
}

#subscribe-form .email-error {
    order: 2;
    margin-top: 5px !important;
    margin-bottom: 0 !important;
}

/* Design Tokens based on Tailwind/React app */
:root {
    /* Core newspaper colors */
    --background: hsl(0 0% 100%);
    --foreground: hsl(220 18% 15%);
    
    /* Paper-like backgrounds */
    --card: hsl(0 0% 98%);
    --card-foreground: hsl(220 18% 15%);
    
    --popover: hsl(0 0% 100%);
    --popover-foreground: hsl(220 18% 15%);
    
    /* Newspaper primary (deep blue-black) */
    --primary: hsl(220 28% 8%);
    --primary-foreground: hsl(0 0% 98%);
    
    /* Secondary (warm gray) */
    --secondary: hsl(210 11% 96%);
    --secondary-foreground: hsl(220 18% 15%);
    
    /* Muted tones */
    --muted: hsl(210 11% 96%);
    --muted-foreground: hsl(220 9% 46%);
    
    /* Accent (professional blue) */
    --accent: hsl(215 84% 54%);
    --accent-foreground: hsl(0 0% 98%);
    
    /* Newspaper red for highlights */
    --destructive: hsl(0 70% 50%);
    --destructive-foreground: hsl(0 0% 98%);
    
    /* Borders and inputs */
    --border: hsl(220 13% 91%);
    --input: hsl(220 13% 91%);
    --ring: hsl(215 84% 54%);
    
    /* Newspaper-specific colors */
    --newspaper-gray: hsl(220 9% 90%);
    --newspaper-text: hsl(220 18% 15%);
    --newspaper-accent: hsl(215 84% 54%);
    --ad-background: hsl(48 100% 96%);
    --hover-overlay: hsl(215 84% 54% / 0.1);

    --radius: 0.5rem;
}

/* AI Highlighting Styles */
@keyframes highlightPulse {
    0% {
        opacity: 0.8;
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(255, 235, 59, 0.8);
    }
    100% {
        opacity: 0.3;
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
    }
}

#ai-highlight-box {
    animation: highlightPulse 2s ease-in-out;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Clickable page references in AI responses */
.clickable-page {
    cursor: pointer !important;
    color: #3b82f6 !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
    transition: all 0.2s ease !important;
}

.clickable-page:hover {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #1d4ed8 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2) !important;
}

/* Enhanced AI chat response styling */
.ai-chat-response .chat-result-item {
    margin-bottom: 12px;
    padding: 12px;
    border-left: 3px solid #e5e7eb;
    background-color: rgba(249, 250, 251, 0.5);
    border-radius: 6px;
}

.ai-chat-response .result-title {
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.ai-chat-response .result-desc {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.ai-chat-response .result-page {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 4px;
    background: aliceblue;
    text-decoration-line: none !important;
}

/* Simple minimize/maximize functionality for existing AI modal */
.ai-minimize-btn, .ai-maximize-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
    transition: background-color 0.2s ease;
}

.ai-minimize-btn:hover, .ai-maximize-btn:hover {
    background-color: black;
    color: #333;
}

/* Simple minimized state - just hide the modal and show a small bar */
.ai-assistant-minimized-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.ai-assistant-minimized-bar:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Clickable highlights in key highlights section */
.clickable-highlight {
    cursor: pointer !important;
    color: #3b82f6 !important;
    transition: all 0.2s ease !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    margin: -4px -8px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
}

.clickable-highlight:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: #1d4ed8 !important;
    transform: translateY(-1px) !important;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

body {
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.6;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Consistent Lucide icon sizing and stroke */
.mobile-menu-btn svg,
.action-btn svg,
.btn svg,
.bottom-btn svg,
.nav-btn-overlay svg,
.action-btn-with-text svg,
.date-btn svg,
.dropdown svg,
.ai-assistant-btn svg,
.close-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}


.container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.main-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Header Styles - Exact match to React component */
.header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* not sticky by default */
}

.header .container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    position: relative;
}

.action-bar .container {
    width: 100%;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
}

/* Mobile menu - hidden on desktop */
.mobile-menu-container {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-container {
        display: block;
    }
}

.mobile-menu-btn {
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border) / 0.5);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.2s;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn:hover {
    background: hsl(var(--primary) / 0.1);
}

/* Publisher section */
.publisher-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    max-width: 200px;
    overflow: hidden;
}

@media (min-width: 768px) {
    .publisher-section {
        flex: 0 0 auto;
        justify-content: flex-start;
        max-width: 300px;
    }
}

@media (min-width: 1024px) {
    .publisher-section {
        max-width: 350px;
    }
}

.newspaper-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: color 0.2s;
}

@media (min-width: 768px) {
    .newspaper-title {
        font-size: 1.5rem;
    }
}

.newspaper-title:hover {
    color: var(--accent);
}

/* Date section - desktop only */
.date-section {
    display: none;
}

@media (min-width: 768px) {
    .date-section {
        display: flex;
        align-items: center;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
    }
}

.date-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--foreground);
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.date-btn:hover {
    background: var(--muted);
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-actions {
    display: flex;
    gap: 0.25rem;
}

@media (min-width: 768px) {
    .mobile-actions {
        display: none;
    }
}

.desktop-actions {
    display: none;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .desktop-actions {
        display: flex;
        align-items: center;
    }
}

/* User Login Section Styles */
.user-login-section {
    position: relative;
    display: flex;
    align-items: center;
}

.user-profile-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid hsl(var(--border) / 0.5);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.user-profile-btn:hover {
    background: hsl(var(--primary) / 0.1);
    border-color: hsl(var(--primary) / 0.3);
}

.user-photo {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-name {
    font-weight: 500;
    color: var(--foreground);
}

.dropdown-arrow {
    width: 1rem;
    height: 1rem;
}

/* User Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    min-width: 12rem;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--foreground);
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.dropdown-item:hover {
    background: hsl(var(--primary) / 0.1);
    color: var(--foreground);
}

.dropdown-item i {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--muted-foreground));
}

.dropdown-item.logout-item {
    color: hsl(var(--destructive));
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* Mobile User Profile Styles */
.mobile-user-login-section {
    width: 100%;
}

.mobile-user-profile {
    width: 100%;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: hsl(var(--muted) / 0.3);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.mobile-user-photo {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.mobile-user-name {
    font-weight: 600;
    color: var(--foreground);
    font-size: 1rem;
}

.mobile-user-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--foreground);
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
}

.mobile-menu-item:hover {
    background: hsl(var(--primary) / 0.1);
    color: var(--foreground);
}

.mobile-menu-item i {
    width: 1.25rem;
    height: 1.25rem;
    color: hsl(var(--muted-foreground));
}

.mobile-menu-item.logout-item {
    color: hsl(var(--destructive));
}

.mobile-menu-item.logout-item:hover {
    background: hsl(var(--destructive) / 0.1);
}

.action-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--foreground);
}

.action-btn:hover {
    background: hsl(var(--primary) / 0.1);
}

/* Button styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--muted);
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
    color: var(--primary)
}

.btn-outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--muted);
}

.btn-brain {
    background: #4285f4;
    color: white;
}

.btn-brain:hover {
    background: #3367d6;
}

/* Mobile SubHeader */
.mobile-subheader {
    display: block;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

@media (min-width: 768px) {
    .mobile-subheader {
        display: none;
    }
}

.subheader-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Ensure mobile-subheader is properly styled for mobile and action-bar is hidden */
@media (max-width: 767px) {
    .action-bar {
        display: none !important;
    }
    
    .mobile-subheader {
        display: block !important;
    }
    
    .subheader-content {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.dropdown-group {
    display: flex;
    gap: 0.5rem;
}

.dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 5rem;
}

.dropdown:hover {
    background: hsl(var(--muted) / 0.5);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 50;
    min-width: 12rem;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.dropdown-item:first-child {
    border-radius: 0.5rem 0.5rem 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Action Bar - Desktop Only */
.action-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
}

@media (min-width: 768px) {
    .action-bar {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .action-bar {
        display: none !important;
    }
}

.action-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Only apply flex layout on desktop for action-bar-content */
@media (max-width: 767px) {
    .action-bar-content {
        display: block;
    }
}

.action-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-container {
    position: relative;
}

.action-btn-with-text {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
    color: var(--newspaper-text);
    font-size: 0.875rem;
    padding-right: 0.8rem;
    padding-left: 0.8rem;
    font-weight: 500;
}

.action-btn-with-text:hover {
    background: var(--muted);
}

.action-btn-with-text span {
    display: none;
}

@media (min-width: 640px) {
    .action-btn-with-text span {
        display: inline;
    }
}

.zoom-level {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    padding: 0 0.5rem;
    font-weight: 500;
    min-width: 2.8125rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.zoom-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--muted-foreground);
    background: transparent;
    transition: all 0.2s ease;
    display: inline-block;
}

.zoom-dot.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* Fallback colors in case CSS variables don't work */
.zoom-indicator .zoom-dot {
    border-color: #6b7280;
}

.zoom-indicator .zoom-dot.active {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

/* Thumbnail Carousel */
.thumbnail-carousel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
}

.carousel-container {
    background: var(--card);
    border-radius: 0.5rem;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.thumbnail-carousel.show {
    display: flex !important;
}

.carousel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0.5rem 0.5rem 0 0;
}

.carousel-content {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .carousel-content {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

.carousel-item {
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--background);
}

.carousel-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.carousel-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px hsl(var(--accent) / 0.2);
}

.carousel-item-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.carousel-item-title {
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    color: var(--foreground);
}

@media (min-width: 640px) {
    .carousel-item-image {
        height: 150px;
    }
    
    .carousel-item-title {
        font-size: 0.875rem;
    }
}

.close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--muted);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0.5rem 0; /* Reduced from 1rem */
    /* Allow scrolling on iPad/tablet */
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .main-content {
        padding: 1rem 0; /* Reduced from 2rem */
    }
}

@media (max-width: 768px) {
    .main-content {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: calc(100vh + 160px) !important; /* Adjust this value based on header/footer height */
    }
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0; /* Removed gap to give more space to ads */
}

@media (min-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr 310px; /* Increased to 340px for better ad spacing */
        gap: 0; /* No gap between newspaper and sidebar */
    }
}

/* Mobile: Force single column layout when ads are hidden */
@media (max-width: 767px) {
    .imgareaselect-handle {
        background-color: #007bff !important;
        border: 2px solid white !important;
        width: 24px !important;
        height: 24px !important;
        border-radius: 50% !important;
        opacity: 0.9 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.4) !important;
    }
    .imgareaselect-outer {
        background-color: rgba(0, 0, 0, 0.5) !important;
    }

    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    .main-content {
        padding-top: 70px;
        padding-bottom: 80px; /* Add space for sticky mobile subheader */
    }

    .containerArow-box.contArow-Lft,
    .containerArow-box.contArow-Rgt {
        display: none !important;
    }

    .content-wrapper {
        grid-template-columns: 1fr !important;
        gap: 0;
    }
    
    /* Ensure newspaper section is visible on mobile */
    .main-content,
    .main-container,
    .newspaper-section,
    .newspaper-viewer {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .content-wrapper {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .newspaper-section {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #page-container {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
    
    .page-image {
        width: 100% !important;
        height: auto !important;
        display: block !important;
        max-width: 100% !important;
    }
    
    #page-div {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    /* Mobile swiper styles */
    .swiper-wrapper {
        width: 100% !important;
        display: block !important;
    }
    
    /* Hide swiper-wrapper when explicitly hidden via JavaScript */
    .swiper-wrapper[style*="display: none"],
    .swiper-container[style*="display: none"] {
        display: none !important;
    }
    
    .swiper-slide {
        width: 100% !important;
        display: block !important;
    }
    
    .swiper-zoom-container,
    .pinch-zoom {
        width: 100% !important;
        display: block !important;
        min-height: 400px;
    }
    
    .chunkimg {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
    }
}

/* Newspaper Viewer */
.newspaper-section {
    background: var(--card);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    /* Allow scrolling on iPad/tablet */
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
}

.newspaper-viewer {
    position: relative;
    padding: 0.5rem; /* Reduced from 1rem */
    /* Allow scrolling on iPad/tablet */
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    
    .newspaper-viewer {
        padding: 0.25rem; /* Reduced from 0.5rem */
        min-height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    /* Mobile swipe feedback message */
    .swipe-message {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 10px 20px;
        border-radius: 8px;
        z-index: 10000;
        font-size: 14px;
        font-weight: 500;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(4px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    /* Show mobile page number button only on mobile */
    .mobile-page-number-fixed {
        display: block !important;
    }
    
    /* Mobile page number button responsive adjustments */
    .mobile-page-number-btn {
        font-size: 13px !important;
        padding: 8px 15px !important;
    }
    
    .mobile-page-number-btn .page-text {
        font-size: 11px !important;
    }
    
    .mobile-page-number-btn .page-numbers {
        font-size: 14px !important;
    }
}

.newspaper-page {
    position: relative;
    background: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Zoomed scroll container */
#page-div {
    max-width: 100%;
    overflow: auto;
    /* Hide scrollbar while keeping scroll functionality */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    /* Allow scrolling on iPad/tablet */
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
}

/* Remove extra paddings/margins in zoom 3 for maximum space */
body.zoom-3 .newspaper-viewer { padding: 0; }
body.zoom-3 .newspaper-section { border-radius: 0; box-shadow: none; }
body.zoom-3 .container { padding-left: 0; padding-right: 0; }
body.zoom-3 .content-wrapper { gap: 0.5rem; }

/* iPad-specific zoom CSS removed - tablets now use mobile view */

#page-container {
    position: relative;
    /* Allow scrolling when not clipping */
    touch-action: pan-y pan-x;
    -webkit-overflow-scrolling: touch;
}

/* Tablet CSS removed - tablets now use mobile view */

/* Hide scrollbar for Chrome, Safari and Opera */
#page-div::-webkit-scrollbar {
    display: none;
}

/* Page Number Overlay */
.page-number-overlay {
    position: absolute;
    top: -2rem;
    right: 0;
    z-index: 30;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Navigation Buttons */
.nav-buttons {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 30;
}

.newspaper-page:hover .nav-buttons {
    opacity: 1;
}

.nav-btn-overlay {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: all;
}

.nav-btn-overlay:hover {
    background: rgba(0,0,0,0.9);
}

.nav-btn-overlay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn-overlay.left {
    left: 1rem;
}

.nav-btn-overlay.right {
    right: 1rem;
}

/* Newspaper Image */
.newspaper-image-container {
    position: relative;
}

.page-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

/* Tablet CSS removed - tablets now use mobile view */

/* iPad Mini specific: ensure page image maintains aspect ratio but allows horizontal scroll */
@media only screen and (min-width: 744px) and (max-width: 768px) {
    .page-image {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        min-width: 100% !important;
    }
    
    /* Ensure the image container allows scrolling */
    .newspaper-image-container {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Ensure chunks are scrollable */
    .chunkimg {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        min-width: 100% !important;
    }
}

/* Article Hotspots */
.article-hotspot {
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 0.25rem;
}

.article-hotspot:hover {
    border-color: var(--accent);
    background: var(--hover-overlay);
}

/* Sidebar Ads */
.sidebar-ads {
    display: none;
    flex-direction: column;
    gap: 1rem;
    min-width: 300px; /* Ensure minimum width for 300px wide ads */
}

/* Show sidebar ads only on desktop (larger than 1024px) */
@media (min-width: 1025px) {
    .sidebar-ads {
        display: flex;
    }
}

/* Hide sidebar ads on mobile and tablet devices (iPad Mini, Air, Pro, and phones) */
@media (max-width: 1024px) {
    .sidebar-ads,
    #page-right-panel {
        display: none !important;
    }
    
    /* Make content-wrapper full width when sidebar is hidden */
    .content-wrapper {
        grid-template-columns: 1fr !important;
    }
    
    /* Make newspaper section take full width */
    .newspaper-section {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Hide ads on mobile devices (phones) */
@media (max-width: 767px) {
    .adSpaceTop,
    .ad-banner,
    .top-banner,
    .bottom-banner {
        display: none !important;
    }
}

/* Ad container styling */
#page-right-panel {
    width: 100%;
    min-width: 300px;
}

.adBox-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* Google AdSense ad containers */
.side-ad-300-600,
.side-ad-160-600 {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.side-ad-300-600 ins,
.side-ad-160-600 ins {
    display: block;
    margin: 0 auto;
}

/* Header Ad Styles */
.adSpaceTop {
    width: 100%;
    float: left;
    padding: 10px 0px;
    background: #efefef;
}

.ad-box-top {
    text-align: center;
    width: 100%;
    float: left;
}

/* .ap-icons - removed empty ruleset */

/* Ad Banners */
.ad-banner {
    background: var(--ad-background);
    border: 1px solid var(--border);
}

.top-banner {
    border-bottom: none;
}

.bottom-banner {
    border-top: none;
}

.ad-placeholder {
    height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.sidebar-ads .ad-placeholder {
    height: 16rem;
    margin: 0;
}

/* All tablet-specific CSS removed - tablets now use mobile view */

/* Tablet devices (iPad mini/air/pro): hide side ads, keep top/bottom ads, expand newspaper */
@media (hover: none) and (pointer: coarse) and (min-width: 768px) {
    /* Force single-column layout */
    .content-wrapper {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    /* Hide right sidebar ads */
    .sidebar-ads,
    #page-right-panel,
    .side-ad-300-600,
    .side-ad-160-600 {
        display: none !important;
    }
    /* Ensure newspaper section uses full width and is scrollable */
    .newspaper-section,
    .newspaper-viewer {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Hide mobile bottom bar on tablets */
    .mobile-bottom-bar {
        display: none !important;
    }
    
    .mobile-page-number-fixed {
        display: none !important;
    }
    
    /* Show desktop footer on tablets */
    .footer-section {
        display: block !important;
    }
    
    /* Ensure page container is scrollable */
    #content-container {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Disable page-div scroll on iPad - use body/page scroll instead */
    #page-div {
        width: 100% !important;
        overflow: visible !important;
    }
    
    #de-chunks-container {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Page container should maintain aspect ratio but allow horizontal scroll */
    #page-container.mainclips {
        width: auto !important;
        min-width: 100% !important;
        max-width: none !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
    }
    
    /* Ensure page images are readable and scrollable */
    .page-image {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        min-width: 100% !important;
    }
    
    /* Ensure the image container allows scrolling */
    .newspaper-image-container {
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Ensure chunks are scrollable */
    .chunkimg {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        min-width: 100% !important;
    }
    
    /* Position right navigation arrow relative to page edge */
    .contArow-Rgt {
        right: 20px !important;
    }
}

/* Mobile Bottom Bar */
.mobile-bottom-bar {
    display: flex;
    background: whitesmoke;
    /* backdrop-filter: blur(12px);
    border-top: 1px solid hsl(var(--border) / 0.4); */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    box-shadow: 0 -6px 16px rgba(0,0,0,0.08);
    max-width: 100%;
    overflow: hidden;
    /* Reduced height since we removed main-row */
}

/* Removed mobile bottom bar button styles since buttons were moved to subheader */

/* Article boundaries button styling for mobile subheader */
.mobile-subheader .article-boundaries-btn-mobile {
    background: cornflowerblue;
    color: white;
    padding: 0px;
}

.mobile-subheader .article-boundaries-btn-mobile:hover {
    background: cornflowerblue;
    color: white;
    padding: 0px;
}

.mobile-subheader .article-boundaries-btn-mobile.active {
    background: cornflowerblue;
    color: white;
    padding: 0px;
}

.mobile-subheader .article-boundaries-btn-mobile.active:hover {
    background: cornflowerblue;
    color: white;
    padding: 0px;
}

/* Main content row wrapper */
.mobile-bottom-bar .main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-top: 24px;
}

/* Page info styling */
.mobile-bottom-bar .page-info-mobile {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

/* Removed main-row related styles since main-row was removed */

/* Fixed Mobile Page Number Button */
.mobile-page-number-fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: none; /* Hidden by default, shown only on mobile */
}

.mobile-page-number-btn {
    background: rgba(0, 123, 255, 0.8); /* Semi-transparent background */
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 110px;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-page-number-btn:hover {
    background: rgba(0, 86, 179, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.mobile-page-number-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mobile-page-number-btn .page-text {
    font-size: 12px;
    opacity: 0.9;
}

.mobile-page-number-btn .page-numbers {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.mobile-page-number-btn .page-separator {
    opacity: 0.7;
    margin: 0 2px;
}

/* Powered by section styling */
.mobile-bottom-bar .powerd {
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.75rem;
    color: white;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-bottom-bar .powerd a {
    text-decoration: none;
    color: var(--background);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: opacity 0.2s ease;
    vertical-align: middle;
}

.mobile-bottom-bar .powerd a:hover {
    opacity: 0.8;
}

.mobile-bottom-bar .powerd img {
    height: 14px;
    width: auto;
    vertical-align: middle;
}

/* Desktop Bottom Bar */
.desktop-bottom-bar {
    display: none;
}

/* Footer Section */
.footer-section {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 20px 10px;
    margin-top: 2rem;
}

.pub-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 14px;
    color: #666;
}

.pub-info .policy {
    flex: 1;
}

.pub-info .powerby {
    text-align: right;
}

.pub-info a {
    color: #007bff;
    text-decoration: none;
}

.pub-info a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .pub-info {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .pub-info .powerby {
        text-align: center;
    }
}

@media (min-width: 1024px) {
    /* Default (zoom != 3): hidden */
    .desktop-bottom-bar {
        display: none;
    }
    /* Sticky translucent only when zoom is 3 */
    body.zoom-3 .desktop-bottom-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        background: hsl(var(--background) / 0.6);
        backdrop-filter: blur(12px);
        border-top: none;
        box-shadow: none;
        padding: 0.5rem 0;
        pointer-events: none; /* let page interact through except on controls */
        display: block;
    }
    .desktop-bottom-content {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        pointer-events: auto; /* enable clicks on controls */
        position: relative;
    }
    .desktop-bottom-content .nav-group {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    .desktop-powered { color: var(--muted-foreground); padding-right: 1rem; }
}

@media (min-width: 768px) {
    .mobile-bottom-bar {
        display: none !important;
    }
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.action-group-mobile {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex: 1;
    justify-content: center;
    max-width: 200px;
}

.share-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.bottom-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s;
    color: var(--foreground);
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-btn:hover {
    background: hsl(var(--primary) / 0.1);
}

.bottom-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info-mobile {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    padding: 0 0.25rem;
    min-width: 35px;
    text-align: center;
}

/* AI Assistant Button */
.ai-assistant-btn {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    background: bisque;
    color: #d44632;
    border: none;
    border-radius: 9999px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.175rem;
    font-weight: 500;
}

@media (min-width: 768px) {
    .ai-assistant-btn {
        bottom: 4.5rem;
        left: 7%
    }
}

.ai-assistant-btn:hover {
    background: lightgrey;
    color: black;
}

.ai-assistant-btn img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Footer */
.footer {
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 4rem;
}

.footer .container.footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-nav .page-info {
    min-width: 4rem;
    text-align: center;
    font-weight: 500;
}

@media (min-width: 768px) {
    .footer {
        margin-bottom: 0;
    }
}

.brand {
    color: var(--accent);
    font-weight: 600;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--background);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--muted-foreground);
    line-height: 1;
}

.close:hover {
    color: var(--foreground);
}

/* AI Modal specific styles */
.ai-modal {
    max-width: 600px;
    padding: 0;
}

.ai-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-content {
    padding: 1rem;
}

.ai-messages {
    max-height: 700px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.ai-message {
    margin-bottom: 1rem;
}

.ai-message.bot .message-content {
    background: var(--muted);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-left: 0;
}

.ai-message.user .message-content {
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-left: 2rem;
    margin-right: 0;
}

.ai-input-area {
    display: flex;
    gap: 0.5rem;
}

.ai-input-area input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
}

.ai-quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ai-quick-actions .btn {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.ai-input-area button {
    padding: 0.75rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    min-width: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quiz Sidebar Modal */
#quizModal {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    justify-content: flex-end;
    align-items: stretch;
}

.quiz-modal {
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--background);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    margin: 0;
    max-height: none;
    overflow: hidden;
}

#quizModal.show .quiz-modal {
    transform: translateX(0);
}

.quiz-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--muted);
    flex-shrink: 0;
}

.quiz-content {
    padding: 1.5rem;
    text-align: center;
    overflow-y: auto;
    flex: 1;
}

.quiz-rules {
    text-align: left;
    margin-bottom: 2rem;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.rule-number {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 50%;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.rule-item p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0;
}

.highlight {
    color: var(--accent);
    font-weight: 500;
}

.quiz-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Popup styles */
.popup {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.popup.show {
    display: flex;
}

.popup#calendarPopup {
    position: absolute;
    z-index: 1000;
    left: 0; /* will be positioned via JS */
    top: 0;  /* will be positioned via JS */
    width: auto;
    height: auto;
    background: transparent; /* no backdrop */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: none; /* default hidden */
    align-items: unset;
    justify-content: unset;
}

.popup#calendarPopup.show {
    display: block; /* dropdown style */
}

.popup#calendarPopup .popup-content {
    margin: 0;
}

.popup-content {
    background: var(--background);
    margin: 0;
    padding: 0;
    border-radius: 0.75rem;
    width: 440px;
    max-width: 95vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

.popup.show .popup-content {
    transform: scale(1);
    opacity: 1;
}

.calendar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-content {
    padding: 1.5rem;
}

.calendar-note {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

.calendar-content input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
    margin-bottom: 1rem;
}

.calendar-info {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.edition-count {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.mobile-menu-overlay.show {
    display: block;
}

.mobile-menu-content {
    background: var(--background);
    width: 320px;
    height: 100%;
    padding: 0;
    overflow-y: auto;
}

.menu-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-header button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.menu-items {
    padding: 1.5rem;
}

.menu-section {
    margin-bottom: 2rem;
}

.menu-section h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.menu-btn {
    width: 100%;
    justify-content: flex-start;
    height: 3rem;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0;
    }
    
    /* Quiz sidebar responsive */
    .quiz-modal {
        width: 100%;
        max-width: 100vw;
    }
    
    .main-container {
        padding: 0;
    }
    
    .newspaper-title {
        font-size: 1rem;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 95%;
        padding: 1rem;
    }
}

/* Thumbnail Carousel */
.thumbnail-carousel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    z-index: 1000;
}

.thumbnail-carousel.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-container {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 90vw;
    max-height: 80vh;
    overflow: hidden;
}

.carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.carousel-header h3 {
    margin: 0;
    color: var(--foreground);
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: var(--transition-smooth);
}

.close-btn:hover {
    background: var(--muted);
    color: var(--foreground);
}

.carousel-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    position: relative;
}

/* Horizontal carousel layout for sections */
.carousel-items-horizontal {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 1rem 0;
    max-height: 60vh;
}

.carousel-items-horizontal::-webkit-scrollbar {
    display: none;
}

.carousel-item-horizontal {
    flex: 0 0 auto;
    width: 200px;
    border: none !important;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-smooth);
    background: var(--card);
    /* Tailwind shadow-md style */
    box-shadow: -4px 6px 8px 0px rgb(0 0 0 / 0.1), -2px 8px 4px -2px rgb(0 0 0 / 0.1);
}

.carousel-item-horizontal:hover {
    /* Tailwind shadow-lg style on hover */
    box-shadow: -4px 6px 8px 0px rgb(0 0 0 / 0.1), -2px 8px 4px -2px rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

.carousel-item-horizontal img {
    width: 100%;
    height: auto;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Navigation buttons for horizontal carousel */
.carousel-navigation {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

.carousel-nav-btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    pointer-events: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.carousel-nav-btn:hover {
    background: var(--muted);
    border-color: var(--primary);
}

.carousel-nav-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.carousel-prev {
    left: -20px;
}

.carousel-next {
    right: -20px;
}

.carousel-item {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-smooth);
    background: var(--card);
    /* Tailwind shadow-md style */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.carousel-item:hover {
    /* Tailwind shadow-lg style on hover */
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

.carousel-item img {
    width: 100%;
    height: auto;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.carousel-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

/* Sections Bar (dropdown with carousel) */
.sections-bar { 
    position: fixed;
    top: 120px;
    left: 0;
    right: 0;
    transform: translateY(-10px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 100vw;
    max-width: 100vw;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1050;
    display: none;
    margin: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Editions specific styling */
.sections-items .carousel-item-horizontal {
    flex: 0 0 auto;
    width: 150px;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.25rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--card);
    margin-right: 0.5rem;
}

.sections-items .carousel-item-horizontal:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sections-items .carousel-item-horizontal:last-child {
    margin-right: 0;
}

/* Cover image styling for editions carousel */
.sections-items .carousel-item-horizontal .vs_img img {
    height: 100% !important;
    width: 100% !important;
    object-fit: contain !important;
    border-radius: 6px;
    max-width: 100%;
}

.sections-items .carousel-item-horizontal .vs_img {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.25rem;
    height: 200px;
    width: 100%;
    overflow: hidden;
}

/* Remove excess white space from caption */
.sections-items .carousel-item-horizontal .vs_cardcaption {
    margin: 0 !important;
    padding: 0.25rem  0 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    line-height: 1.2 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    min-height: 1.2em;
}

.sections-bar.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
    padding: 10px;
    padding-top: 0px
}

/* .sections-bar-inner styling is now handled by .sections-bar */
.sections-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 10px;
}
.sections-bar-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(220deg 18% 15% / 77%);
    margin-left: 10px;
}
.sections-bar-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sections-items {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0.5rem 0;
    width: 100%;
    /* Hide scrollbar */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    background: #a9a9a99e;
    padding-left: 15px;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.sections-items::-webkit-scrollbar {
    display: none;
}

/* Quiz Modal Styles */
#quizModal .modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

#quizModal .quiz {
    width: 100%;
}

#quizModal .quiz-disabled {
    text-align: center;
    padding: 2rem;
}

#quizModal .quiz-disabled h3 {
    color: var(--foreground);
    margin-bottom: 1rem;
}

#quizModal .quiz-disabled p {
    color: var(--muted-foreground);
    margin-bottom: 2rem;
}

/* AI Assistant Modal Styles */
#aiAssistantModal .modal-content {
    max-width: 500px;
    max-height: 80vh;
    padding: 0;
    overflow: hidden;
}

.ai-modal {
    display: flex;
    flex-direction: column;
    height: 70vh;
    max-height: 600px;
}

.ai-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.ai-header .close {
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
}

@media (max-width: 768px) {
    .ai-messages {
        padding: 0 !important;
    }
    
    .ai-message .message-content {
        padding: 0.35rem !important;
    }
    
    .story-highlight {
        padding: 0 !important;
        border-left: none !important;
    }

     .ai-content {
         padding: 0 !important;
     }
     
     .action-group-mobile {
         display: flex;
         gap: 0.5rem;
         align-items: center;
     }
     
     .mobile-share-dropdown {
         position: absolute;
         bottom: 85px;
         right: 1rem;
         background: var(--background);
         border: 1px solid var(--border);
         border-radius: 8px;
         box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
         /* padding: 0.5rem; */
         /* z-index: 1000; */
     }
     
     .mobile-share-dropdown .share-icons-row {
         display: flex;
         gap: 0.5rem;
     }
     
     .mobile-share-dropdown .share-icon-btn {
         width: 40px;
         height: 40px;
         border-radius: 6px;
         border: none;
         display: flex;
         align-items: center;
         justify-content: center;
         font-size: 1.2rem;
         cursor: pointer;
         transition: all 0.2s ease;
     }
}

/* Desktop page info styling */
.desktop-page-info {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--foreground);
    background: var(--muted);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    margin-right: 0.5rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ai-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-quick-actions {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-quick-actions .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background);
}

.ai-message {
    margin-bottom: 1rem;
    display: flex;
}

.ai-message.user {
    justify-content: flex-end;
}

.ai-message.bot {
    justify-content: flex-start;
}

.ai-message .message-content {
    max-width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.ai-message.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 0.3rem;
}

.ai-message.bot .message-content {
    background: var(--muted);
    color: var(--foreground);
    border-bottom-left-radius: 0.3rem;
}

.ai-message.typing .message-content {
    background: var(--muted);
    color: var(--muted-foreground);
}

.typing-dots {
    display: inline-block;
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

.ai-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--card);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ai-input-area input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: var(--background);
    color: var(--foreground);
}

.ai-input-area input:focus {
    outline: none;
    border-color: var(--primary);
}

.ai-input-area button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.ai-input-area button:hover {
    background: var(--primary-dark);
    color:#000;
}

/* .ai-input-area button:last-child {
    background: var(--secondary);
} */

/* .ai-input-area button:last-child:hover {
    background: var(--secondary-dark);
} */

@media (max-width: 768px) {
    #aiAssistantModal .modal-content {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .ai-modal {
        height: 80vh;
    }
    
    .ai-quick-actions {
        flex-direction: column;
    }
    
    .ai-quick-actions .btn {
        width: 100%;
    }
}
.sections-prev { position: absolute; left: -12px; top: 50%; transform: translateY(-50%); }
.sections-next { position: absolute; right: -12px; top: 50%; transform: translateY(-50%); }

/* Publisher Logo Styles */
.publisher-section {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
}

.publisher-section a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.publisher-logo {
    height: auto;
    max-height: 3rem;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.newspaper-title {
    color: var(--foreground);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

/* Current Date Styles */
.current-date {
    font-weight: 550;
    font-size: 1.1rem;
}

/* Mobile menu header styles */
.menu-header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-logo {
    height: 1.75rem;
    width: auto;
    max-width: 60px;
    object-fit: contain;
}

/* Responsive adjustments for logo */
@media (max-width: 768px) {
    .publisher-logo {
        max-height: 2.5rem;
        max-width: 100%;
    }
    
    .newspaper-title {
        font-size: 1rem;
    }

    #calendarMonthYear {
        font-size: 1.025rem !important;
        font-weight: 500 !important;
    }
}

/* Calendar Styles */
.calendar-popup-content {
    max-width: 320px;
    width: 152%;
}

.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav-btn {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

.calendar-nav-btn:hover {
    background: var(--secondary-hover, var(--muted));
}

.calendar-nav-btn i {
    width: 1rem;
    height: 1rem;
}

#calendarMonthYear {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
}

.calendar-grid {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--muted);
}

.weekday {
    padding: 0.75rem 0;
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    border-right: 1px solid var(--border);
}

.weekday:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--background);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    color: var(--foreground);
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:hover:not(.disabled) {
    background: var(--muted);
}

.calendar-day.disabled {
    color: var(--muted-foreground);
    cursor: not-allowed;
}

.calendar-day.other-month {
    color: var(--muted-foreground);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 600;
}

.calendar-day.published {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
    border: 1px solid #93c5fd;
}

.calendar-day.published:hover {
    background: #bfdbfe;
}

.calendar-day.selected {
    background: #f0f9ff;
    color: #0c4a6e;
    font-weight: 600;
    border: 2px solid #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.calendar-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.edition-count {
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    text-align: center;
    padding: 8px 12px;
    background: #dbeafe;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Responsive calendar */
@media (max-width: 580px) {
    .popup-content {
        width: 75vw;
        margin: 0 auto;
    }
    
    .calendar-header {
        padding: 0.75rem 1rem;
    }
    
    .calendar-header h3 {
        font-size: 1rem;
    }
    
    .weekday {
        font-size: 0.75rem;
        padding: 0.5rem 0;
    }
    
    .calendar-day {
        font-size: 0.75rem;
        aspect-ratio: 1;
    }
    
    .calendar-content {
        padding: 0.75rem;
    }
    
    .edition-count {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    #calendarPopup {
        left: 12% !important;
        top: 45px !important;
        /* display: block !important; */
    }
}

@media (max-width: 480px) {
    .popup-content {
        width: 75vw;
    }
    
    .calendar-header {
        padding: 0.5rem 0.75rem;
    }
    
    .calendar-content {
        padding: 0.5rem;
    }
    
    .calendar-days {
        gap: 1px;
        padding: 4px;
    }
    
    .calendar-day {
        font-size: 0.7rem;
    }

    #calendarPopup {
        left: 45px;
        top: 65px;
        display: block;
    }
}

/* Navigation button styles from volume.hbs */
.btn-orng {
    background: #e3e3e3;
    color: #555;
    border: none;
    padding: 5px 13px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-orng a {
    color: #555;
    text-decoration: none;
}

.containerArow-box {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease-in-out;
    z-index: 1000;
    width: 60px;
    height: 60px;
}

.contArow-Lft {
    left: 20px;
}

.contArow-Rgt {
    right: 20px;
}

/* Default positioning - calculate based on newspaper section width */
/* On desktop with ads: newspaper section = calc(100vw - 310px), position 20px from right edge of newspaper */
/* On desktop without ads: position 20px from screen edge */
/* Use max() to ensure arrows stay within newspaper section bounds */

@media (min-width: 1024px) {
    /* First: When ads are hidden (JavaScript sets grid-template-columns: 1fr), position at screen edge */
    /* Higher specificity selectors first */
    body:has(.content-wrapper[style*="grid-template-columns: 1fr"]:not([style*="1fr 310px"])) .contArow-Rgt,
    .content-wrapper[style*="grid-template-columns: 1fr"]:not([style*="1fr 310px"]) .contArow-Rgt,
    body.sidebar-ads-hidden .contArow-Rgt,
    body:has(.sidebar-ads[style*="display: none"]) .contArow-Rgt,
    body:has(.sidebar-ads[style*="display:none"]) .contArow-Rgt {
        right: 20px !important;
    }
    
    /* Second: When ads are visible (default CSS or inline style with 2 columns), position at right edge of newspaper */
    body:has(.content-wrapper[style*="grid-template-columns: 1fr 310px"]) .contArow-Rgt,
    body:has(.content-wrapper[style*="grid-template-columns:1fr 310px"]) .contArow-Rgt,
    .content-wrapper[style*="grid-template-columns: 1fr 310px"] .contArow-Rgt,
    .content-wrapper[style*="grid-template-columns:1fr 310px"] .contArow-Rgt {
        right: calc(310px + 20px) !important;
    }
    
    /* Last: Default fallback - assume ads are visible (matches default CSS grid-template-columns: 1fr 310px) */
    .contArow-Rgt {
        right: calc(310px + 20px) !important;
    }
}

/* For smaller screens (tablets, small laptops) - position relative to newspaper section */
@media (min-width: 768px) and (max-width: 1023px) {
    .contArow-Rgt {
        right: 20px !important; /* Always at edge on smaller screens */
    }
}

.aside-previous-page, .aside-next-page {
    position: relative;
    background: darkgray !important;
    border: 2px solid #ddd !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.aside-previous-page:hover, .aside-next-page:hover {
    background: #fff;
    border-color: #007bff;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.aside-previous-page i, .aside-next-page i {
    font-size: 18px;
    color: #333;
}

.aside-previous-page:hover i, .aside-next-page:hover i {
    color: #007bff;
}

/* Disabled state for navigation arrows */
.aside-previous-page.disabled, .aside-next-page.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.aside-previous-page.disabled i, .aside-next-page.disabled i {
    color: #999 !important;
}

.containerArow-box.nav-visible {
    opacity: 1;
}

.aside-previous-page:hover, .aside-next-page:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Ensure newspaper-viewer has relative positioning for navigation */
.newspaper-viewer {
    position: relative;
}

#content-row {
    position: relative;
}

/* Force navigation arrows to be visible */
.containerArow-box {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.containerArow-box .aside-previous-page,
.containerArow-box .aside-next-page {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Override JavaScript hide() calls for navigation arrows */
.aside-previous-page, .aside-next-page {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.containerArow-box.contArow-Lft,
.containerArow-box.contArow-Rgt {
    display: flex;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 12;
}

/* Specific fix for right arrow - force it to be visible */
.contArow-Rgt {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.contArow-Rgt .aside-next-page {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Sections bar popups now have higher z-index (1050) than arrows (1000) so they appear above */

/* Mobile navigation adjustments */
@media only screen and (max-width: 768px) {
    .containerArow-box {
        width: 50px;
        height: 50px;
    }
    
    .contArow-Lft {
        left: 10px;
    }
    
    .contArow-Rgt {
        right: 10px !important; /* Override any desktop rules on mobile */
    }
    
    .aside-previous-page, .aside-next-page {
        width: 45px !important;
        height: 45px !important;
    }
    
    .aside-previous-page i, .aside-next-page i {
        font-size: 16px;
    }
}

/* Extra small screens */
@media only screen and (max-width: 480px) {
    .containerArow-box {
        width: 45px;
        height: 45px;
    }
    
    .contArow-Lft {
        left: 5px;
    }
    
    .contArow-Rgt {
        right: 5px;
    }
    
    .aside-previous-page, .aside-next-page {
        width: 40px !important;
        height: 40px !important;
    }
    
    .aside-previous-page i, .aside-next-page i {
        font-size: 14px;
    }
}

/* Simple Login Container Styles */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    overflow: hidden;
}

button#subscribe-submit {
    height: 10px;
    padding: 10px;
    font-size: 15px !important;
    margin-left: 5px;
    background: #e2ad38;
    color: white;
}

/* Hide bottom navigation and prevent scrolling when login is active */
/* body:has(.before-login-div:not([style*="display: none"])) { overflow: hidden; } - removed empty ruleset */

body:has(.before-login-div:not([style*="display: none"])) .bottom-navigation,
body:has(.before-login-div:not([style*="display: none"])) .page-bottom,
body:has(.before-login-div:not([style*="display: none"])) #page-bottom {
    display: none !important;
}

.login-content {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 
        0 32px 64px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 0;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    text-align: left;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Close Button */
.login-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: #64748b;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.login-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: scale(1.1);
}

/* Premium Badge */
.premium-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4);
    z-index: 10;
}

.premium-badge i {
    font-size: 1rem;
}

.publication-info {
    display: flex;
    align-items: flex-start;
    gap: 4rem;
    padding: 3rem 3rem 2rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.4) 100%);
}

.publication-cover-wrapper {
    position: relative;
}

.publication-cover {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: perspective(1000px) rotateY(-8deg) rotateX(2deg);
    transition: transform 0.4s ease;
}

.publication-cover:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg) scale(1.02);
}

.publication-cover img {
    width: 160px;
    height: 200px;
    object-fit: cover;
    display: block;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.publication-cover:hover .cover-overlay {
    opacity: 1;
}

.publication-details {
    flex: 1;
    padding-top: 0.5rem;
}

.publication-title {
    font-size: 2.75rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.publication-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.publication-publisher,
.publication-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.publication-publisher i,
.publication-date i {
    color: #3b82f6;
    width: 16px;
}

.publication-description {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

/* Login Section */
.login-section {
    padding: 2rem 3rem 3rem;
    background: rgba(255, 255, 255, 0.5);
}

.login-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.login-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
    flex-shrink: 0;
}

.login-icon i {
    font-size: 1.4rem;
    color: white;
}

.login-text h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.login-text p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Benefits */
.login-benefits {
    display: grid;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: translateX(4px);
}

.benefit-item i {
    color: #10b981;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.benefit-item span {
    color: #374151;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Enhanced Login Button */
.enhanced-login-btn {
    position: relative;
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: 
        0 12px 30px rgba(59, 130, 246, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enhanced-login-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e3a8a 100%);
    transform: translateY(-3px);
    box-shadow: 
        0 20px 40px rgba(59, 130, 246, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.2);
}

.enhanced-login-btn:active {
    transform: translateY(-1px);
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 2;
    position: relative;
}

.btn-content i {
    font-size: 1.2rem;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.enhanced-login-btn:hover .btn-shine {
    left: 100%;
}

/* Help Text */
.login-help {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

.help-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.help-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Decorative Elements */
.login-decorations {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    animation: float 6s ease-in-out infinite;
}

.decoration-1 {
    width: 120px;
    height: 120px;
    top: 10%;
    right: 5%;
    animation-delay: 0s;
}

.decoration-2 {
    width: 80px;
    height: 80px;
    bottom: 20%;
    left: 8%;
    animation-delay: 2s;
}

.decoration-3 {
    width: 60px;
    height: 60px;
    top: 60%;
    right: 15%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
}

/* Blurred newspaper background at bottom of login popup */
.login-newspaper-background {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    overflow: hidden;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    z-index: -1;
}

.newspaper-preview-blur {
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to bottom, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 30%, rgba(255,255,255,0.3) 100%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 200"><rect fill="%23f8fafc" width="400" height="200"/><rect fill="%23e2e8f0" x="20" y="20" width="360" height="8"/><rect fill="%23e2e8f0" x="20" y="35" width="280" height="6"/><rect fill="%23e2e8f0" x="20" y="48" width="320" height="6"/><rect fill="%23e2e8f0" x="20" y="61" width="240" height="6"/><rect fill="%23e2e8f0" x="20" y="80" width="180" height="40"/><rect fill="%23cbd5e1" x="220" y="80" width="160" height="6"/><rect fill="%23cbd5e1" x="220" y="93" width="140" height="6"/><rect fill="%23cbd5e1" x="220" y="106" width="160" height="6"/><rect fill="%23cbd5e1" x="20" y="135" width="360" height="6"/><rect fill="%23cbd5e1" x="20" y="148" width="300" height="6"/><rect fill="%23cbd5e1" x="20" y="161" width="280" height="6"/></svg>');
    background-size: cover;
    background-position: center;
    filter: blur(2px);
    opacity: 0.6;
}

/* Add padding to login message to account for background */
.login-message {
    padding-bottom: 2rem;
    position: relative;
    z-index: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .login-container {
        padding: 0.5rem;
    }
    
    .login-content {
        max-width: 100%;
        border-radius: 20px;
    }
    
    .publication-info {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
        padding: 2rem 2rem 1.5rem;
    }
    
    .publication-cover {
        transform: none;
        margin: 0 auto;
    }
    
    .publication-cover img {
        width: 120px;
        height: 150px;
    }
    
    .publication-details {
        text-align: center;
        padding-top: 0;
    }
    
    .publication-title {
        font-size: 1.4rem;
    }
    
    .publication-meta {
        align-items: center;
        justify-content: center;
    }
    
    .login-section {
        padding: 1.5rem 2rem 2rem;
    }
    
    .login-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .login-text h3 {
        font-size: 1.3rem;
    }
    
    .enhanced-login-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .decoration-circle {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-content {
        padding: 1.5rem 1rem 0;
    }
    
    .publication-cover img {
        width: 80px;
        height: 100px;
    }
    
    .publication-title {
        font-size: 1.2rem;
    }
    
    .login-message h3 {
        font-size: 1.3rem;
    }
    
    .login-btn {
        width: 100%;
        justify-content: center;
    }
    
    .login-newspaper-background {
        height: 80px;
    }
}

/* ===== CLIPPING MODAL STYLES ===== */
#clipping-panel {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

#clipping-panel .modal-content {
    background-color: #ffffff;
    margin: 10% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

#clipping-panel .modal-close {
    color: black;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

#clipping-panel .modal-close:hover,
#clipping-panel .modal-close:focus {
    color: #ffffff;
    background-color: #dc3545;
    text-decoration: none;
}

/* Clipping panel header */
#clipping-panel .clip-header {
    background: #00000052;
    color: white;
    padding: 20px 25px;
    text-align: center;
    position: relative;
}

#clipping-panel .clip-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: black;
}

/* Clip content area */
#clipping-panel .clip-content {
    padding: 25px;
}

.clipbox {
    text-align: center;
    margin: 20px 0;
}

.clipimage {
    display: block;
    width: 100%;
    max-width: 350px;
    height: 200px;
    background-size: cover;
    background-position: center;
    border: 3px solid #e9ecef;
    border-radius: 8px;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.clipimage:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Action buttons */
.clipactions {
    text-align: center;
    margin: 25px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.clipactions button,
.clipactions a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 2px solid transparent;
        border-radius: 50%;
        cursor: pointer;
        font-size: 20px;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.3s ease;
        min-width: unset;
}


.clipactions .btn-default {
    background: #f8f9fa;
    color: #495057;
    border-color: #dee2e6;
}

.clipactions .btn-default:hover {
    transform: translateY(-2px);
}

.clipactions .wAppshare {
    background: #25d366;
    color: white;
    border-color: #25d366;
}


.clipactions .twshare {
    background: black;
    color: white;
    border-color: black;
}


.clipactions .fbshare {
    background: #4267b2;
    color: white;
    border-color: #4267b2;
}


/* Link to clip section */
.linktoclip {
    margin: 25px 0;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.linktoclip label {
    margin-bottom: 0;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    white-space: nowrap;
}

.linktoclip input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease;
}

.share-popup {
    max-width: 500px;
    height: auto;
}


.linktoclip input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Enhanced loader */
.loader {
    text-align: center;
    padding: 50px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.loader i {
    font-size: 32px;
    color: #007bff;
    margin-bottom: 15px;
    animation: spin 1s linear infinite;
}

.loader h3 {
    margin: 0;
    color: #495057;
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading overlay */
.clip-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
}

.clip-loading-content {
    text-align: center;
    padding: 20px;
}

.clip-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.clip-loading-text {
    color: #495057;
    font-size: 16px;
    font-weight: 500;
}

/* Mobile clip panel - Enhanced styles */
#clip-panel {
    z-index: 10000;
    overflow: hidden;
}

#clip-panel.clip-panel-showing {
    display: block !important;
    animation: clipModalFadeIn 0.3s ease-out;
}

#clip-panel.clip-panel-hiding {
    animation: clipModalFadeOut 0.3s ease-in forwards;
}

@keyframes clipModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes clipModalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Backdrop - Semi-transparent, doesn't hide newspaper */
.clip-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9999;
    pointer-events: auto;
    /* Ensure newspaper content remains visible and interactive behind backdrop */
    opacity: 0.4;
}

/* Ensure newspaper content is not hidden when modal is open */
#clip-panel.clip-panel-showing ~ *,
#clip-panel.clip-panel-showing + * {
    /* Keep newspaper visible */
}

/* Prevent body from being fixed when modal opens (this was causing distortion) */
body.clip-modal-open {
    overflow: hidden;
    /* Don't use position: fixed as it distorts the newspaper layout */
}

/* Modal dialog - Smooth slide animation */
#clip-panel .clip-modal-dialog {
    max-width: 90%;
    margin: 5% auto;
    position: relative;
    z-index: 10001;
    animation: clipModalSlideIn 0.3s ease-out;
}

#clip-panel.clip-panel-hiding .clip-modal-dialog {
    animation: clipModalSlideOut 0.3s ease-in forwards;
}

@keyframes clipModalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes clipModalSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-30px);
        opacity: 0;
    }
}

/* Modal content */
#clip-panel .clip-modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

/* Modal header */
#clip-panel .clip-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#clip-panel .clip-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
    flex: 1;
}

/* Modal body */
#clip-panel .clip-modal-body {
    padding: 20px;
    min-height: 200px;
    position: relative;
}

/* Screen transitions */
#clip-panel .clip-screen {
    animation: clipScreenFadeIn 0.3s ease-in;
}

@keyframes clipScreenFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced loader styles */
#clip-panel .clip-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    padding: 40px 20px;
}

#clip-panel .clip-loader-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

#clip-panel .spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: clipSpinnerRotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

#clip-panel .spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
}

#clip-panel .spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: #28a745;
}

#clip-panel .spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: #ffc107;
}

@keyframes clipSpinnerRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#clip-panel .clip-loader-text {
    font-size: 18px;
    font-weight: 500;
    color: #495057;
    margin: 0;
    text-align: center;
}

/* Legacy loader fallback */
#clip-panel .loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    padding: 40px 20px;
}

#clip-panel .loader i {
    font-size: 32px;
    color: #007bff;
    margin-bottom: 15px;
}

#clip-panel .loader h3 {
    font-size: 18px;
    font-weight: 500;
    color: #495057;
    margin: 0;
}

#clip-panel .screens {
    min-height: 200px;
}

/* Close button hover effect */
#clip-panel .close_clip_modal:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
    transform: scale(1.1);
}

/* Clip box styling */
#clip-panel .clipbox {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    margin-bottom: 20px;
    background: #f8f9fa;
}

#clip-panel .clipbox .clipimage {
    display: block;
    height: 200px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    border-radius: 4px;
}

/* Share actions */
#clip-panel .clipactions {
    text-align: center;
    padding: 15px 0;
}

#clip-panel .clipactions b {
    display: block;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

#clip-panel .clipactions .btn {
    margin: 5px;
    padding: 10px 15px;
    border-radius: 6px;
    transition: all 0.2s;
}

#clip-panel .clipactions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* imgAreaSelect styles - ensure clipping selection is visible */
.imgareaselect-border1,
.imgareaselect-border2,
.imgareaselect-border3,
.imgareaselect-border4 {
    background: url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==);
    filter: alpha(opacity=50);
    opacity: 0.5;
    z-index: 9999 !important;
    position: absolute !important;
    pointer-events: none !important;
}

.imgareaselect-handle {
    background-color: #fff;
    border: solid 1px #000;
    filter: alpha(opacity=50);
    opacity: 0.5;
    z-index: 10001 !important;
    position: absolute !important;
    cursor: nwse-resize;
    pointer-events: auto !important;
}

.imgareaselect-outer {
    background-color: #000;
    filter: alpha(opacity=50);
    opacity: 0.5;
    z-index: 9998 !important;
    position: absolute !important;
    pointer-events: none !important;
}

.imgareaselect-selection {
    background-color: transparent;
    border: 2px solid #fff;
    border-radius: 0;
    z-index: 10000 !important;
    position: absolute !important;
    cursor: move;
    pointer-events: none !important;
}

/* Ensure clip options popup stays on top */
#clip-options {
    z-index: 9999 !important;
    position: fixed !important;
    pointer-events: auto !important;
    background: white !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
    border-radius: 6px !important;
    border: 2px solid #007bff !important;
    min-width: 180px !important;
}

#clip-options .btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 10006 !important;
    position: relative !important;
}

#clip-options .popover-arrow {
    display: none !important;
}

/* Ensure page container has relative positioning for clipping */
#page-container {
    position: relative !important;
}

/* Reduce z-index of selection handles when popup is visible */
.imgareaselect-selection {
    pointer-events: none !important;
}

/* Keep handles interactive */
.imgareaselect-handle {
    pointer-events: auto !important;
}

/* Clip options popup content styling */
#clip-options .popover-body {
    padding: 5px;
}

#clip-options .popover-body p {
    margin: 0 0 10px 0;
    font-size: 14px;
}

#clip-options .btn {
    margin: 2px;
    padding: 5px 10px;
    font-size: 12px;
    display: inline-block;
    vertical-align: middle;
}

#clip-options .popover-body {
    text-align: center;
}

#clip-options .btn-primary {
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
    border-radius: 4px;
    margin-right: 5px;
}

#clip-options .btn-link {
    background: transparent;
    color: #6c757d;
    border: none;
    text-decoration: none;
    margin-left: 5px;
}

#clip-options .btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

#clip-options .btn-link:hover {
    color: #495057;
    text-decoration: underline;
}

/* ===== SHARE DROPDOWN STYLES ===== */
.share-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    margin-top: 8px;
}

.share-dropdown-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 20px;
    min-width: 200px;
    border: 1px solid #e9ecef;
}

.share-dropdown-content h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    text-align: center;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.share-btn i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.share-btn.facebook-share {
    background: #f8f9fa;
    color: #4267b2;
    border: 1px solid #e9ecef;
}

.share-btn.facebook-share:hover {
    background: #4267b2;
    color: white;
    transform: translateY(-1px);
}

.share-btn.twitter-share {
    background: #f8f9fa;
    color: #1da1f2;
    border: 1px solid #e9ecef;
}

.share-btn.twitter-share:hover {
    background: #1da1f2;
    color: white;
    transform: translateY(-1px);
}

.share-btn.whatsapp-share {
    background: #f8f9fa;
    color: #25d366;
    border: 1px solid #e9ecef;
}

.share-btn.whatsapp-share:hover {
    background: #25d366;
    color: white;
    transform: translateY(-1px);
}

/* Position share dropdown relative to parent */
.action-group {
    position: relative;
}

/* Share button styling */
.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
    width: 100%;
    text-align: left;
}

.share-btn:hover {
    background: var(--muted);
}

/* Facebook button */
.share-btn.facebook-share:hover {
    background: #1877f2;
    color: white;
}

/* Twitter/X button - modern black X theme */
.share-btn.twitter-share:hover {
    background: #000000;
    color: white;
}

/* X icon styling */
.x-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Share Icons Dropdown */
.share-icons-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    text-align: center;
}

/* Share Icons Row */
.share-icons-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.share-icon-btn {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 22px;
}

.share-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Individual share button colors on hover */
.share-icon-btn.facebook-share:hover {
    background: #4267b2;
    border-color: #4267b2;
    color: white;
}

.share-icon-btn.twitter-share:hover {
    background: #000000;
    border-color: #000000;
    color: white;
}

.share-icon-btn.whatsapp-share:hover {
    background: #2cd46b;
    border-color: #2cd46b;
    color: white;
}

/* WhatsApp button */
.share-btn.whatsapp-share:hover {
    background: #25d366;
    color: white;
}

/* Share dropdown styling */
.share-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 50;
    min-width: 200px;
    padding: 1rem;
}

.share-dropdown h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Quiz Panel (Right Side Layover) */
.quiz-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.quiz-panel-content {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    max-width: 44rem;
    background: var(--card);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
    padding: 1.5rem;
    background: #a9a9a9a1;
}

.quiz-panel-overlay:not([style*="display: none"]) .quiz-panel-content {
    transform: translateX(0);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    margin-top: 6rem;
    border-radius: 10px;
}

.quiz-container .quiz-header {
    margin-top: 0;
}

.quiz-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
}

.quiz-rules {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.quiz-rule {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.rule-number {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
}

.quiz-rule p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.accent-text {
    color: var(--accent);
    font-weight: 500;
}

.quiz-start-btn {
    width: 100%;
    background: var(--accent);
    color: var(--accent-foreground);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.quiz-start-btn:hover {
    background: var(--accent-hover, var(--accent));
    opacity: 0.9;
}

/* Hide date section when quiz modal is open */
.quiz-panel-overlay:not([style*="display: none"]) ~ * .date-section,
body:has(.quiz-panel-overlay:not([style*="display: none"])) .date-section {
    display: none !important;
}

/* Ensure quiz modal has higher z-index than calendar popup */
.quiz-panel-overlay {
    z-index: 1000 !important;
}

/* Hide calendar popup when quiz is open to prevent mobile interference */
.quiz-panel-overlay:not([style*="display: none"]) ~ #calendarPopup,
body:has(.quiz-panel-overlay:not([style*="display: none"])) #calendarPopup {
    display: none !important;
}

/* Mobile specific: Ensure quiz modal touch areas are not blocked */
@media (max-width: 768px) {
    .quiz-panel-overlay {
        z-index: 1001 !important;
    }
    
    /* Hide any fixed elements that might interfere on mobile */
    .quiz-panel-overlay:not([style*="display: none"]) ~ * [style*="position: fixed"],
    body:has(.quiz-panel-overlay:not([style*="display: none"])) [style*="position: fixed"]:not(.quiz-panel-overlay):not(.quiz-panel-content) {
        pointer-events: none !important;
    }
}

/* Mobile Subheader Styles */
.action-btn-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
}

.action-btn-mobile:hover {
    background: #f5f5f5;
}

.action-btn-mobile i {
    width: 16px;
    height: 16px;
}

.mobile-sections-bar {
    position: fixed !important;
    top: 120px !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1050 !important;
    background: white !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    border-bottom: 1px solid #eee !important;
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease !important;
}

.mobile-sections-bar.show {
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-sections-bar .sections-bar-content {
    padding: 8px 10px !important;
    padding-top: 0px !important;
    gap: 0 !important; /* Remove gap since arrows are removed */
}

.mobile-sections-bar .sections-bar-content .sections-items {
    width: 100% !important;
    margin: 0 !important;
}

.mobile-sections-bar .sections-items {
    gap: 6px !important;
    position: relative !important;
    /* Force scrollbar to always be visible - NEVER hide */
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    /* Show scrollbar for mobile carousels - always visible */
    -ms-overflow-style: scroll !important; /* IE and Edge - always show */
    scrollbar-width: thin !important; /* Firefox - thin scrollbar, always visible */
    scrollbar-color: #888 #f1f1f1 !important; /* Firefox - thumb and track colors */
    /* Add padding-bottom to ensure scrollbar space is always reserved */
    padding-bottom: 10px !important;
    /* Force scrollbar to always show */
    -webkit-overflow-scrolling: touch !important;
}

/* Show scrollbar for Chrome, Safari and Opera on mobile carousels - ALWAYS VISIBLE */
.mobile-sections-bar .sections-items::-webkit-scrollbar {
    display: block !important;
    height: 8px !important;
    -webkit-appearance: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-sections-bar .sections-items::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 10px !important;
    opacity: 1 !important;
    visibility: visible !important;
    /* Ensure track is always visible */
    -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.mobile-sections-bar .sections-items::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 10px !important;
    opacity: 1 !important;
    visibility: visible !important;
    /* Ensure thumb is always visible */
    min-width: 40px !important;
    /* Make thumb more prominent */
    border: 1px solid #666 !important;
}

.mobile-sections-bar .sections-items::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

/* Add a visual scrollbar track indicator that's ALWAYS visible as fallback */
.mobile-sections-bar .sections-items::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 8px !important;
    background: #f1f1f1 !important;
    border-radius: 10px !important;
    pointer-events: none !important;
    z-index: 1 !important;
    /* This creates a visual scrollbar track that's always visible */
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

/* Enhanced styles when scrollbar-always-visible class is added */
.mobile-sections-bar .sections-items.scrollbar-always-visible {
    overflow-x: scroll !important;
}

.mobile-sections-bar .sections-items.scrollbar-always-visible::-webkit-scrollbar {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-sections-bar .sections-items.scrollbar-always-visible::-webkit-scrollbar-track {
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-sections-bar .sections-items.scrollbar-always-visible::-webkit-scrollbar-thumb {
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-sections-bar .carousel-item-horizontal {
    min-width: 90px !important;
    height: 120px !important;
    border-radius: 6px !important;
    overflow: hidden !important;
}

.mobile-sections-bar .carousel-item-horizontal .vs_img {
    height: 85px !important;
}

.mobile-sections-bar .carousel-item-horizontal .vs_img img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.mobile-sections-bar .carousel-item-horizontal .carousel-item-title,
.mobile-sections-bar .carousel-item-horizontal .vs_cardcaption {
    font-size: 10px !important;
    padding: 3px !important;
    line-height: 1.1 !important;
    text-align: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: block !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    margin: 0 !important;
    font-weight: 500 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.mobile-sections-bar .sections-bar-header {
    padding: 8px 10px 5px 10px !important;
}

.mobile-sections-bar .sections-bar-header h3 {
    font-size: 16px !important;
    margin: 0 !important;
}

.mobile-sections-bar .carousel-nav-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
    border-radius: 50% !important;
    background: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mobile-sections-bar .carousel-nav-btn:hover {
    background: #e0e0e0 !important;
}

.mobile-sections-bar .close-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
}

/* Ensure vs_cardcaption is always visible in mobile sections bar */
.mobile-sections-bar .vs_cardone {
    display: flex !important;
    flex-direction: column !important;
    text-decoration: none !important;
    color: inherit !important;
    width: 100% !important;
    height: 100% !important;
}

.sections-items .carousel-item-horizontal .vs_cardone {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Active/highlighted item in carousels (Editions and All Pages) */
.sections-items .carousel-item-horizontal.active-carousel-card .vs_img,
.mobile-sections-bar .carousel-item-horizontal.active-carousel-card .vs_img {
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.5), 0 6px 18px rgba(0,0,0,0.2) !important;
    border-radius: 6px !important;
}

.sections-items .carousel-item-horizontal.active-carousel-card .vs_cardcaption,
.mobile-sections-bar .carousel-item-horizontal.active-carousel-card .vs_cardcaption {
    font-weight: 600 !important;
    color: #1976d2 !important;
}

.mobile-sections-bar .vs_img {
    display: block !important;
    width: 100% !important;
    height: 120px !important;
    overflow: hidden !important;
    position: relative !important;
}

.mobile-sections-bar .vs_img img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.mobile-sections-bar .vs_cardcaption {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 20px !important;
    margin-top: 0.25rem !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Hide calendar popup when mobile dropdowns are open */
.mobile-sections-bar.show ~ #calendarPopup,
body:has(.mobile-sections-bar.show) #calendarPopup {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 767px) {
    .mobile-sections-bar {
        top: 60px !important;
    }
    
    .mobile-sections-bar .carousel-item-horizontal {
        min-width: 80px !important;
        height: 105px !important;
    }
    
    .mobile-sections-bar .carousel-item-horizontal .vs_img {
        height: 75px !important;
    }
    
    .mobile-sections-bar .carousel-item-horizontal .vs_img img {
        height: 100% !important;
        width: 100% !important;
        object-fit: contain !important;
    }
    
    .mobile-sections-bar .sections-bar-content {
        padding: 6px 8px !important;
    }
    
    .mobile-sections-bar .sections-items {
        gap: 4px !important;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .mobile-sections-bar .carousel-item-horizontal {
        min-width: 70px !important;
        height: 230px !important;
        width: 150px !important;
    }
    
    .mobile-sections-bar .carousel-item-horizontal .vs_img {
        height: 200px !important;
    }
    
    .mobile-sections-bar .carousel-item-horizontal .vs_img img {
        height: 100% !important;
        width: 100% !important;
        object-fit: contain !important;
    }
    
    .mobile-sections-bar .carousel-item-horizontal .carousel-item-title,
    .mobile-sections-bar .carousel-item-horizontal .vs_cardcaption {
        font-size: 15px !important;
        padding: 2px !important;
        display: block !important;
        background: rgba(255, 255, 255, 0.9) !important;
        color: #333 !important;
    }
    
    .mobile-sections-bar .sections-bar-header h3 {
        font-size: 14px !important;
    }
    
    .mobile-sections-bar .sections-items {
        gap: 3px !important;
    }
    
    /* Ensure calendar popup doesn't interfere on mobile */
    #calendarPopup {
        z-index: 999 !important; /* Lower than mobile dropdowns */
        position: absolute !important;
        /* top: auto !important;
        left: auto !important; */
        transform: translateY(-100%) !important; /* Hide above viewport when not shown */
        transition: transform 0.3s ease !important;
    }
    
    #calendarPopup.show {
        transform: translateY(0) !important; /* Show in normal position */
        z-index: 9999 !important; /* Still lower than mobile dropdowns */
    }
    
    /* Force hide calendar when mobile dropdowns are visible */
    .mobile-sections-bar.show ~ #calendarPopup,
    #editionsBarMobile.show ~ #calendarPopup,
    #pagesBarMobile.show ~ #calendarPopup,
    body:has(.mobile-sections-bar.show) #calendarPopup {
        transform: translateY(-100%) !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
    
    /* Ensure mobile dropdown area is not blocked */
    .mobile-subheader {
        /* z-index: 1100 !important; Higher than everything */
        position: relative !important;
    }
    
    .mobile-subheader .action-btn-mobile {
        position: relative !important;
        /* z-index: 1101 !important; */
    }
}

/* Utility classes */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
	/* Ensure quiz overlay is on top and scrollable on mobile */
	.quiz-panel-overlay {
		z-index: 1200 !important;
		overflow-y: auto !important;
	}
}

/* Mobile typography and alignment tweaks */
@media (max-width: 768px) {
	html, body { font-size: 15px; line-height: 1.45; }

	/* Hide footer section on mobile */
	.footer-section {
		display: none !important;
	}

	/* Header/date alignment */
	/* Removed override that forced .date-section to static to avoid layout jump after closing quiz */
	/* .header .date-section { position: static !important; transform: none !important; left: auto !important; top: auto !important; } */
	.publisher-logo { max-width: 100% !important; max-height: 2rem !important; height: auto !important; }

	/* Action labels */
	.action-btn-with-text span, .action-btn-mobile span { font-size: 0.95rem; }

	/* Page overlay */
	.page-number-overlay { font-size: 0.85rem; padding: 0.25rem 0.5rem; }

	/* AI Assistant */
	.ai-assistant-btn {
        font-size: 1.1rem;
        left: 23%;
        bottom: 8%;
        padding: 2px;
        padding-right: 10px;
        padding-left: 12px;
    }
	.ai-quick-actions .btn { width: 100%; justify-content: center; }
	.ai-input-area #aiInput { font-size: 0.95rem; }
	.ai-messages .message-content { font-size: 0.95rem; }

	/* AI response items */
	.clickable-highlight { font-size: 0.95rem; }
	.result-page { font-size: 0.85rem; }

	/* Removed mobile bottom bar button styles since main-row was removed */
	
	/* Mobile zoom range slider styles */
	.mobile-zoom-range-container {
		background: var(--background);
		border: 1px solid var(--border);
		border-radius: 8px;
		padding: 8px 12px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
		min-width: 120px;
	}
	
	.mobile-zoom-slider {
		width: 100%;
		height: 4px;
		border-radius: 2px;
		background: var(--muted);
		outline: none;
		-webkit-appearance: none;
		appearance: none;
	}
	
	.mobile-zoom-slider::-webkit-slider-thumb {
		-webkit-appearance: none;
		appearance: none;
		width: 16px;
		height: 16px;
		border-radius: 50%;
		background: var(--primary);
		cursor: pointer;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	}
	
	.mobile-zoom-slider::-moz-range-thumb {
		width: 16px;
		height: 16px;
		border-radius: 50%;
		background: var(--primary);
		cursor: pointer;
		border: none;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	}
	
	.mobile-zoom-slider::-webkit-slider-track {
		background: var(--muted);
		border-radius: 2px;
	}
	
	.mobile-zoom-slider::-moz-range-track {
		background: var(--muted);
		border-radius: 2px;
		height: 4px;
	}
	
	/* Mobile Swiper and Pinch Zoom Styles */
	.swiper-container {
		width: 100%;
		height: 100%;
		position: relative;
	}
	
	.swiper-wrapper {
		position: relative;
		width: 100%;
		height: 100%;
		z-index: 1;
		display: flex;
		transition-property: transform;
		box-sizing: content-box;
	}
	
	.swiper-slide {
		flex-shrink: 0;
		width: 100%;
		height: 100%;
		position: relative;
		transition-property: transform;
	}
	
	.swiper-zoom-container {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		text-align: center;
		overflow: hidden;
	}
	
	.pinch-zoom {
		width: 100%;
		height: 100%;
		position: relative;
		overflow: hidden;
	}
	
	/* Show/hide desktop vs mobile views */
	.desktop-view {
		display: block;
	}
	
	.mobile-view {
		display: none;
	}
	
	@media (max-width: 768px) {
		.desktop-view {
			display: none;
		}
		
		.mobile-view {
			display: block;
		}
	}
}

/* Hide action-bar and mobile-subheader when login/buy container is visible */
#login-buy-container:not([style*="display: none"]) ~ * .action-bar,
#login-buy-container:not([style*="display: none"]) ~ .action-bar {
	display: none !important;
}

#login-buy-container:not([style*="display: none"]) ~ * .mobile-subheader,
#login-buy-container:not([style*="display: none"]) ~ .mobile-subheader {
	display: none !important;
}

/* Alternative approach using JavaScript-controlled class */
body.login-buy-visible .action-bar {
	display: none !important;
}

body.login-buy-visible .mobile-subheader {
	display: none !important;
}

/* Exception: Always show action-bar and mobile-subheader inside paid-template */
/* But respect responsive breakpoints - desktop shows action-bar, mobile shows mobile-subheader */
body.login-buy-visible #paid-template .action-bar,
#paid-template .action-bar {
	position: relative !important;
	z-index: 100 !important;
}

body.login-buy-visible #paid-template .mobile-subheader,
#paid-template .mobile-subheader {
	position: relative !important;
	z-index: 100 !important;
}

/* Ensure paid-template navigation appears right after header */
#paid-template {
	position: relative;
	margin-top: 0;
}

#paid-template .mobile-subheader {
	margin-top: 0;
	margin-bottom: 0;
}

#paid-template .action-bar {
	margin-top: 0;
	margin-bottom: 0;
}

/* Reduce spacing between header and pricing container on desktop */
@media (min-width: 768px) {
	#paid-template .bg-background-light,
	#paid-template .bg-background-dark {
		padding-top: 0.5rem !important;
	}
}

/* Default: Show action-bar on desktop, mobile-subheader on mobile */
/* Desktop: Show action-bar, hide mobile-subheader */
@media (min-width: 768px) {
	body.login-buy-visible #paid-template .action-bar,
	#paid-template .action-bar {
		display: block !important;
	}
	
	body.login-buy-visible #paid-template .mobile-subheader,
	#paid-template .mobile-subheader {
		display: none !important;
	}
}

/* Mobile: Show mobile-subheader, hide action-bar */
@media (max-width: 767px) {
	body.login-buy-visible #paid-template .mobile-subheader,
	#paid-template .mobile-subheader {
		display: block !important;
	}
	
	body.login-buy-visible #paid-template .action-bar,
	#paid-template .action-bar {
		display: none !important;
	}
}

/* Hide ads when login/buy container is visible */
body.login-buy-visible .ad-banner.top-banner {
	display: none !important;
}

body.login-buy-visible .ad-banner.bottom-banner {
	display: none !important;
}

body.login-buy-visible .sidebar-ads {
	display: none !important;
}

/* Archive Panel Styles - Fixed positioning above modal backdrop */
#archive-read-confirmation-panel,
#archive-paid-msg,
#archive-download-panel {
    margin-left: 0%;
    position: fixed !important;
    box-shadow: 0 0 10px 2px #666;
    top: 50%;
    left: 50%;
    width: 350px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    height: auto;
    background-color: white;
    z-index: 10000 !important; /* Higher than modal backdrop (9999) */
    padding: 15px;
    border-radius: 5px;
    transform: translate(-50%, -50%);
}

#archive-read-confirmation-panel .title,
#archive-paid-msg .title,
#archive-download-panel .title {
    text-align: center;
    font-size: 16px;
    font-weight: 400;
    padding: 5px;
    margin-bottom: 15px;
}

#archive-read-confirmation-panel .form-control {
    margin-bottom: 10px;
}

.archive_download-btn,
.confirm-btn {
    background: #4CAF50 !important;
    color: #fff !important;
    border: none !important;
    font-weight: 500;
    font-size: 16px !important;
    font-family: 'Barlow' !important;
    margin-top: 10px;
}

.archive_download-btn:hover,
.confirm-btn:hover {
    background: #45a049 !important;
    color: #fff !important;
}

.puchseCRd {
    width: 100%;
    float: left;
    padding: 0px !important;
    text-align: center;
}

.help-block {
    font-size: 16px;
    color: #000;
    font-weight: 300;
    background: #efefef;
    display: block;
    line-height: normal;
    font-weight: 400;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
}

.price-container {
    font-size: 16px;
    color: #000;
    font-weight: 300;
    background: #efefef;
    display: block;
    line-height: normal;
    font-weight: 400;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    text-align: center;
    margin-top: 15px;
}

/* Paid Content Templates Styles */
.rw-buy-box {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.rw-buy-box .loader {
    text-align: center;
    padding: 40px;
}

.rw-buy-box .buy-box-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.rw-buy-box .rw-thumb {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.rw-buy-box .rw-details {
    flex: 1;
    min-width: 300px;
}

.rw-buy-box .rw-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.rw-buy-box .info {
    color: #666;
    margin-bottom: 8px;
}

.rw-buy-box .pricing-options {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
}

.rw-buy-box .pricing-options table {
    width: 100%;
    border-collapse: collapse;
}

.rw-buy-box .pricing-options table tr {
    border-bottom: 1px solid #eee;
}

.rw-buy-box .pricing-options table tr:last-child {
    border-bottom: none;
}

.rw-buy-box .pricing-options table td {
    padding: 12px;
    vertical-align: middle;
}

.rw-buy-box .pricing-options table td:first-child {
    width: 40%;
}

.rw-buy-box .pricing-options table td.price {
    width: 30%;
    text-align: center;
}

.rw-buy-box .pricing-options table td:last-child {
    width: 30%;
    text-align: center;
}

.rw-buy-box .rw-de-btn-enabled {
    display: inline-block;
    padding: 10px 20px;
    background: #4CAF50;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.3s;
}

.rw-buy-box .rw-de-btn-enabled:hover {
    background: #45a049;
    color: #fff;
}

.rw-buy-box .preview-btn {
    margin-top: 10px;
    background: #2196F3;
}

.rw-buy-box .preview-btn:hover {
    background: #1976D2;
}

.rw-buy-box .login-required {
    display: block;
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    cursor: pointer;
}

.rw-buy-box .about-magazine {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.rw-buy-box .about-magazine .legend_prepage {
    font-weight: bold;
    padding: 0 10px;
}

.rw-buy-box .rw-description {
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}

#de-subscribe-login-box,
#de-login-before-read {
    position: relative;
    z-index: 1000;
}

#de-subscribe-login-box .login_whitelabel,
#de-login-before-read .login-required {
    cursor: pointer;
}

/* Override inline display:none for paid template when login-buy-container is shown */
#login-buy-container:not([style*="display: none"]) #paid-template {
    display: block !important;
}

/* Force show paid template when login-buy-container is visible */
body.login-buy-visible #paid-template {
    display: block !important;
}

/* Ensure login buttons are visible when not logged in */
#user-login-section .login-link,
#mobile-user-login-section .login-link,
#user-login.show-login,
#mobile-user-login.show-login,
body.login-buy-visible #user-login,
body.login-buy-visible #mobile-user-login {
    display: inline-block !important;
    visibility: visible !important;
}

/* Show login buttons when user profile is hidden */
#user-profile-dropdown[style*="display: none"] ~ #user-login,
#user-profile-dropdown:not([style*="display: block"]) ~ #user-login,
body:not(:has(#user-profile-dropdown[style*="display: block"])) #user-login {
    display: inline-block !important;
}

#mobile-user-profile[style*="display: none"] ~ #mobile-user-login,
#mobile-user-profile:not([style*="display: block"]) ~ #mobile-user-login,
body:not(:has(#mobile-user-profile[style*="display: block"])) #mobile-user-login {
    display: inline-block !important;
}

/* Hide login buttons when user profile is shown */
#user-profile-dropdown[style*="display: block"] ~ #user-login,
#user-profile-dropdown:not([style*="display: none"]) ~ #user-login,
body:has(#user-profile-dropdown[style*="display: block"]) #user-login,
body:has(#user-profile-dropdown:not([style*="display: none"])) #user-login,
#user-profile-dropdown:not([style*="display: none"]) #user-login {
    display: none !important;
    visibility: hidden !important;
}

#mobile-user-profile[style*="display: block"] ~ #mobile-user-login,
#mobile-user-profile:not([style*="display: none"]) ~ #mobile-user-login,
body:has(#mobile-user-profile[style*="display: block"]) #mobile-user-login,
body:has(#mobile-user-profile:not([style*="display: none"])) #mobile-user-login,
#mobile-user-profile:not([style*="display: none"]) #mobile-user-login {
    display: none !important;
    visibility: hidden !important;
}

/* Additional rule: if user-profile-dropdown is visible, hide login button */
#user-profile-dropdown:not([style*="display: none"]) + * #user-login,
#user-login-section:has(#user-profile-dropdown:not([style*="display: none"])) #user-login {
    display: none !important;
}

#mobile-user-profile:not([style*="display: none"]) + * #mobile-user-login,
#mobile-user-login-section:has(#mobile-user-profile:not([style*="display: none"])) #mobile-user-login {
    display: none !important;
}

/* ✅ Paid Volume Loader - Shows immediately while checking authentication */
.paid-volume-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.paid-volume-loader .loader-content {
    text-align: center;
}

.paid-volume-loader .loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #EF4444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.paid-volume-loader .loader-text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hide content when loader is showing */
body:has(#paid-volume-loader[style*="display: block"]) .content-wrapper,
body:has(#paid-volume-loader[style*="display: block"]) #login-buy-container {
    display: none !important;
}

/* Responsive adjustments for archive panels */
@media (max-width: 768px) {
    #archive-read-confirmation-panel,
    #archive-paid-msg,
    #archive-download-panel {
        width: 90%;
        max-width: 350px;
        padding: 15px;
    }
}