/**
 * ComPost Theme - Custom CSS
 * Refactored with CSS Variables for better maintainability and Dark Mode support.
 */

:root {
    /* Surfaces & Backgrounds */
    --background: #F3F3F3;
    --surface: #FFFFFF;
    --overlay: #050505;
    --category-card-bg: #FFFFFF;
    --integration-pentagon-bg: #F3F3F3;
    --integration-pentagon-stroke: rgba(121, 121, 121, 0.12);
    --tag-chip-bg: #E5E7EB;

    /* Typography */
    --text-primary: #424242;
    --text-secondary: #797979;
    --border: #D2D2D2;

    /* Accents & Feedback */
    --primary: #5B48D9;
    --red: #681209;
    --success: #00A983;
    --warning: #FFC151;

    /* Google Ecosystem */
    --google-tasks: #2684FC;
    --google-calendar: #34A853;
    --google-sheets: #0F9D58;
    --google-action: #4285F4;
    --google-mail: #EA4335;

    /* Colors - Legacy support for Tailwind classes used in theme */
    --white: #FFFFFF;
    --black: #000000;
    --primary-hover: #4a3ab5;
    --primary-light: #dde1ff;
    --secondary: #4f46e5;
    --text-muted: #797979;
    --text-label: #797979;
    --text-content: #424242;
    --border-light: #D2D2D2;
    --border-app: #D2D2D2;
    --bg-app: #F3F3F3;
    --bg-app-input: #FFFFFF;

    /* Scrollbar */
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #888;
    --scrollbar-thumb-hover: #555;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Spacing & Transitions */
    --transition-fast: 150ms;
    --transition-normal: 0.2s;
    --transition-slow: 0.3s;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

:root.dark-theme {
    /* Surfaces & Backgrounds */
    --background: #121212;
    --surface: #1E1E1E;
    --category-card-bg: #1E1E1E;
    --integration-pentagon-bg: #121212;
    --integration-pentagon-stroke: #333333;
    --tag-chip-bg: #121212;

    /* Typography */
    --text-primary: #E3E3E3;
    --text-secondary: #A0A0A0;
    --border: #333333;

    /* Accents & Feedback */
    --primary: #8A7BFE;
    --red: #CF6679;
    --success: #00C49A;
    --warning: #FFCA68;

    /* Colors - Legacy support for Tailwind classes used in theme */
    --white: #1E1E1E;
    --black: #FFFFFF;
    --primary-hover: #9b8bff;
    --primary-light: #2d2b52;
    --secondary: #6366f1;
    --text-muted: #A0A0A0;
    --text-label: #A0A0A0;
    --text-content: #E3E3E3;
    --border-light: #333333;
    --border-app: #333333;
    --bg-app: #121212;
    --bg-app-input: #1E1E1E;

    /* Scrollbar */
    --scrollbar-track: #121212;
    --scrollbar-thumb: #333333;
    --scrollbar-thumb-hover: #555555;
}

/* Force background and text colors since they are often applied directly to body */
.dark-theme body {
    background-color: var(--background) !important;
    color: var(--text-primary) !important;
}

/* Adjust specific elements for dark mode using the new variables */
.dark-theme .bg-white {
    background-color: var(--surface) !important;
}

.dark-theme .bg-gray-50, 
.dark-theme .bg-gray-100 {
    background-color: var(--background) !important;
}

.dark-theme .text-gray-900, 
.dark-theme .text-gray-800 {
    color: var(--text-primary) !important;
}

.dark-theme .text-gray-700, 
.dark-theme .text-gray-600 {
    color: var(--text-secondary) !important;
}

.dark-theme .text-gray-500 {
    color: var(--text-secondary) !important;
}

.dark-theme .border-gray-200, 
.dark-theme .border-gray-300 {
    border-color: var(--border) !important;
}

.dark-theme input, 
.dark-theme select, 
.dark-theme textarea {
    background-color: var(--surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* Invert search icon or keep same if it works */
.dark-theme .form-search__icon {
    color: var(--text-secondary);
}

/* ===== Phase 1.1: Custom Tailwind colors → CSS variable overrides ===== */
.dark-theme .bg-surface {
    background-color: var(--surface) !important;
}

.dark-theme .bg-background {
    background-color: var(--background) !important;
}

.dark-theme .text-text-primary {
    color: var(--text-primary) !important;
}

.dark-theme .text-text-secondary {
    color: var(--text-secondary) !important;
}

/* ===== Phase 1.2: Missing standard Tailwind class overrides ===== */
.dark-theme .border-gray-100 {
    border-color: var(--border) !important;
}

.dark-theme .bg-gray-200 {
    background-color: #333333 !important;
}

.dark-theme .text-gray-400 {
    color: #666666 !important;
}

.dark-theme .text-gray-300 {
    color: #888888 !important;
}

.dark-theme .text-black {
    color: var(--text-primary) !important;
}

.dark-theme .bg-gray-800 {
    background-color: #2a2a2a !important;
}

/* Blue chips (video tags) */
.dark-theme .bg-blue-50 {
    background-color: rgba(37, 99, 235, 0.15) !important;
}

.dark-theme .text-blue-700 {
    color: #60a5fa !important;
}

/* Purple chips (category filters on home) */
.dark-theme .bg-purple-100 {
    background-color: rgba(138, 123, 254, 0.15) !important;
}

.dark-theme .text-purple-700 {
    color: #8A7BFE !important;
}

/* Red states (delete, errors) */
.dark-theme .bg-red-50 {
    background-color: rgba(207, 102, 121, 0.1) !important;
}

.dark-theme .text-red-600 {
    color: #CF6679 !important;
}

.dark-theme .text-red-700 {
    color: #CF6679 !important;
}

.dark-theme .text-red-900 {
    color: #f87171 !important;
}

/* Hover states */
.dark-theme .hover\:bg-gray-50:hover {
    background-color: #2a2a2a !important;
}

.dark-theme .hover\:bg-gray-100:hover {
    background-color: #333333 !important;
}

.dark-theme .hover\:text-gray-700:hover {
    color: var(--text-primary) !important;
}

/* ===== Phase 1.3: Header switcher buttons (Lang + Theme Toggle) ===== */
.dark-theme .compost-header-lang-btn {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
}

/* --- Современный плоский Тоггл для выбора темы --- */
.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.toggle-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 76px;
  height: 38px;
  background-color: #e2e8f0;
  border-radius: 50px;
  padding: 0 8px;
  box-sizing: border-box;
  transition: background-color 0.3s;
}

.toggle-track .icon {
  font-size: 18px !important;
  color: #94a3b8; /* Нейтральный цвет иконок */
  z-index: 1;
  pointer-events: none;
  transition: color 0.3s;
}

/* Бегунок (круг) */
.toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 2;
}

/* Логика состояний тоггла (Light Mode) */
html:not(.dark-theme) .toggle-thumb {
  transform: translateX(0);
}
html:not(.dark-theme) .icon-sun {
  color: #f59e0b !important; /* Подсвечиваем солнце желтым */
}

/* Логика состояний тоггла (Dark Mode) */
html.dark-theme .toggle-thumb {
  transform: translateX(38px); /* Смещаем вправо */
  background-color: #1e293b;
}
html.dark-theme .icon-moon {
  color: #38bdf8 !important; /* Подсвечиваем луну голубым */
}
html.dark-theme .toggle-track {
  background-color: #334155;
}


/* ========== Admin Bar Override ========== */
html {
    margin-top: 0 !important;
    scroll-behavior: smooth;
}

body {
    margin-top: 0 !important;
    overflow-x: hidden;
}

#wpadminbar {
    display: none !important;
}

