/*
Theme Name: Katty Deals PWA
Theme URI: https://example.com/us-deals
Author: Brahim
Description: A mobile-first, senior-friendly PWA theme for Katty Deals.
Version: 2.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: e-commerce, accessibility, mobile-first
*/

:root {
    /* Colors - Dollar General Inspired */
    --color-primary: #fff600;
    /* DG Yellow - for backgrounds only */
    --color-primary-fg: #000000;

    /* WCAG 2.1 AA Compliant Colors for text on white/light backgrounds */
    --color-primary-text: #946400;
    /* Golden brown - 4.72:1 contrast on white */
    --color-primary-text-hover: #7A5200;
    /* Darker for hover - 6.5:1 contrast */

    --color-secondary: #1a1a1a;
    /* Black */
    --color-secondary-fg: #FFFFFF;

    --color-bg: #FAFAFA;
    /* Off-white background */
    --color-surface: #FFFFFF;
    /* Card background */

    --color-text: #1a1a1a;
    --color-text-muted: #525252;
    /* Changed from #666666 for better contrast - 7.4:1 */

    --color-border: #d4d4d4;
    /* Slightly darker for better visibility - 1.7:1 */

    --color-accent: #C62828;
    /* Sale Red - darker for better contrast - 6.2:1 */
    --color-accent-fg: #FFFFFF;

    --color-success: #1B5E20;
    /* Darker green for better contrast - 7.3:1 */
    --color-warning: #E65100;
    /* Darker orange - 4.6:1 */

    /* Link colors for accessibility */
    --color-link: #1565C0;
    /* Blue - 5.9:1 contrast */
    --color-link-hover: #0D47A1;
    /* Darker blue - 8.5:1 */

    /* Typography */
    --font-heading: 'DM Sans', sans-serif;
    --font-body: 'Inter', sans-serif;

    --font-base-size: 16px;

    /* Layout */
    --radius: 16px;
    --header-height: 60px;
    --nav-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    /* Loading Animation */
    --loading-duration: 0.3s;
}

/* High Contrast Mode */
body.high-contrast {
    --color-bg: #FFFFFF;
    --color-surface: #FFFFFF;
    --color-text: #000000;
    --color-text-muted: #000000;
    --color-primary: #000000;
    --color-primary-fg: #FFFFFF;
    --color-secondary: #000000;
    --color-secondary-fg: #FFFFFF;
    --color-border: #000000;
}

/* Dark Mode */
body.dark-mode {
    --color-bg: #121212;
    --color-surface: #1E1E1E;
    --color-text: #E0E0E0;
    --color-text-muted: #A0A0A0;
    --color-border: #333333;

    /* Adjust Primary/Secondary for Dark Mode */
    --color-primary: #fff600;
    /* Brighter Yellow */
    --color-primary-fg: #000000;

    --color-secondary: #FFFFFF;
    /* White Buttons */
    --color-secondary-fg: #121212;

    --color-accent: #EF5350;
    /* Softer Red */

    --shadow-sm: 0 1px 2px 0 rgba(255, 255, 255, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.5);

    /* Dark Mode Overrides for Specific Elements */
    --color-warning-bg: #2C2C2C;
    --color-warning-text: #FFD54F;
}

/* Fix for buttons in Dark Mode */
body.dark-mode .btn-secondary {
    border: 1px solid var(--color-secondary);
    /* Ensure border visibility */
}

