/* ==========================================
   JollyGrid Pages - 2026 Jolly Theme CSS
   Beautiful, colorful, and fun design
   Supports both Light and Dark themes
   ========================================== */

/* ==========================================
   SHARED ACCENT COLORS (Both Themes)
   ========================================== */
:root {
    /* Accent Colors - Jolly Palette */
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-yellow: #fbbf24;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-cool: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    
    --border-radius: 16px;
    --border-radius-sm: 10px;
}

/* ==========================================================================
   PAGE HERO BANNER - Gradient banner like Tools page
   ========================================================================== */

.page-hero {
    position: relative;
    padding: 2.5rem 2rem 3rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    background: var(--gradient-primary);
    border-radius: 24px;
    overflow: hidden;
}

/* Decorative dot pattern overlay */
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

/* Decorative floating circle */
.page-hero::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.page-hero__content {
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.page-hero__title {
    font-size: 2.25rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-hero__subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.6;
    font-weight: 450;
}

/* Hero Stats - Glass cards on gradient */
.page-hero__stats {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-top: 0.5rem;
    position: relative;
    z-index: 2;
}

.page-hero__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.875rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 90px;
}

.page-hero__stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
}

.page-hero__stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ==========================================
   LIGHT THEME (Default)
   ========================================== */
:root,
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-overlay: rgba(0, 0, 0, 0.03);
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);
    
    /* Effects - Lighter for light mode */
    --glow-purple: 0 0 20px rgba(139, 92, 246, 0.25);
    --glow-pink: 0 0 20px rgba(236, 72, 153, 0.25);
    --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.25);
    --glow-green: 0 0 20px rgba(16, 185, 129, 0.25);
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
    
    /* Background patterns - subtle for light mode */
    --bg-gradient-1: rgba(139, 92, 246, 0.05);
    --bg-gradient-2: rgba(236, 72, 153, 0.04);
    --bg-gradient-3: rgba(6, 182, 212, 0.03);
    --bg-base: #f8fafc;
    --bg-base-end: #f1f5f9;
    
    /* Orb opacity */
    --orb-opacity: 0.15;
}

/* ==========================================
   DARK THEME
   ========================================== */
[data-theme="dark"] {
    --bg-primary: #080c18;
    --bg-secondary: #0c1424;
    --bg-card: rgba(18, 22, 32, 0.75);
    --bg-elevated: rgba(24, 28, 40, 0.88);
    --bg-glass: rgba(12, 18, 36, 0.85);
    --bg-overlay: rgba(255, 255, 255, 0.03);
    
    --text-primary: #f8fafc;
    --text-secondary: rgba(248, 250, 252, 0.88);
    --text-muted: rgba(248, 250, 252, 0.65);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    
    /* Effects - Stronger for dark mode */
    --glow-purple: 0 0 30px rgba(139, 92, 246, 0.4);
    --glow-pink: 0 0 30px rgba(236, 72, 153, 0.4);
    --glow-cyan: 0 0 30px rgba(6, 182, 212, 0.4);
    --glow-green: 0 0 30px rgba(16, 185, 129, 0.4);
    
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    
    /* Background patterns - vibrant for dark mode */
    --bg-gradient-1: rgba(139, 92, 246, 0.1);
    --bg-gradient-2: rgba(236, 72, 153, 0.08);
    --bg-gradient-3: rgba(6, 182, 212, 0.05);
    --bg-base: #080c18;
    --bg-base-end: #0c1424;
    
    /* Orb opacity */
    --orb-opacity: 0.4;
}

/* ==========================================
   GLOBAL STYLES (Uses theme variables)
   ========================================== */
.pages-container {
    background-color: var(--bg-primary);
    background: 
        radial-gradient(circle at 20% 20%, var(--bg-gradient-1), transparent 50%),
        radial-gradient(circle at 80% 80%, var(--bg-gradient-2), transparent 50%),
        radial-gradient(circle at 50% 50%, var(--bg-gradient-3), transparent 60%),
        linear-gradient(to bottom, var(--bg-base), var(--bg-base-end));
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
}

/* Main Container */
.pages-container {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* Background Effects */
.pages-bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: var(--orb-opacity);
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-pink);
    top: 50%;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--accent-cyan);
    bottom: -100px;
    left: 30%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.9); }
    75% { transform: translate(20px, 30px) scale(1.05); }
}

/* Floating Shapes */
.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    font-size: 24px;
    opacity: 0.3;
    animation: floatShape 15s ease-in-out infinite;
}