/* Desktop Sidebar - Force visibility on large screens */
@media (min-width: 1024px) {
    aside.compost-sidebar {
        display: block !important;
    }
}

/* Mobile Sidebar - Hide on small screens */
@media (max-width: 1023px) {
    aside.compost-sidebar {
        display: none !important;
    }
}

/* Line clamp utility for text truncation */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Focus visible */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Transition for theme elements */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: var(--ease);
    transition-duration: var(--transition-fast);
}

/* ========== Filter Dropdown Animations ========== */
.filter-dropdown-button [data-lucide="chevron-down"] {
    transition: transform var(--transition-normal) ease;
}

.filter-dropdown-menu {
    transition: opacity var(--transition-normal) ease, transform var(--transition-normal) ease;
    transform-origin: top;
}

.filter-dropdown-menu.hidden {
    opacity: 0;
    transform: scaleY(0.95);
}

/* ========== Category Grid ========== */
.category-grid {
    transition: all var(--transition-slow) ease;
}

.category-card {
    transition: all var(--transition-normal) ease;
    background-color: var(--category-card-bg) !important;
    border-color: var(--border) !important;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hidden-category {
    animation: fadeOut var(--transition-slow) ease;
}

.hidden-category:not(.hidden) {
    animation: fadeIn var(--transition-slow) ease;
}

/* Revealed category cards (toggled by category-toggle.js) */
.category-extra:not(.hidden) {
    animation: fadeIn var(--transition-slow) ease-in-out;
}

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

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

/* ========== Category Expand Icon Rotation ========== */
.category-expand-icon {
    transition: transform var(--transition-slow) ease;
}

/* ========== Pentagon Icon Transitions ========== */
.integration-icon-pentagon,
.integration-icon-flat {
    transition: opacity var(--transition-normal) ease;
}

.compost-pentagon {
    flex-shrink: 0;
}

.compost-pentagon__shape {
    filter: drop-shadow(0 1px 1px rgba(17, 24, 39, 0.04));
}

/* Semantic chip style for prompt tags across light/dark themes */
.compost-tag-chip {
    background-color: var(--tag-chip-bg) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border);
}