body.dark-mode .btn-primary {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

/* Fix for Penny List / Store Headers in Dark Mode 
   Use powerful selectors to override inline styles if necessary, 
   but ideally, we should use classes. 
   For now, we target known structures.
*/
body.dark-mode .store-header,
body.dark-mode .deal-card.welcome-card {
    background-color: var(--color-surface) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}

body.dark-mode .store-header h1,
body.dark-mode .deal-card h2 {
    color: #fff600 !important;
    /* Bright yellow on dark background - good contrast */
}

/* Fix Price Visibility */
body.dark-mode .sale-price {
    color: #FF5252;
    /* Brighter Red/Orange for Dark Mode */
}

/* Fix Availability Badge */
body.dark-mode p[style*="background: #f5f5f5"] {
    background-color: #333 !important;
    color: #EEE !important;
}

/* Dark Mode Placeholder Styles */
body.dark-mode .card-image-wrapper {
    background-color: #2A2A2A;
}

body.dark-mode .card-image-wrapper.is-placeholder {
    background: linear-gradient(180deg, #333 0%, #2A2A2A 100%);
}

body.dark-mode .card-image-wrapper.is-placeholder.amazon {
    background: linear-gradient(180deg, #3D2A1A 0%, #2A2A2A 100%);
}

body.dark-mode .card-image-wrapper.is-placeholder.walmart {
    background: linear-gradient(180deg, #1A2A3D 0%, #2A2A2A 100%);
}

body.dark-mode .card-image-wrapper.is-placeholder.penny-list {
    background: linear-gradient(180deg, #3D3A1A 0%, #2A2A2A 100%);
}

body.dark-mode .placeholder-content .ph-title {
    color: var(--color-text);
}

body.dark-mode .placeholder-content .ph-subtitle {
    color: var(--color-text-muted);
}

/* Dark Mode Card Body */
body.dark-mode .card-body {
    background: var(--color-surface);
}

body.dark-mode .deal-card {
    border-color: var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .deal-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Global Reset & Base */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: var(--font-base-size);
    line-height: 1.5;
    padding-bottom: calc(var(--nav-height) + 20px);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.5em;
    letter-spacing: -0.02em;
}

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

/* Header */
.app-header {
    background: var(--color-surface);
    color: var(--color-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 60px;
    gap: 8px;
}

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

.header-left {
    min-width: 90px;
    justify-content: flex-start;
}

.header-right {
    min-width: 90px;
    justify-content: flex-end;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    min-width: 0;
}

.header-icon-btn {
    background: none;
    border: none;
    color: #1a1a1a !important;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, background 0.2s;
    border-radius: 8px;
    min-width: 40px;
    min-height: 40px;
    text-decoration: none;
}

.header-icon-btn:hover {
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.05);
}

.header-icon-btn:active {
    transform: scale(0.95);
}

.header-icon-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke: #1a1a1a !important;
}

body.dark-mode .header-icon-btn {
    color: #ffffff !important;
}

body.dark-mode .header-icon-btn svg {
    stroke: #ffffff !important;
}

/* Dark mode for header buttons */
body.dark-mode .header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile responsive header */
@media (max-width: 360px) {
    .header-title {
        font-size: 16px;
    }

    .header-subtitle {
        display: none;
    }

    .header-icon-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Main Content */
main {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Masonry Layout (Waterfall) */
.deals-grid {
    display: block;
    /* Remove grid */
    column-count: 2;
    /* Mobile default */
    column-gap: 12px;
    width: 100%;
}

@media (min-width: 768px) {
    .deals-grid {
        column-count: 3;
    }
}

@media (min-width: 1024px) {
    .deals-grid {
        column-count: 4;
    }
}

.deal-card {
    background-color: var(--color-surface);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: inline-block;
    /* Essential for masonry */
    width: 100%;
    /* Ensure full column width */
    margin-bottom: 12px;
    /* Vertical spacing */
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    position: relative;
    break-inside: avoid;
    /* Prevent split across columns */
}

.deal-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.deal-card:active {
    transform: scale(0.98);
}

/* Temu-Style Card Image Container - Natural Height */
body .deal-card .card-image-wrapper {
    position: relative;
    width: 100%;
    height: auto !important;
    /* Allow natural height */
    aspect-ratio: auto !important;
    /* Remove fixed ratio */
    background-color: #FFFFFF;
    overflow: hidden;
    padding: 0 !important;
    /* No padding for waterfall look */
    display: block;
    /* Block to allow image to dictate height */
    border-radius: 12px 12px 0 0;
}

/* Product Image - Natural Height */
body .deal-card .product-image {
    width: 100%;
    height: auto !important;
    /* Natural height */
    object-fit: cover !important;
    /* Cover to fill width */
    display: block;
    /* Remove inline-block gaps */
    transition: transform 0.2s ease;
    mix-blend-mode: normal !important;
}

/* Reset blend mode */

/* Alternative mode: contain for products where full visibility is important */
.product-image.contain-mode {
    object-fit: contain;
    padding: 8px;
    background: #fff;
}

/* Subtle zoom on hover */
.deal-card:hover .product-image {
    transform: scale(1.05);
}

/* ===== No Image Placeholder (Temu-style) ===== */
.card-image-wrapper.is-placeholder {
    background: linear-gradient(180deg, #fff7d6 0%, #ffffff 100%);
}

.placeholder-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 14px;
}

.placeholder-content .ph-icon {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 10px;
    opacity: 0.9;
}

.placeholder-content .ph-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.placeholder-content .ph-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
    opacity: 0.8;
}

/* Amazon Placeholder */
.card-image-wrapper.is-placeholder.amazon {
    background: linear-gradient(180deg, #FFF3E0 0%, #FFFFFF 100%);
}

/* Walmart Placeholder */
.card-image-wrapper.is-placeholder.walmart {
    background: linear-gradient(180deg, #E3F2FD 0%, #FFFFFF 100%);
}

/* Penny Placeholder */
.card-image-wrapper.is-placeholder.penny-list {
    background: linear-gradient(180deg, #fff600 0%, #FFFFFF 100%);
}

/* Badges */
.store-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
    display: none !important;
    /* Hidden as per user request */
}

/* Store Specific Colors - Adjusted for Dark Mode compatibility via opacity */
.store-badge.amazon {
    background: rgba(255, 224, 178, 0.9);
    color: #E65100;
}

.store-badge.walmart {
    background: rgba(187, 222, 251, 0.9);
    color: #0D47A1;
}

.store-badge.penny-list {
    background: rgba(255, 246, 0, 0.9);
    color: #F57F17;
}

.store-badge.default {
    background: rgba(245, 245, 245, 0.9);
    color: #333;
}

/* Dark Mode Badge Overrides */
body.dark-mode .store-badge.amazon {
    background: #E65100;
    color: #FFE0B2;
}

body.dark-mode .store-badge.walmart {
    background: #1565C0;
    color: #BBDEFB;
}

body.dark-mode .store-badge.penny-list {
    background: #F57F17;
    color: #fff600;
}

body.dark-mode .store-badge.default {
    background: #424242;
    color: #EEE;
}

.discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--color-accent);
    color: var(--color-accent-fg);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 99px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    background: #fff;
}

.product-title {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 35px;
    color: var(--color-text);
}


.price-block {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: auto;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* Temu-style prominent price */
.sale-price {
    font-size: 20px;
    font-weight: 700;
    color: #FF4D4F;
    /* Temu red-orange */
    font-family: var(--font-heading);
    line-height: 1;
}

.sale-price::before {
    content: '';
    font-size: 14px;
}

.original-price {
    font-size: 12px;
    text-decoration: line-through;
    color: #999;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.card-actions.card-actions-single {
    grid-template-columns: 1fr;
}

.btn {
    height: 36px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: var(--font-body);
    text-decoration: none;
    transition: background 0.2s;
}

.btn-primary {
    background-color: transparent;
    border: 1px solid var(--color-border);
    /* Changed from rgba to var */
    color: var(--color-text);
}

.btn-primary:hover {
    background-color: var(--color-bg);
    /* Changed from rgba */
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-secondary-fg);
    border: 1px solid transparent;
    /* Add border base */
}

.btn-secondary:hover {
    opacity: 0.9;
    border-color: var(--color-text);
    /* Highlight on hover */
}

.btn-secondary.active {
    background-color: var(--color-primary);
    color: var(--color-primary-fg);
    border-color: var(--color-primary);
}

/* Remove Button Style */
.btn-remove-deal {
    color: #D32F2F !important;
    border: 1px solid #D32F2F !important;
    background-color: transparent !important;
}

.btn-remove-deal:hover {
    background-color: #ffebee !important;
    color: #b71c1c !important;
}

body.dark-mode .btn-remove-deal {
    color: #EF5350 !important;
    border-color: #EF5350 !important;
}

body.dark-mode .btn-remove-deal:hover {
    background-color: rgba(239, 83, 80, 0.1) !important;
}

/* Bottom Nav */
.bottom-nav {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #6B7280;
    /* WCAG AA compliant gray - 5.0:1 contrast on white */
    font-size: 10px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

.nav-item.active {
    color: #92600C;
    /* WCAG AA compliant - 5.2:1 contrast on white */
}

/* Remove default focus outline and add icon glow effect */
.nav-item:focus {
    outline: none;
}

.nav-item:focus .nav-icon svg,
.nav-item:active .nav-icon svg {
    filter: drop-shadow(0 0 6px rgba(146, 96, 12, 0.8));
}

.nav-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2px;
    margin-bottom: 2px;
    transition: filter 0.2s ease;
}

.nav-item.active .nav-icon svg {
    stroke-width: 2.5px;
}

.nav-badge {
    position: absolute;
    top: 6px;
    right: 25%;
    background-color: var(--color-accent);
    color: white;
    font-size: 9px;
    font-weight: 700;
    height: 16px;
    min-width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    padding: 0 4px;
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px 16px 16px;
    margin: 0 -16px 16px -16px;
    /* Bleed */
    scrollbar-width: none;
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 99px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--color-text);
}

.filter-chip.active {
    background-color: var(--color-secondary);
    color: var(--color-secondary-fg);
    border-color: var(--color-secondary);
}

/* Featured Carousel */
.featured-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 16px 20px 16px;
    margin: 0 -16px 12px -16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.featured-carousel::-webkit-scrollbar {
    display: none;
}

.featured-card {
    min-width: 280px;
    scroll-snap-align: center;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 0;
    overflow: hidden;
}

/* Utilities */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 16px;
}

/* Detail Page specific */
.detail-content {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

/* --- Penny Feed Styles --- */
.penny-feed-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.penny-feed-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Feed Header */
.feed-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.feed-author-avatar img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 1px solid var(--color-border);
}

.feed-meta {
    display: flex;
    flex-direction: column;
}

.feed-author-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text);
}

.feed-date {
    font-size: 13px;
    /* Increased from 12px */
    color: var(--color-text-muted);
}

/* Feed Body */
.feed-body {
    position: relative;
}

/* Facebook-style Grid */
.feed-gallery {
    display: grid;
    gap: 2px;
    background: #fff;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.gallery-item:active img {
    transform: scale(0.98);
}

/* Grid Layouts */
/* 1 Image */
.gallery-1 {
    grid-template-columns: 1fr;
}

/* 2 Images */
.gallery-2 {
    grid-template-columns: 1fr 1fr;
}

/* 3 Images */
.gallery-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.gallery-3 .gallery-item:first-child {
    grid-row: span 2;
}

/* 4+ Images */
.gallery-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Overlay for +N images */
.overlay-remaining::after {
    content: attr(data-remaining);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fallback single image */
.feed-image {
    width: 100%;
    background: #f5f5f5;
    overflow: hidden;
}

.feed-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
}

.feed-content {
    padding: 12px 16px;
    font-size: 15px;
    color: var(--color-text);
    line-height: 1.5;
}

.feed-content.full-content {
    font-size: 16px;
    padding: 16px;
}

.read-more {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* Feed Footer */
.feed-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-like {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    transition: all 0.2s;
}

.btn-like:hover {
    background: rgba(0, 0, 0, 0.05);
    /* Subtle hover for light mode */
}

body.dark-mode .btn-like:hover {
    background: rgba(255, 255, 255, 0.1);
    /* Subtle hover for dark mode */
}

.btn-like.liked {
    border-color: #E91E63;
    color: #E91E63;
    background: rgba(233, 30, 99, 0.05);
}

.btn-like .heart-icon {
    font-size: 18px;
    filter: grayscale(100%);
    transition: filter 0.2s;
}

.btn-like.liked .heart-icon {
    filter: grayscale(0%);
}

/* Shake animation for already liked */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    50% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-4px);
    }

    100% {
        transform: translateX(0);
    }
}

