:root {
    --font-main: 'Outfit', sans-serif;
    --color-bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --color-accent: #773333;
    --color-accent-hover: #5c2828;
    --color-accent-rgb: 119, 51, 51;
    --color-text-main: #1e293b;
    --color-text-heading: #0f172a;
    --color-text-muted: #64748b;
    --color-glass-bg: rgba(255, 255, 255, 0.85);
    --color-glass-border: rgba(255, 255, 255, 0.45);
    
    --radius-container: 20px;
    --radius-element: 12px;
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-active: 0 5px 15px rgba(0, 0, 0, 0.03);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Disable default tap highlight on iOS */
}

body {
    font-family: var(--font-main);
    color: var(--color-text-main);
    background: var(--color-bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    /* Prevent iOS rubber banding scroll on outer container to make custom PTR feel native */
    overscroll-behavior-y: contain; 
}

/* Pull to Refresh Indicator Styles */
.ptr-container {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-100%);
    z-index: 10;
}

.ptr-icon {
    font-size: 20px;
    transition: transform 0.2s ease;
}

.ptr-container.pull-ready .ptr-icon {
    transform: rotate(180deg);
}

.ptr-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(var(--color-accent-rgb), 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.ptr-container.refreshing .ptr-spinner {
    display: block;
}

.ptr-container.refreshing .ptr-icon {
    display: none;
}

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

/* App Layout & Core Containers */
.app-header {
    width: 100%;
    max-width: 600px;
    padding: 24px 20px 12px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    flex-direction: column;
}

.app-title {
    font-size: 21px; /* Custom request */
    font-weight: 700;
    margin: 0;
    color: var(--color-text-heading);
    letter-spacing: -0.3px;
}

.app-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 4px 0 0;
    font-weight: 500;
}

.byline-link {
    color: var(--color-accent) !important;
    text-decoration: underline;
    font-weight: 600;
}

.byline-link:hover {
    color: var(--color-accent-hover) !important;
}

/* SVG Icon Base Styling */
.svg-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    display: inline-block;
    transition: inherit;
}

/* Hamburger / Filter Toggle Button */
.filter-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-glass-border);
    background: var(--color-glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    transition: transform 0.2s, background-color 0.2s;
}

.filter-btn .svg-icon {
    width: 24px;
    height: 24px;
    color: var(--color-text-main);
    transition: color 0.2s ease;
}

.filter-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.95);
}

/* Filter Overlay Modal Styles */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Mobile drawer style: slide up from bottom */
    animation: fadeInOverlay 0.3s ease-out;
}

.filter-overlay[hidden] {
    display: none !important;
}

.filter-modal {
    width: 100%;
    max-width: 600px;
    background: var(--color-glass-bg);
    border: 1px solid var(--color-glass-border);
    border-top-left-radius: var(--radius-container);
    border-top-right-radius: var(--radius-container);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
    padding: 24px 20px max(24px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    transform: translateY(0);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(var(--color-accent-rgb), 0.1);
    padding-bottom: 12px;
}

.filter-header h2 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    color: var(--color-text-heading);
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.close-btn .svg-icon {
    width: 24px;
    height: 24px;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
}

.close-btn:hover .svg-icon {
    color: var(--color-accent);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-footer {
    margin: 20px 0 0;
    font-size: 14px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.5;
}

.filter-footer a {
    color: var(--color-accent);
    text-decoration: underline;
    font-weight: 600;
}

.filter-footer a:hover {
    color: var(--color-accent-hover);
}

/* Premium Filter Badge Styles (matches live site source badges) */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: var(--radius-element);
    cursor: pointer;
    font-size: 15px;
    min-height: 48px; /* Large mobile-friendly tap target */
    transition: opacity 0.2s ease, transform 0.1s ease;
    opacity: 0.4;
    user-select: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
}

.filter-badge:active {
    transform: scale(0.98);
}

.filter-badge.active {
    opacity: 1;
}

.filter-badge .badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-badge .svg-icon {
    width: 22px;
    height: 22px;
}

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.feed-container {
    width: 100%;
    max-width: 600px;
    padding: 0 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    /* Handle gesture translations smoothly */
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 24px;
    animation: fadeIn 0.4s ease-out;
}

/* Glassmorphic News Card Styles */
.news-card {
    background: var(--color-glass-bg);
    border: 1px solid var(--color-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-container);
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

/* Native Tap Target Sizing & Feedback */
.news-card:active {
    transform: scale(0.98) translateY(1px);
    box-shadow: var(--shadow-active);
    background: rgba(255, 255, 255, 0.95);
}

.news-card-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(0, 0, 0, 0.03);
}

.news-card-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.news-source {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--color-accent);
    background: rgba(119, 51, 51, 0.08);
    border: 1px solid rgba(119, 51, 51, 0.15);
    text-transform: capitalize;
}

/* Source specific coloring */
.source-gemeenteschiedam {
    color: #0081a7;
    background: rgba(0, 129, 167, 0.08);
    border-color: rgba(0, 129, 167, 0.15);
}

.source-proschiedam {
    color: #0055aa;
    background: rgba(0, 85, 170, 0.08);
    border-color: rgba(0, 85, 170, 0.15);
}

.news-date {
    color: var(--color-text-muted);
    font-weight: 500;
}

.news-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: var(--color-text-heading);
}

.news-description {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-main);
    margin: 0;
    opacity: 0.85;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading & Empty State Styling */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    font-weight: 500;
    gap: 16px;
    text-align: center;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(var(--color-accent-rgb), 0.1);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* PWA Install Banner Styles */
.pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 560px;
    margin: 0 auto;
    background: var(--color-glass-bg);
    border: 1px solid var(--color-glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-element);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-banner[hidden] {
    display: none !important;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pwa-banner-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pwa-banner-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: var(--color-text-heading);
}

.pwa-banner-desc {
    font-size: 13px;
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.4;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.pwa-banner-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.pwa-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background-color 0.2s, transform 0.1s;
}

.pwa-btn:active {
    transform: scale(0.97);
}

.pwa-btn-primary {
    background: var(--color-accent);
    color: #ffffff;
}

.pwa-btn-primary:hover {
    background: var(--color-accent-hover);
}

.pwa-btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-main);
}

.pwa-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

.ios-share-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    display: inline-block;
    fill: currentColor;
    margin: 0 2px;
}

@media (max-width: 480px) {
    .pwa-banner {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }
}