.compost-tag-chip:hover {
    border-color: var(--primary);
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
    .compost-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-dropdown {
        width: 100%;
    }

    .filter-dropdown-button {
        width: 100%;
        justify-content: space-between;
    }

    .filter-dropdown-menu {
        width: 100%;
        left: 0;
        right: 0;
    }

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

/* ========== Blog Post Content Styling (.compost-post-content) ========== */
/* Scoped styling for blog content to ensure correct formatting without typography plugin */
.compost-post-content {
    color: var(--text-primary);
    font-size: 1.125rem; /* text-lg */
    line-height: 1.75;
}
.compost-post-content p {
    margin-bottom: 1.5rem;
}
.compost-post-content h1, 
.compost-post-content h2, 
.compost-post-content h3, 
.compost-post-content h4, 
.compost-post-content h5, 
.compost-post-content h6 {
    color: var(--text-primary);
    font-weight: 800; /* font-extrabold / bold */
    line-height: 1.25;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
}
.compost-post-content h2 {
    font-size: 2.25rem; /* 3xl */
}
.compost-post-content h3 {
    font-size: 1.875rem; /* 3xl */
}
.compost-post-content h4 {
    font-size: 1.5rem; /* 2xl */
}
.compost-post-content a {
    color: var(--primary);
    text-decoration: underline;
    transition: color 0.2s ease;
}
.compost-post-content a:hover {
    color: var(--primary-hover);
}
.compost-post-content ul, .compost-post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.compost-post-content ul {
    list-style-type: disc;
}
.compost-post-content ol {
    list-style-type: decimal;
}
.compost-post-content li {
    margin-bottom: 0.5rem;
}
.compost-post-content blockquote {
    border-left: 4px solid var(--border);
    padding-left: 1rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}
.compost-post-content img, .compost-post-content figure {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}
.compost-post-content iframe {
    max-width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
}

/* ========== Breadcrumbs ========== */
.app-banner {
    transition: all var(--transition-normal) ease;
}

/* ========== 404 Page ========== */
.error-page {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding: 4rem 1rem;
}

.error-page__content {
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.error-page__icon {
    margin-bottom: var(--spacing-lg, 1.5rem);
}

.error-page__icon .material-symbols-outlined {
    font-size: 80px;
    color: var(--primary);
}

.heading-404 {
    font-size: 3rem;
    line-height: 1;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.heading-404-sub {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.error-page__description {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.error-page__search {
    max-width: 28rem;
    margin: 0 auto 2.5rem;
}

.form-search {
    position: relative;
}

.form-search__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-label);
    font-size: 1.25rem;
}

.form-input-search {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    font-size: 1rem;
    line-height: 1.5rem;
    outline: none;
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.form-input-search:focus {
    box-shadow: 0 0 0 2px var(--primary);
    border-color: transparent;
}

.error-page__actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

@media (min-width: 640px) {
    .error-page__actions {
        flex-direction: row;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal), opacity var(--transition-normal);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    border: 1px solid transparent;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: var(--white);
}

.btn .material-symbols-outlined {
    font-size: 1.25rem;
}

.error-page__footer {
    margin-top: 2rem;
    color: var(--text-muted);
}

.error-page__footer a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.error-page__footer a:hover {
    text-decoration: underline;
}

/* ========== Single Prompt Page Styles ========== */

/* Integration icon sizing for single prompt inline display */
.integration-icon-single {
    font-size: 16px;
}

/* Material Design Outlined Text Field Style for Prompt Content */
.single-prompt .prompt-content-label {
    position: relative;
    display: inline-block;
    padding: 0 8px;
    background: var(--white);
    color: var(--text-label);
    font-size: 0.875rem;
    font-weight: 600;
    transform: translateY(12px);
    margin-left: 12px;
    z-index: 1;
}

/* Single prompt: YouTube Shorts vertical player */
.single-prompt .video-tutorial-wrapper {
    margin-top: 0.25rem;
}

.single-prompt .video-tutorial-title {
    margin: 0 0 0.75rem;
    color: var(--text-content);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.4;
}

.single-prompt .video-tutorial-frame {
    width: min(100%, 360px);
    margin: 0 auto;
    aspect-ratio: 9 / 16;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--black);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.single-prompt .video-tutorial-play {
    position: relative;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: var(--black);
}

.single-prompt .video-tutorial-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.single-prompt .video-tutorial-play-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.single-prompt .video-tutorial-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.single-prompt .video-tutorial-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Like button icon fill state */
.compost-like-btn .material-symbols-outlined.fill {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* ========== Yoast Breadcrumbs Optimization ========== */
.yoast-breadcrumbs a {
    text-decoration: underline;
    text-decoration-color: #D1D5DB;
    text-underline-offset: 4px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.yoast-breadcrumbs a:hover {
    color: #5B48D9;
    text-decoration-color: #5B48D9;
}
.yoast-breadcrumbs .breadcrumb_last {
    font-weight: 500;
    color: #424242;
}

/* ========== Mobile Header Optimization (<500px) ========== */
@media (max-width: 499px) {
    /* Compact search field */
    header input[type="search"] {
        font-size: 14px;
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
    header input[type="search"]::placeholder {
        font-size: 12px;
    }

    /* Search icon smaller */
    header .material-symbols-outlined {
        font-size: 18px;
    }

    /* Burger menu icon larger */
    header #mobile-menu-open .material-symbols-outlined {
        font-size: 2rem;
    }

    /* Compact "Open in App" button - reduce padding */
    header .open-app-btn {
        padding: 0.5rem 0.75rem;
        min-width: auto;
    }

    header .open-app-btn .material-symbols-outlined {
        font-size: 20px;
    }

    /* Reduce gap between header elements */
    header .flex.items-center.gap-4 {
        gap: 0.5rem;
    }

    /* Logo text smaller */
    header a.text-2xl {
        font-size: 1.125rem;
        line-height: 1.2;
    }

    /* User avatar smaller */
    header img.rounded-full {
        width: 32px;
        height: 32px;
    }
}

/* ========== Mobile Single Prompt Layout ========== */
@media (max-width: 640px) {
    /* Stack metadata sections on mobile */
    .single-prompt .flex.flex-wrap.gap-2 {
        gap: 0.5rem;
    }

    /* Smaller prompt title on mobile */
    .single-prompt h1.text-3xl {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }
}

/* ========== Sticky Header Enhancements ========== */
header {
    transition: box-shadow var(--transition-slow) ease;
}

header.scrolled {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========== App View (Android WebView) ========== */
body.is-app-view > header {
    display: none !important;
}

body.is-app-view #page {
    min-height: 100dvh;
}

/* Hide profile hero info card (avatar/name block), keep top navigation context */
body.is-app-view.page-template-page-profile .profile-hero-section > .bg-surface {
    display: none !important;
}

body.is-app-view.page-template-page-profile .profile-hero-section {
    margin-bottom: 0 !important;
}

/* MD3 segmented control for breadcrumbs (All Prompts / My Profile) */
body.is-app-view .breadcrumbs {
    margin-bottom: 0.75rem !important;
}

body.is-app-view .breadcrumbs ol {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem;
    border: 1px solid var(--border-app);
    border-radius: var(--radius-full);
    background: var(--bg-app);
}

body.is-app-view .breadcrumbs li {
    min-width: 0;
}

body.is-app-view .breadcrumbs li > .material-symbols-outlined {
    display: none !important;
}

body.is-app-view .breadcrumbs a,
body.is-app-view .breadcrumbs span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    padding: 0 0.875rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

body.is-app-view .breadcrumbs a {
    border: 1px solid var(--border-app);
    color: var(--text-muted);
    background: transparent;
}

body.is-app-view .breadcrumbs span {
    border: 1px solid transparent;
    color: var(--text-app);
    background: var(--primary-light);
}

/* MD3-style profile tabs under the top navigation */
body.is-app-view.page-template-page-profile main > section.mt-8 {
    margin-top: 0 !important;
}

body.is-app-view.page-template-page-profile nav[role="tablist"] {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

body.is-app-view.page-template-page-profile nav[role="tablist"] > a {
    padding: 0.5rem 0.25rem !important;
    border-bottom-width: 3px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

body.is-app-view.page-template-page-profile nav[role="tablist"] > a[aria-selected="true"] {
    color: var(--secondary) !important;
    border-bottom-color: var(--secondary) !important;
}

body.is-app-view.page-template-page-profile nav[role="tablist"] > a[aria-selected="false"] {
    color: var(--text-muted) !important;
    border-bottom-color: transparent !important;
}

body.is-app-view.page-template-page-profile .border-b.border-gray-200 {
    margin-bottom: 0.5rem !important;
    padding-bottom: 0 !important;
}

/* Make search field prominent and full-width in app view */
body.is-app-view form[role="search"] {
    width: 100%;
    max-width: 100%;
}

body.is-app-view form[role="search"] input[type="search"] {
    width: 100%;
    min-height: 48px;
    border-radius: 16px !important;
    border-color: var(--bg-app-input) !important;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

/* ========== App View: Hide Redundant Web UI + Native Nav ========== */
body.is-app-view > header,
body.is-app-view > footer,
body.is-app-view .app-promo-section,
body.is-app-view section.bg-primary.text-white.py-16,
body.is-app-view #page > footer,
body.is-app-view .breadcrumbs,
body.is-app-view #mobile-filter-fab,
body.is-app-view .filter-bar,
body.is-app-view #active-chips-container,
body.is-app-view .compost-filter-bar,
body.is-app-view .profile-hero-section > .bg-surface,
body.is-app-view.page-template-page-profile nav[role="tablist"],
body.is-app-view.page-template-page-profile .border-b.border-gray-200 {
    display: none !important;
}

/* ========== Header Menu Dropdowns ========== */
/* Desktop */
.compost-desktop-menu {
    font-family: 'Montserrat', sans-serif;
}
.compost-desktop-menu .menu-item-has-children {
    position: relative;
    padding-bottom: 8px;
    margin-bottom: -8px;
}

/* Arrow indicator */
.compost-desktop-menu .menu-item-has-children > a {
    display: inline-flex;
    align-items: center;
}
.compost-desktop-menu .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 2px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E") no-repeat center / contain;
    transition: transform 0.2s ease-in-out;
}

.compost-desktop-menu .menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

.compost-desktop-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background-color: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease-in-out;
    z-index: 50;
}
.compost-desktop-menu .menu-item-has-children:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.compost-desktop-menu .sub-menu li a {
    display: block;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}
.compost-desktop-menu .sub-menu li a:hover {
    background-color: var(--bg-app);
    color: var(--primary);
}

/* Mobile Nested Lists */
.compost-mobile-nav {
    font-family: 'Montserrat', sans-serif;
}
.compost-mobile-nav .sub-menu {
    margin-top: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.compost-mobile-nav .sub-menu li a {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- Footer Grid --- */
.compost-footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    justify-content: center;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .compost-footer-grid.has-4-cols,
    .compost-footer-grid.has-3-cols {
        grid-template-columns: repeat(2, auto);
        justify-content: center;
        gap: clamp(60px, 10vw, 100px);
    }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
    .compost-footer-grid.has-4-cols {
        grid-template-columns: repeat(4, auto);
        justify-content: center;
        gap: clamp(100px, 8vw, 130px);
    }
    .compost-footer-grid.has-3-cols {
        grid-template-columns: repeat(3, auto);
        justify-content: center;
        gap: clamp(100px, 8vw, 130px);
    }
}