.shake {
    animation: shake 0.3s;
}

.btn-view {
    background: var(--color-primary);
    color: var(--color-primary-fg);
    font-weight: 700;
    font-size: 14px;
    padding: 8px 20px;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

/* Share Button in Single View */
.btn-share {
    background: var(--color-secondary);
    color: var(--color-secondary-fg);
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Back Button in Single View */
.btn-back-feed {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    /* Changed from #fff */
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 10px 20px;
    border-radius: 24px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    transition: background 0.2s, color 0.2s;
}

.btn-back-feed:hover {
    background: var(--color-bg);
}

/* Spinner */
#feed-load-trigger {
    font-weight: 600;
    font-size: 14px;
}

/* --- Lightbox Styles --- */
#dg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#dg-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

#dg-lightbox img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transition: transform 0.2s;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
}

.lightbox-prev,
.lightbox-next {
    color: white;
    font-size: 40px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* --- Single Gallery Styles --- */
.single-gallery-container {
    width: 100%;
    background: #000;
}

.gallery-main-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    /* or auto height? */
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-main-stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    user-select: none;
    z-index: 10;
    transition: background 0.2s;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.6);
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.gallery-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    pointer-events: none;
}

.gallery-thumbs-track {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #1a1a1a;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
}

.gallery-thumbs-track::-webkit-scrollbar {
    display: none;
}