.shape-1 { top: 10%; left: 10%; color: var(--accent-purple); animation-delay: 0s; }
.shape-2 { top: 20%; right: 15%; color: var(--accent-yellow); animation-delay: -3s; }
.shape-3 { bottom: 30%; left: 20%; color: var(--accent-pink); animation-delay: -6s; }
.shape-4 { bottom: 20%; right: 25%; color: var(--accent-green); animation-delay: -9s; }

@keyframes floatShape {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.6; }
}

/* Glass Card Effect */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

/* Sidebar Cards */
.sidebar-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.sidebar-card:hover {
    border-color: rgba(133, 65, 212, 0.3);
    box-shadow: var(--glow-purple);
}

.sidebar-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-nav li a:hover {
    background: rgba(133, 65, 212, 0.15);
    color: var(--text-primary);
    transform: translateX(5px);
}

.sidebar-nav li.active a {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--glow-purple);
}

/* Navigation Icons - Colorful */
.nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.icon-all { background: rgba(133, 65, 212, 0.2); color: var(--accent-purple); }
.icon-books { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.icon-coloring { background: rgba(236, 72, 153, 0.2); color: var(--accent-pink); }
.icon-worksheet { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }
.icon-puzzle { background: rgba(245, 158, 11, 0.2); color: var(--accent-orange); }
.icon-sticker { background: rgba(251, 191, 36, 0.2); color: var(--accent-yellow); }
.icon-mandala { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.icon-activity { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.icon-educational { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.icon-category { background: rgba(236, 72, 153, 0.15); color: var(--accent-pink); }
.icon-all-levels { background: rgba(133, 65, 212, 0.2); color: var(--accent-purple); }
.icon-easy { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.icon-medium { background: rgba(245, 158, 11, 0.2); color: var(--accent-orange); }
.icon-hard { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.icon-expert { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }

/* Page Header Section */
.page-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.page-header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0.1;
    z-index: 0;
}

.page-header-content {
    position: relative;
    z-index: 1;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(133, 65, 212, 0.2);
    border: 1px solid rgba(133, 65, 212, 0.4);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-purple);
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(133, 65, 212, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(133, 65, 212, 0); }
}

.gradient-text {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.page-header-content p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1.1rem;
}

.page-header-actions {
    position: relative;
    z-index: 1;
}

.btn-glow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-glow:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow-purple);
    color: #fff;
}

/* Sort Bar */
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
}

.results-count {
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-count i {
    color: var(--accent-pink);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-options label {
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-options .form-select {
    width: auto;
    min-width: 160px;
    background: rgba(26, 26, 39, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

.sort-options .form-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(133, 65, 212, 0.2);
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

/* Pages Grid */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.featured-grid {
    margin-bottom: 3rem;
}

/* ==========================================
   PAGE CARD - Simplified Book-Like Style
   ========================================== */
.page-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.page-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(139, 92, 246, 0.3);
}

.page-card.featured {
    border: 2px solid var(--accent-yellow);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

/* Page Cover - Book Style */
.page-card .page-cover {
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-card .page-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    transition: transform 0.5s ease;
    padding: 8px;
}

.page-card:hover .page-cover img {
    transform: scale(1.05);
}

.page-card .no-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.page-card .no-cover i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.page-card .no-cover span {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Page Type Badge */
.page-card .page-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.35rem 0.75rem;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Featured Star */
.page-card .featured-star {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: var(--accent-yellow);
    color: #1a1a2e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

/* Page Info */
.page-card .page-info {
    padding: 1.25rem;
}

.page-card .page-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5rem;
    line-height: 1.3;
}

.page-card .page-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.page-card .page-meta i {
    margin-right: 4px;
}

.page-card .page-meta .text-warning {
    color: var(--accent-yellow) !important;
}

/* Page Actions */
.page-card .page-actions {
    display: flex;
    gap: 0.5rem;
}

.page-card .btn-view {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--gradient-primary);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.page-card .btn-view:hover {
    background: linear-gradient(135deg, #9d6cfc, #f472b6);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--glow-purple);
}

/* ==========================================
   END PAGE CARD STYLES
   ========================================== */

/* Page Tile - Main Card */
.page-tile {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

.page-tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg), var(--glow-purple);
    border-color: rgba(139, 92, 246, 0.3);
}

.page-tile.featured {
    border: 2px solid transparent;
    background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
                var(--gradient-warm) border-box;
}

.page-tile.favorited {
    border-color: var(--accent-pink);
}

/* Page Cover */
.page-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-elevated) 100%);
}

.page-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.5s ease;
}

.page-tile:hover .page-cover img {
    transform: scale(1.1);
}

/* Page overlay - removed to eliminate hazy look */
.page-overlay {
    display: none;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}

/* Page Badges */
.page-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-type {
    background: var(--gradient-primary);
    color: #fff;
}

.badge-coloring { background: var(--gradient-primary); }
.badge-worksheet { background: var(--gradient-secondary); }
.badge-puzzle { background: var(--gradient-warm); }
.badge-mandala { background: var(--gradient-cool); }

.badge-featured {
    background: var(--accent-yellow);
    color: #1a1a2e;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.badge-printable {
    background: var(--accent-green);
    color: #fff;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page Actions - Hover Overlay */
.page-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
}

.page-tile:hover .page-actions {
    transform: translateY(0);
    opacity: 1;
}

.btn-tile-action {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-preview {
    background: rgba(6, 182, 212, 0.9);
    color: #fff;
}

.btn-preview:hover {
    background: var(--accent-cyan);
    transform: scale(1.15);
    box-shadow: var(--glow-cyan);
}

.btn-download {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
}

.btn-download:hover {
    background: var(--accent-green);
    transform: scale(1.15);
    box-shadow: var(--glow-green);
    color: #fff;
}

.btn-favorite {
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-pink);
}

.btn-favorite:hover,
.btn-favorite.favorited {
    background: var(--accent-pink);
    color: #fff;
    transform: scale(1.15);
    box-shadow: var(--glow-pink);
}

.btn-rate {
    background: rgba(251, 191, 36, 0.9);
    color: #fff;
}

.btn-rate:hover {
    background: var(--accent-yellow);
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

/* Page Info */
.page-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.page-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
    flex: 1;
}

.page-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.meta-downloads,
.meta-views,
.meta-rating {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
}

.meta-downloads i { color: var(--accent-green); }
.meta-views i { color: var(--accent-cyan); }
.meta-rating i { color: var(--accent-yellow); }

.meta-difficulty {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.difficulty-easy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.difficulty-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.difficulty-hard {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.difficulty-expert {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

/* View Page Button */
.btn-view-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: auto;
}

.btn-view-page:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-purple);
    color: #fff;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: rgba(133, 65, 212, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon i {
    font-size: 3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Pagination */
.pagination-nav {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    background: rgba(26, 26, 39, 0.8);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-item .page-link:hover {
    background: rgba(133, 65, 212, 0.2);
    color: var(--accent-purple);
    border-color: var(--accent-purple);
}

.page-item.active .page-link {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

/* Preview Modal */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-modal.active {
    display: flex;
    opacity: 1;
}

.preview-modal-content {
    max-width: 900px;
    width: 100%;
    text-align: center;
    position: relative;
}

.preview-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-close:hover {
    background: var(--accent-pink);
    transform: scale(1.1);
}

.preview-image-container {
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.preview-image-container img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Rating Modal */
.rating-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.rating-modal.active {
    display: flex;
}

.rating-modal-content {
    max-width: 400px;
    width: 100%;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.rating-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.rating-close:hover {
    background: var(--accent-pink);
    color: #fff;
}

.rating-modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.star-rating i {
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.star-rating i:hover,
.star-rating i.active {
    color: var(--accent-yellow);
    transform: scale(1.2);
}

.rating-label {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 992px) {
    .page-header-section {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .gradient-text {
        font-size: 1.75rem;
    }
    
    .sort-bar {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .pages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .page-info {
        padding: 1rem;
    }
    
    .page-info h3 {
        font-size: 0.9rem;
    }
    
    .btn-tile-action {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .gradient-orb {
        display: none;
    }
    
    /* Hero responsive */
    .page-hero {
        padding: 1.75rem 1.25rem 2rem;
        margin-bottom: 1.5rem;
        border-radius: 16px;
        gap: 1rem;
    }
    
    .page-hero__title {
        font-size: 1.5rem;
    }
    
    .page-hero__subtitle {
        font-size: 0.9rem;
    }
    
    .page-hero__stats {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .page-hero__stat {
        padding: 0.625rem 1rem;
        min-width: 75px;
    }
    
    .page-hero__stat-value {
        font-size: 1.25rem;
    }
    
    .page-hero__stat-label {
        font-size: 0.65rem;
    }
    
    /* Page Card Responsive */
    .page-card .page-cover {
        height: 200px;
    }
    
    .page-card .page-info {
        padding: 1rem;
    }
    
    .page-card .page-title {
        font-size: 0.9rem;
        min-height: 2.3rem;
    }
}

@media (max-width: 576px) {
    .pages-grid {
        grid-template-columns: 1fr;
    }
    
    .page-actions {
        transform: translateY(0);
        opacity: 1;
        position: relative;
        background: var(--bg-elevated);
        padding: 0.75rem;
    }
    
    .page-tile:hover {
        transform: none;
    }
}

/* ==========================================
   Toast Notifications
   ========================================== */
.jolly-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    background: rgba(26, 26, 39, 0.95);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    animation: toastSlideIn 0.3s ease, toastFadeOut 0.3s ease 2.7s forwards;
}

.toast-success { border-left: 4px solid var(--accent-green); }
.toast-error { border-left: 4px solid var(--accent-red); }
.toast-warning { border-left: 4px solid var(--accent-orange); }
.toast-info { border-left: 4px solid var(--accent-blue); }

.jolly-toast i {
    font-size: 1.1rem;
}

.toast-success i { color: var(--accent-green); }
.toast-error i { color: var(--accent-red); }
.toast-warning i { color: var(--accent-orange); }
.toast-info i { color: var(--accent-blue); }

@keyframes toastSlideIn {
    from { 
        transform: translateY(100px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

@keyframes toastFadeOut {
    to { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
}

/* ==========================================
   FILTER BAR STYLES
   ========================================== */

/* Content Title Header */
.content-title-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.filter-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:hover {
    border-color: var(--accent-purple);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.filter-group.filter-actions {
    display: flex;
    align-items: flex-end;
    min-width: 100px;
}

.btn-clear-filters {
    padding: 10px 16px;
    background: var(--accent-primary, var(--accent-purple));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
}

.btn-clear-filters:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: white;
}

/* Active Filters Display */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.active-filters-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-right: 8px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.filter-badge.filter-type {
    background: var(--accent-primary, var(--accent-purple));
}

.filter-badge.filter-category {
    background: var(--accent-purple);
}

.filter-badge.filter-difficulty {
    background: var(--accent-green);
}

.filter-badge.filter-audience {
    background: var(--accent-yellow);
    color: #1a1a27;
}

/* No Pages Message */
.no-pages-message {
    grid-column: span 3;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.no-pages-message i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    color: var(--text-tertiary);
}

.no-pages-message h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Print Button on Tile */
.btn-tile-print {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-tile-print:hover {
    box-shadow: var(--glow-green);
    transform: scale(1.1);
}

/* Clickable Tiles */
.book-tile[data-page-slug] {
    cursor: pointer;
}

/* Pages App - Show full page preview in tiles */
.book-tile[data-page-slug] .book-cover {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

[data-theme="dark"] .book-tile[data-page-slug] .book-cover {
    background: #fafafa;
}

.book-tile[data-page-slug] .book-cover img {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* Hide the page-flip 3D effects for pages - they're single pages */
.book-tile[data-page-slug] .book-cover::before,
.book-tile[data-page-slug] .book-cover::after {
    display: none;
}

/* Remove overlay gradient that obscures the page */
.book-tile[data-page-slug] .book-cover .book-overlay {
    display: none;
}

/* Responsive Filter Bar */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .filter-group.filter-actions {
        width: 100%;
    }
    
    .btn-clear-filters {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .active-filters-label {
        margin-bottom: 4px;
    }
}

/* ==========================================
   QUICK PREVIEW - Press and hold to peek
   ========================================== */

.quick-preview-image {
    cursor: grabbing;
    background: var(--bg-card, #fff);
}

/* ==========================================
   TAG FILTER BAR - Clickable Age/Theme Tags
   ========================================== */

.tag-filter-bar {
    margin-bottom: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tag-filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tag-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-filter-label i {
    color: var(--accent-purple);
}

.tag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-buttons.scrollable {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}

.tag-buttons.scrollable::-webkit-scrollbar {
    display: none;
}

/* Tag Button Styles */
.tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tag-btn.active {
    background: var(--tag-color, var(--accent-purple));
    border-color: var(--tag-color, var(--accent-purple));
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tag-btn i {
    font-size: 12px;
    opacity: 0.8;
}

.tag-btn.active i {
    opacity: 1;
}

/* Small Tags */
.tag-btn.tag-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.tag-btn.tag-sm i {
    font-size: 10px;
}

/* Holiday Tag Accent */
.tag-btn.tag-holiday {
    border-color: var(--tag-color, var(--accent-red));
}

.tag-btn.tag-holiday:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--tag-color, var(--accent-red));
}

/* Theme Tags Bar */
.tag-filter-bar.theme-tags {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

/* Tag Filter Badge in Active Filters */
.filter-badge.filter-tag {
    background: var(--accent-cyan);
}

/* Responsive Tag Filters */
@media (max-width: 768px) {
    .tag-filter-bar {
        padding: 12px 16px;
    }
    
    .tag-filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .tag-buttons {
        width: 100%;
    }
    
    .tag-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .tag-filter-bar.theme-tags {
        display: none; /* Hide theme tags on mobile to save space */
    }
    
    .tag-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}