.gallery-thumb-item {
    min-width: 60px;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.gallery-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb-item.active {
    opacity: 1;
    border-color: var(--color-primary);
}

/* --- Single Deal Styles --- */
.single-deal-wrapper .store-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    font-size: 12px;
    padding: 6px 10px;
}

.deal-description {
    font-size: 15px;
}

.deal-description p {
    margin-bottom: 16px;
}

.deal-description ul,
.deal-description ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.deal-description img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

/* ============================================
   PAGE LOADING ANIMATIONS
   ============================================ */

/* Page Loader Overlay */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--loading-duration) ease-in-out;
}

#page-loader.active {
    opacity: 1;
    pointer-events: auto;
}

/* Loading Spinner */
.page-loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading Text */
.page-loader-text {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 600;
    margin-top: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Page Fade In Animation */
body {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Content Fade In */
#main-content {
    animation: contentFadeIn 0.5s ease-in-out;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State for Links */
a.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

a.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--color-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Smooth Page Transitions */
html {
    scroll-behavior: smooth;
}

/* Prevent Flash of Unstyled Content */
body.loading {
    overflow: hidden;
}

/* --- Dynamic Card Colors (Light/Dark Mode Compatible) --- */

/* Notices (No Items) */
.card-notice {
    background-color: #F5F5F5;
    border-left: 4px solid #9E9E9E;
    color: #616161;
    padding: 20px;
    margin-top: 32px;
}

.card-notice h3 {
    color: #616161;
    margin-top: 0;
}

.card-notice p {
    margin: 0;
}

/* Markdowns */
.card-info {
    background-color: #E3F2FD;
    /* Light Blue */
    border-left: 4px solid #2196F3;
    padding: 20px;
    margin-top: 32px;
}

.card-info h3 {
    color: #1565C0;
    margin-top: 0;
}

.card-info ul {
    padding-left: 20px;
    line-height: 1.6;
}

/* Clearance */
.card-alert {
    background-color: #FFEBEE;
    /* Light Red */
    border-left: 4px solid #F44336;
    padding: 20px;
    margin-top: 32px;
}

.card-alert h3 {
    color: #C62828;
    margin-top: 0;
}

.card-alert ul {
    padding-left: 20px;
    line-height: 1.6;
}

/* Schedule Card */
.card-schedule {
    background-color: #FFF3E0;
    /* Light Orange */
    border: 1px solid #FFB74D;
    padding: 16px;
    margin-bottom: 24px;
}

.schedule-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #E65100;
    font-weight: bold;
    font-size: 16px;
}

.schedule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.schedule-row .label {
    color: #5D4037;
}

.schedule-row .value {
    font-weight: bold;
    color: #3E2723;
}

.schedule-divider {
    border-top: 1px solid #FFE0B2;
    margin: 8px 0;
}

.schedule-row .value.highlight {
    color: #E65100;
}

/* --- Dark Mode Overrides for New Cards --- */
body.dark-mode .card-notice {
    background-color: #2C2C2C;
    border-left-color: #757575;
    color: #B0BEC5;
}

body.dark-mode .card-notice h3 {
    color: #E0E0E0;
}

body.dark-mode .card-info {
    background-color: #0D47A1;
    /* Dark Blue */
    border-left-color: #42A5F5;
    color: #E3F2FD;
}

body.dark-mode .card-info h3 {
    color: #90CAF9;
}

body.dark-mode .card-alert {
    background-color: #3E2723;
    /* Dark Red/Brown */
    border-left-color: #EF5350;
    color: #FFEBEE;
}

body.dark-mode .card-alert h3 {
    color: #FFCDD2;
}

body.dark-mode .card-schedule {
    background-color: #3E2723;
    /* Dark Orange/Brown */
    border-color: #5D4037;
}

body.dark-mode .schedule-header {
    color: #FFB74D;
}

body.dark-mode .schedule-row .label {
    color: #D7CCC8;
}

body.dark-mode .schedule-row .value {
    color: #FFF;
}

body.dark-mode .schedule-divider {
    border-top-color: #5D4037;
}

body.dark-mode .schedule-row .value.highlight {
    color: #FFB74D;
}

/* --- UPC Card Styles (Fixed Light Appearance) --- */
.upc-card {
    background: #ffffff !important;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
    color: #000000 !important;
    /* Force black text regardless of mode */
}

.upc-label {
    font-size: 14px;
    color: #525252 !important;
    /* WCAG AA compliant - 7.4:1 */
    margin-bottom: 8px;
}

.upc-text {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 12px;
    color: #000000 !important;
}

/* UPC Inline (Card List) */
.upc-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px;
}

.upc-inline .upc-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b6b6b !important;
    margin: 0;
}

.upc-copy {
    background: #f8f8f8;
    border: 1px dashed #d6d6d6;
    border-radius: 10px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #111;
}

.upc-copy code {
    font-family: var(--font-body);
    font-weight: 600;
    color: #111;
}

.upc-copy .copy-cta {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-link);
}

.upc-copy.copied {
    border-color: #2e7d32;
    background: #e8f5e9;
}

.upc-copy.copied .copy-cta {
    color: #2e7d32;
}

body.dark-mode .upc-copy {
    background: #1f1f1f;
    border-color: #333333;
}

body.dark-mode .upc-copy code {
    color: #ffffff;
}

/* Button Dark (Always Dark background, Light text) */
.btn-dark {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    border: none;
    height: 36px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.2s;
}

.btn-dark:hover {
    background-color: #333333 !important;
}

/* --- PWA Install Popup --- */
.pwa-install-popup {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    left: 20px;
    right: 20px;
    z-index: 9999;
    /* Higher than nav */
    display: flex;
    justify-content: center;
    animation: slideUp 0.3s ease-out;
}

.pwa-popup-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pwa-content {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.pwa-icon img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.pwa-text h3 {
    font-size: 16px;
    margin: 0 0 4px 0;
    color: var(--color-text);
}

.pwa-text p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
}

.pwa-actions {
    display: flex;
    gap: 12px;
}

.pwa-actions .btn {
    flex: 1;
    height: 40px;
    font-size: 13px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dark mode adjustments */
body.dark-mode .pwa-popup-container {
    background: rgba(30, 30, 30, 0.95);
    border-color: #444;
}

/* --- Social Share Buttons --- */
.share-buttons-container {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 16px;
    justify-content: center;
    /* Center them */
}

.btn-share-social {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s, opacity 0.2s;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.btn-share-social svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.btn-share-social:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn-share-social.whatsapp {
    background-color: #25D366;
}

.btn-share-social.facebook {
    background-color: #1877F2;
}

.btn-share-social.twitter {
    background-color: #000000;
}

body.dark-mode .btn-share-social.twitter {
    background-color: #FFFFFF;
    color: #000000;
}

.share-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: 8px;
}

/* --- Accessibility: Screen Reader Only Text --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- Accessibility: Skip Link --- */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 1em;
    background: var(--color-primary);
    color: var(--color-primary-fg);
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
}

.skip-link:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}

/* --- Accessibility: Focus Styles --- */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --- Responsive Adjustments --- */
@media (min-width: 768px) {
    main {
        max-width: 900px;
    }

    .deals-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .pwa-install-popup {
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
}

@media (min-width: 1200px) {
    main {
        max-width: 1200px;
    }

    .deals-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* -------------------------------------------------------------------------
   BLOG SECTION STYLES
   ------------------------------------------------------------------------- */

/* Blog Page Structure Overrides */
body.page-template-page-blog main,
body.search main,
body.single main {
    max-width: 100%;
    padding: 0;
}

.blog-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 80px 16px;
}

.blog-header {
    text-align: center;
    margin-bottom: 30px;
}

.blog-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--color-text);
}

.blog-header p {
    color: var(--color-text-muted);
    font-size: 16px;
    margin: 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.blog-card {
    background: var(--color-surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.blog-card>a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-img-wrapper {
    height: 180px;
    overflow: hidden;
    position: relative;
    background: var(--color-bg);
}

.blog-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.blog-card:hover .blog-img-wrapper img {
    transform: scale(1.05);
}

/* Fallback pattern for posts without images */
.blog-no-img {
    height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.blog-no-img svg {
    width: 64px;
    height: 64px;
    opacity: 0.15;
    transition: opacity 0.3s, transform 0.3s;
}

.blog-card:hover .blog-no-img svg {
    opacity: 0.3;
    transform: scale(1.1) rotate(-5deg);
}

body.dark-mode .blog-no-img {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
}

.blog-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-date {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
}

.blog-title {
    font-size: 18px;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: var(--color-text);
    font-weight: 700;
    /* Limit lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-excerpt {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    /* Limit lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-read-more {
    margin-top: auto;
    color: var(--color-link);
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.blog-pagination {
    margin-top: 40px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.blog-pagination .page-numbers {
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.blog-pagination .page-numbers.current,
.blog-pagination .page-numbers:hover {
    background: var(--color-primary);
    color: var(--color-primary-fg);
    border-color: var(--color-primary);
}


/* -------------------------------------------------------------------------
   SINGLE POST STYLES
   ------------------------------------------------------------------------- */

.single-post-wrapper {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 80px 16px;
}

.post-back-btn {
    display: inline-flex;
    align-items: center;
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 20px;
}

.post-back-btn:hover {
    color: var(--color-primary-text);
}

.post-header {
    margin-bottom: 24px;
}

.post-category {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary-text);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.post-title {
    font-size: 28px;
    line-height: 1.3;
    font-weight: 800;
    margin: 0 0 12px 0;
    color: var(--color-text);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.post-meta span {
    display: flex;
    align-items: center;
}

.post-featured-image {
    margin-bottom: 24px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.post-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-content {
    font-size: 17px;
    line-height: 1.7;
    color: var(--color-text);
}

.post-content p {
    margin-bottom: 24px;
}

.post-content h2 {
    font-size: 22px;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--color-text);
    font-weight: 700;
}

.post-content h3 {
    font-size: 19px;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--color-text);
    font-weight: 600;
}

.post-content ul,
.post-content ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 8px;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: var(--shadow-sm);
}

/* Penny Guide Special Card Style in Posts */
.guide-card,
.tip-item {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

/* Share Section */
.post-footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.share-buttons-container {
    display: flex;
    gap: 12px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    color: white;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-wa {
    background: #25D366;
}

.share-fb {
    background: #1877F2;
}

.share-x {
    background: #000000;
}

body.dark-mode .share-x {
    background: #333;
    border: 1px solid #555;
}

/* -------------------------------------------------------------------------
   BLOG SEARCH & FILTER CONTROLS
   ------------------------------------------------------------------------- */

.blog-controls {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Search Form */
.blog-search-form {
    display: flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 6px;
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.blog-search-field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 16px;
    color: var(--color-text);
    outline: none;
    min-width: 0;
}

.blog-search-submit {
    background: var(--color-primary);
    color: var(--color-primary-fg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.blog-search-submit:hover {
    filter: brightness(0.9);
}

/* Category Filter (Chips) */
.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.cat-box {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.cat-box:hover {
    border-color: var(--color-primary-text);
    transform: translateY(-1px);
}

.cat-box.active {
    background: var(--color-primary);
    color: var(--color-primary-fg);
    border-color: var(--color-primary);
    font-weight: 600;
}

/* Dark Mode Adjustments */
body.dark-mode .blog-search-form {
    background: #2C2C2C;
}

body.dark-mode .blog-search-field {
    color: #FFF;
}

/* -------------------------------------------------------------------------
   IMAGE LIGHTBOX
   ------------------------------------------------------------------------- */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.lightbox-modal.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox-modal.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Cursor for zoomable images */
.post-content img {
    cursor: zoom-in;
}
