* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2d5016;
    --secondary-color: #4a7c2a;
    --accent-color: #6ba644;
    --bg-color: #f5f7f3;
    --footer-bg: #e2eadc;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #e1e8e3;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15);
    --main-nav-height: 65px;
    --filters-footer-padding: 32px;
}

[data-theme="dark"] {
    --primary-color: #7cb84a;
    --secondary-color: #8fc962;
    --accent-color: #9dd66b;
    --bg-color: #1a1d1a;
    --footer-bg: #222622;
    --card-bg: #252825;
    --text-color: #e4e6e4;
    --text-light: #9ca39c;
    --border-color: #3a403a;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .main-nav {
    background: rgba(37, 40, 37, 0.95);
    border-bottom-color: var(--border-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .nav-menu {
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-hover);
}

[data-theme="dark"] .plant-card.aquatic-plant {
    background: var(--card-bg);
    border-color: rgba(100, 160, 200, 0.4);
    box-shadow: var(--shadow);
}

[data-theme="dark"] .plant-card.aquatic-plant:hover {
    border-color: rgba(100, 160, 200, 0.6);
    box-shadow: var(--shadow-hover);
}

[data-theme="dark"] .plant-card.aquatic-plant .plant-image-container {
    background: linear-gradient(135deg, #1e2d35 0%, #253a45 100%);
}

[data-theme="dark"] .plant-card.aquatic-plant .plant-info {
    background: var(--card-bg);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .plant-card.aquatic-plant .plant-image-container .card-price {
    background: rgba(37, 40, 37, 0.95);
    color: var(--primary-color);
}

/* Plant detail panel: no distracting gradient in dark mode */
[data-theme="dark"] .plant-detail-panel {
    background: var(--bg-color);
}

[data-theme="dark"] .plant-detail-panel .plant-panel-body {
    background: transparent;
}

/* Info items in plant panel: dark-friendly background */
[data-theme="dark"] .plant-detail-panel .info-item,
[data-theme="dark"] .info-item {
    background: rgba(37, 40, 37, 0.6);
    border: 1px solid var(--border-color);
}

/* Plant modal: Edit / Image / Hide buttons – dark mode */
[data-theme="dark"] .detail-actions .detail-btn,
[data-theme="dark"] .detail-actions-fixed .detail-btn {
    background: rgba(37, 40, 37, 0.95);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .detail-actions .detail-btn:hover,
[data-theme="dark"] .detail-actions-fixed .detail-btn:hover {
    background: var(--accent-color);
    color: #1a1d1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .detail-actions .detail-btn svg,
[data-theme="dark"] .detail-actions-fixed .detail-btn svg {
    color: inherit;
}

/* Plant card overlay: Edit / Image icons – dark mode */
[data-theme="dark"] .card-icons .card-edit-icon,
[data-theme="dark"] .card-icons .card-image-icon,
[data-theme="dark"] .image-edit-icon,
[data-theme="dark"] .plant-image-icon {
    background: rgba(37, 40, 37, 0.95);
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .card-icons .card-edit-icon svg,
[data-theme="dark"] .card-icons .card-image-icon svg,
[data-theme="dark"] .image-edit-icon svg,
[data-theme="dark"] .plant-image-icon svg {
    color: var(--accent-color);
}
[data-theme="dark"] .card-edit-icon:hover,
[data-theme="dark"] .card-image-icon:hover,
[data-theme="dark"] .image-edit-icon:hover,
[data-theme="dark"] .plant-image-icon:hover {
    background: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .card-edit-icon:hover svg,
[data-theme="dark"] .card-image-icon:hover svg,
[data-theme="dark"] .image-edit-icon:hover svg,
[data-theme="dark"] .plant-image-icon:hover svg {
    color: #1a1d1a;
}

[data-theme="dark"] .care-card-icon {
    background: rgba(37, 40, 37, 0.95);
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .care-card-icon svg {
    color: var(--accent-color);
}
[data-theme="dark"] .care-card-icon:hover {
    background: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .care-card-icon:hover svg {
    color: #1a1d1a;
}

/* Enclosure size track: dark mode colors */
[data-theme="dark"] .enclosure-size-track {
    background: rgba(37, 40, 37, 0.8);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .enclosure-size-segment {
    border-right-color: var(--border-color);
}

[data-theme="dark"] .enclosure-size-segment.minimum {
    background: linear-gradient(135deg,
        rgba(124, 184, 74, 0.15) 0%,
        rgba(143, 201, 98, 0.25) 50%,
        rgba(124, 184, 74, 0.15) 100%);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(124, 184, 74, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .enclosure-size-segment.minimum::before {
    background: linear-gradient(135deg,
        rgba(124, 184, 74, 0.1) 0%,
        transparent 50%,
        rgba(143, 201, 98, 0.1) 100%);
}

[data-theme="dark"] .enclosure-size-segment.minimum {
    animation: none;
}

[data-theme="dark"] .requirement-scale-track {
    background: linear-gradient(to right,
        rgba(37, 40, 37, 0.9) 0%,
        rgba(58, 64, 58, 0.95) 50%,
        rgba(37, 40, 37, 0.9) 100%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .requirement-scale-range {
    background: linear-gradient(to right,
        rgba(124, 184, 74, 0.35) 0%,
        rgba(143, 201, 98, 0.5) 50%,
        rgba(124, 184, 74, 0.35) 100%);
    border-color: rgba(124, 184, 74, 0.5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .info-group.submerged-details .requirement-scale-track {
    background: linear-gradient(to right,
        rgba(37, 40, 37, 0.9) 0%,
        rgba(30, 50, 58, 0.95) 50%,
        rgba(37, 40, 37, 0.9) 100%);
    border-color: var(--border-color);
}

[data-theme="dark"] .info-group.submerged-details .requirement-scale-range {
    background: linear-gradient(to right,
        rgba(14, 165, 233, 0.4) 0%,
        rgba(6, 182, 212, 0.5) 50%,
        rgba(14, 165, 233, 0.4) 100%);
    border-color: rgba(14, 165, 233, 0.4);
}

.safety-info-item {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.safety-info-item .info-item-value {
    color: #856404;
}

[data-theme="dark"] .safety-info-item {
    background: rgba(180, 140, 40, 0.25);
    border-left-color: #c9a227;
}

[data-theme="dark"] .safety-info-item .info-item-value {
    color: #e6d9a0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

p {
    text-align: justify;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

/* When opening a plant directly by URL (tab=plants&id=...), hide the main
   grid until the detail panel/modal takes over, to avoid a flash of the list. */
html.detail-startup .main-layout .main-content,
html.detail-startup .main-layout .list-view,
html.detail-startup #plantsGrid,
html.detail-startup #filtersSidebarWrapper {
    display: none !important;
}

html.detail-startup body {
    background-color: var(--bg-color);
}

.container {
    --container-padding-x: 20px;
    max-width: none;
    margin: 0 auto;
    padding: 0 var(--container-padding-x);
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 300px);
}

@media (max-width: 480px) {
    .container {
        --container-padding-x: 15px;
    }
}

/* Main Layout with Sidebar - pull left so filters panel is flush to viewport */
.main-layout {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    margin-left: calc(-1 * var(--container-padding-x, 20px));
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.filters-sidebar-wrapper {
    --filters-sidebar-width: 320px;
    width: var(--filters-sidebar-width);
    min-width: var(--filters-sidebar-width);
    flex-shrink: 0;
    align-self: flex-start;
    transition: width 0.2s, min-width 0.2s;
}

.filters-sidebar-wrapper.filters-sidebar-wrapper-collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

/* Hide filter panel when detail/modal view is shown (plant, equipment, vivarium) */
.main-layout.detail-view-active .filters-sidebar-wrapper {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

/* Filters Sidebar (control panel) - visible by default, fixed when scrolling (via JS), scrollable */
.filters-sidebar {
    --filters-sidebar-width: 320px;
    width: var(--filters-sidebar-width);
    min-width: var(--filters-sidebar-width);
    max-height: calc(100vh - 140px);
    min-height: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.filters-sidebar.is-sticky {
    position: fixed;
    top: var(--filters-sticky-top, calc(2 * var(--main-nav-height)));
    left: var(--filters-sticky-left, 20px);
    z-index: 15;
    box-shadow: var(--shadow-hover);
}

.filters-sidebar.control-panel-collapsed {
    display: none !important;
}

/* Wrapper only for layout; edge actions container is fixed when panel expanded */
.control-panel-collapse-wrap {
    flex-shrink: 0;
    height: 0;
    width: 100%;
    position: relative;
    pointer-events: none;
}

.control-panel-collapse-wrap .control-panel-edge-actions {
    pointer-events: auto;
}

/* Container for filter + reset icons on right edge; position updated by JS to stay within panel bounds */
.control-panel-edge-actions {
    position: fixed;
    left: var(--filters-sidebar-width, 320px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 20;
}

/* Filter and reset icons: same size and style */
.control-panel-collapse-btn,
.control-panel-reset-btn {
    width: 32px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    transition: background-color 0.2s;
}

.control-panel-collapse-btn:hover,
.control-panel-reset-btn:hover {
    background: var(--secondary-color);
}

.control-panel-collapse-btn svg,
.control-panel-reset-btn svg {
    width: 1rem;
    height: 1rem;
    color: currentColor;
}

/* Reopen button when panel is collapsed (fixed on left edge), compact */
.control-panel-reopen-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    z-index: 100;
    transition: background-color 0.2s;
}

.control-panel-reopen-btn:hover {
    background: var(--secondary-color);
}

.control-panel-reopen-btn.hidden {
    display: none !important;
}

.control-panel-reopen-btn svg {
    width: 1rem;
    height: 1rem;
    color: currentColor;
}

.control-panel-reopen-btn-text {
    display: none;
}

.filters-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 15;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.filters-overlay.hidden {
    display: none;
}

/* Legend sidebar (right) - vivarium types quick reference */
.legend-sidebar-wrapper {
    --legend-sidebar-width: 200px;
    width: var(--legend-sidebar-width);
    min-width: var(--legend-sidebar-width);
    flex-shrink: 0;
    align-self: flex-start;
    transition: width 0.2s, min-width 0.2s;
}

.legend-sidebar-wrapper.legend-sidebar-wrapper-collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.main-layout.detail-view-active .legend-sidebar-wrapper {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.legend-sidebar {
    --legend-sidebar-width: 200px;
    width: var(--legend-sidebar-width);
    min-width: var(--legend-sidebar-width);
    max-height: calc(100vh - 140px);
    min-height: 0;
    background: var(--card-bg);
    border-radius: 12px 0 0 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.legend-sidebar.legend-sidebar-collapsed {
    display: none !important;
}

.legend-sidebar.is-sticky {
    position: fixed;
    top: var(--legend-sticky-top, calc(2 * var(--main-nav-height)));
    right: var(--legend-sticky-right, 0);
    z-index: 15;
    box-shadow: var(--shadow-hover);
}

.legend-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.legend-sidebar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.legend-sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-color);
    transition: background 0.2s, color 0.2s;
}

.legend-sidebar-collapse-btn:hover {
    background: var(--primary-color);
    color: white;
}

.legend-sidebar-collapse-btn svg {
    width: 0.9rem;
    height: 0.9rem;
}

.legend-sidebar-content {
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.legend-sidebar-intro {
    margin: 0 0 0.75rem 0;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
}

.legend-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-color);
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-dot {
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    border-radius: 50%;
    padding: 0;
    font-size: 0;
    line-height: 0;
    display: inline-block;
}

/* Legend reopen: right edge, same vertical level as Filters (top: 50%), compact. Visible only on mobile + small cards via .visible-on-mobile-small */
.legend-sidebar-reopen-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 40px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    z-index: 99;
    transition: background-color 0.2s;
}

@media (max-width: 1024px) {
    .legend-sidebar-reopen-btn.visible-on-mobile-small:not(.hidden) {
        display: flex;
    }
    .legend-sidebar-reopen-btn.visible-on-mobile-small {
        top: auto;
        bottom: 5rem;
        transform: none;
    }
}

.legend-sidebar-reopen-btn:hover {
    background: var(--secondary-color);
}

.legend-sidebar-reopen-btn.hidden {
    display: none !important;
}

.legend-reopen-dots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    align-items: center;
    justify-items: center;
}
.legend-reopen-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-sidebar-reopen-btn-text {
    display: none;
}

.legend-overlay {
    display: none;
}

.filters-overlay:not(.hidden) {
    display: block;
    pointer-events: auto;
    opacity: 1;
}

.filters-mobile-header {
    display: none;
}

.filters-content {
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
}

.filters-content-tab {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.filters-content-tab.hidden {
    display: none !important;
}

.filters-content input,
.filters-content select,
.filters-content textarea {
    max-width: 100%;
    box-sizing: border-box;
}

.filters-content::-webkit-scrollbar {
    width: 8px;
}

.filters-content::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.filters-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.filters-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
    padding-left: var(--container-padding-x, 20px);
}

/* Inline Search Container */
.search-container-inline {
    display: flex;
    gap: 0.5rem;
}

.search-container-inline input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.search-container-inline input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.search-container-inline button {
    padding: 8px 16px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.search-container-inline button:hover {
    background-color: var(--secondary-color);
}

/* Dual Range Slider Group */
.dual-range-slider-group {
    margin-top: 0.5rem;
}

.dual-range-container {
    position: relative;
    height: 20px;
    margin: 10px 0;
}

.range-slider {
    position: absolute;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.dual-range-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    transform: translateY(-50%);
    background: var(--border-color);
    border-radius: 3px;
    z-index: 1;
}

.range-slider-min {
    z-index: 2;
}

.range-slider-max {
    z-index: 3;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: background-color 0.3s;
    pointer-events: all;
    position: relative;
    z-index: 4;
}

.range-slider::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
    pointer-events: all;
    position: relative;
    z-index: 4;
}

.range-slider::-moz-range-thumb:hover {
    background: var(--secondary-color);
}

.range-slider::-moz-range-track {
    background: transparent;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
    }
    
    .filters-sidebar-wrapper {
        width: 100%;
        min-width: auto;
        order: -1;
    }
    .filters-sidebar-wrapper.filters-sidebar-wrapper-collapsed {
        width: 0;
        min-width: 0;
        overflow: hidden;
    }
    
    body.filters-drawer-open .filters-sidebar-wrapper {
        position: fixed;
        top: var(--main-nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-width: 100%;
        z-index: 20;
        overflow: hidden;
        background: transparent;
        pointer-events: none;
    }
    body.filters-drawer-open .filters-sidebar-wrapper .filters-sidebar {
        pointer-events: auto;
    }
    body.filters-drawer-open .filters-sidebar {
        /* Full-screen filters panel on mobile */
        width: 100%;
        min-width: 100%;
        height: calc(100vh - var(--main-nav-height));
        max-height: none;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    body.filters-drawer-open .control-panel-edge-actions {
        display: none;
    }
    body.filters-drawer-open {
        overflow: hidden;
    }
    body.filters-drawer-open .filters-content {
        padding-top: 0;
    }
    body.filters-drawer-open .legend-sidebar-reopen-btn {
        display: none !important;
    }
    
    .filters-sidebar {
        width: 100%;
        min-width: auto;
        position: static;
        max-height: none;
    }
    
    .filters-sidebar.is-sticky {
        position: static;
    }
    
    .legend-sidebar.is-sticky {
        position: static;
    }
    
    /* Legend as right-side drawer on mobile: no layout space, slide in from right */
    .legend-sidebar-wrapper {
        width: 0 !important;
        min-width: 0 !important;
        overflow: visible;
    }
    .legend-sidebar {
        position: fixed !important;
        right: 0;
        top: calc(var(--main-nav-height) + 0.5rem);
        bottom: auto;
        height: auto;
        max-height: calc(100vh - var(--main-nav-height) - 1rem);
        width: min(240px, 78vw);
        border-radius: 12px 0 0 12px;
        border-right: 1px solid var(--border-color);
        z-index: 20;
        transition: transform 0.3s ease;
        display: flex !important;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    }
    .legend-sidebar.legend-sidebar-collapsed {
        transform: translateX(100%);
        display: flex !important;
    }
    .legend-sidebar:not(.legend-sidebar-collapsed) {
        transform: translateX(0);
    }
    body.legend-drawer-open .legend-overlay {
        display: block;
        pointer-events: auto;
        opacity: 1;
    }
    .legend-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 19;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .filters-sidebar.visible {
        display: flex;
    }
    
    .control-panel-reopen-btn {
        top: auto;
        bottom: 5rem;
        transform: none;
    }
    
    .filters-mobile-sticky-top {
        position: sticky;
        top: 0;
        z-index: 10;
        flex-shrink: 0;
        background-color: var(--card-bg);
        padding-top: env(safe-area-inset-top, 0);
        border-bottom: 1px solid var(--border-color);
        margin: 0 -1.5rem;
        padding: 0 1.5rem 0.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }
    body.filters-drawer-open .filters-mobile-sticky-top {
        margin: 0 -1.5rem;
        padding: max(env(safe-area-inset-top, 0px), var(--main-nav-height)) 1.5rem 0.5rem 1.5rem;
        min-height: 3rem;
    }
    .filters-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.4rem 0;
        margin-bottom: 0.25rem;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }
    .filters-mobile-header-title {
        margin: 0;
        font-size: 0.95rem;
        color: var(--primary-color);
        font-weight: 700;
    }
    .filters-mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .filters-mobile-reset-btn,
    .filters-mobile-close-btn {
        padding: 0.4rem 0.75rem;
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        border: none;
        font-family: inherit;
    }
    .filters-mobile-reset-btn {
        background: var(--bg-color);
        color: var(--primary-color);
        border: 2px solid var(--border-color);
    }
    .filters-mobile-reset-btn:hover {
        background: var(--border-color);
    }
    .filters-mobile-close-btn {
        background: var(--primary-color);
        color: white;
    }
    .filters-mobile-close-btn:hover {
        background: var(--secondary-color);
    }
    body.filters-drawer-open .filters-mobile-sticky-top .control-panel-search {
        margin-bottom: 0;
        padding: 0.25rem 0;
        flex-shrink: 0;
    }
    body.filters-drawer-open .control-panel-search-input {
        padding: 6px 10px;
        font-size: 0.875rem;
    }
    body.filters-drawer-open .control-panel-search-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        max-width: 36px;
    }
}

/* Modern Navigation Bar - hamburger + logo only; all links in main menu */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    height: var(--main-nav-height);
    padding: 0 1rem 0 0;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    pointer-events: auto;
}

.nav-back-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.nav-back-wrap.hidden {
    display: none !important;
}
.nav-back-wrap.nav-back-disabled .nav-back-btn,
.nav-back-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--text-light);
}
.nav-back-wrap.nav-back-disabled .nav-back-btn:hover,
.nav-back-btn:disabled:hover {
    background: var(--text-light);
}
.nav-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.nav-back-btn:hover {
    background: var(--secondary-color);
    color: white;
}
.nav-back-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}
.nav-back-text {
    white-space: nowrap;
}

/* Spacer keeps right-side items in place; logo is centered in viewport so it never shifts */
.nav-logo-spacer {
    flex: 1;
    min-width: 0;
}
.nav-logo {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    height: var(--main-nav-height);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 1001;
}

.nav-cart-wrap {
    margin-left: auto;
    flex-shrink: 0;
}

.nav-auth-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
    position: relative;
}
.nav-auth-link,
.nav-auth-btn {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
}
.nav-auth-link:hover,
.nav-auth-btn:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}
.nav-auth-btn {
    font-family: inherit;
}

.nav-auth-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    max-width: 140px;
}
.nav-auth-trigger:hover {
    color: var(--secondary-color);
}
.nav-auth-account-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: currentColor;
}
.nav-auth-trigger-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.nav-auth-wrap.open .nav-auth-trigger-icon {
    transform: rotate(180deg);
}
.nav-auth-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    min-width: 160px;
    padding: 0.35rem 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1002;
}
.nav-auth-wrap.open .nav-auth-dropdown {
    display: block;
}
.nav-auth-dropdown-user {
    padding: 0.5rem 1rem 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted, #666);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}
.nav-auth-dropdown-user strong {
    color: var(--text-color);
    font-weight: 600;
}
.nav-auth-dropdown-link,
.nav-auth-dropdown-btn {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}
.nav-auth-dropdown-link:hover,
.nav-auth-dropdown-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    font-family: 'DM Serif Display', serif;
    transition: color 0.2s ease;
    opacity: 1;
}

.logo-link:hover {
    color: var(--secondary-color);
}

.logo-img {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-text {
    color: var(--primary-color);
}

/* Main menu drawer - all viewports */
.nav-menu {
    position: fixed;
    top: 65px;
    left: 0;
    width: min(320px, 85vw);
    max-height: calc(100vh - 65px);
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 1.5rem 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.nav-menu.active {
    transform: translateX(0);
}

.nav-item {
    width: 100%;
}

.nav-link {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    border-radius: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-link-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: currentColor;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Hamburger Menu - top-left */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0.5rem 0.5rem 0.25rem;
    z-index: 1001;
}

.nav-toggle span {
    width: 28px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Cart in nav – solid background so icon stands out on light and dark headers */
.cart-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    box-sizing: border-box;
    background: var(--primary-color);
    border: 1px solid rgba(0,0,0,0.08);
    color: white;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.cart-toggle:hover {
    background: var(--secondary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

@keyframes cart-badge-bounce {
    0%   { transform: translateX(-50%) scale(1); }
    30%  { transform: translateX(-50%) scale(1.5); }
    50%  { transform: translateX(-50%) scale(0.9); }
    70%  { transform: translateX(-50%) scale(1.2); }
    100% { transform: translateX(-50%) scale(1); }
}

.cart-icon-wrap {
    position: relative;
    display: inline-block;
}

.cart-icon-wrap.cart-bounce .cart-count {
    animation: cart-badge-bounce 0.45s ease forwards;
}

.cart-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
    color: currentColor;
}

/* Cart count badge: adjust top/left and transform to move relative to the cart icon */
.cart-count {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 1rem;
    height: 1rem;
    line-height: 1rem;
    text-align: center;
    background: transparent;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    text-shadow: 0 0 2px rgba(0,0,0,0.8), 0 1px 3px rgba(0,0,0,0.6);
}
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(380px, 100vw);
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}
.cart-drawer.open {
    transform: translateX(0);
}
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.cart-overlay.hidden,
.cart-drawer.hidden {
    display: none;
}
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.cart-drawer-title { margin: 0; font-size: 1.25rem; color: var(--primary-color); }
.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0.25rem;
}
.cart-close:hover { color: var(--text-color); }
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
.cart-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; color: var(--text-color); font-size: 0.95rem; }
.cart-item-scientific { font-size: 0.8rem; color: var(--text-light); font-style: italic; margin-top: 0.2rem; }
.cart-item-qty { font-size: 0.85rem; color: var(--text-light); margin-top: 0.25rem; }
.cart-item-price { font-size: 0.85rem; color: var(--primary-color); margin-top: 0.2rem; font-weight: 600; }
.cart-total { margin: 0.5rem 0 0 0; font-weight: 700; font-size: 1rem; color: var(--primary-color); }
.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
}
.cart-item-remove:hover { color: #c0392b; }
.cart-drawer-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
.cart-empty-msg { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: var(--text-light); }
.cart-drawer-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.cart-drawer-actions .cart-clear-btn,
.cart-drawer-actions .cart-checkout-btn {
    flex: 1;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 0 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cart-checkout-btn {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border: 2px solid var(--primary-color);
}
.cart-checkout-btn:hover { background: var(--secondary-color); border-color: var(--secondary-color); color: white; }
.cart-checkout-btn.hidden { display: none; }
.cart-clear-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
}
.cart-clear-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(45, 80, 22, 0.06);
}
.cart-clear-btn.hidden { display: none; }

/* Add to cart in plant modal */
/* Shop widget – same structure as other plant detail widgets, placed bottom right */
.shop-widget .shop-widget-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.shop-widget .shop-widget-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}
.shop-widget .shop-widget-stock {
    font-size: 0.9rem;
    font-weight: 600;
}
.shop-widget .shop-widget-stock-ok {
    color: var(--secondary-color);
}
.shop-widget .shop-widget-stock-low {
    color: #d97706;
}
.shop-widget .shop-widget-stock-out {
    color: #b91c1c;
}
.shop-widget .shop-widget-stock-untracked {
    color: var(--text-light);
    font-weight: 500;
}
.shop-widget .info-item-label {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--text-color);
}
.shop-widget .shop-qty-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    max-width: 6rem;
}
.btn-add-to-cart {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
    max-width: 12rem;
}
.btn-add-to-cart:hover { background: var(--secondary-color); }

/* Product reviews & ratings widget (same card as other modal widgets: .modal-section.modal-widget) */
.product-reviews-list {
    margin-bottom: 1rem;
}
.product-reviews-average {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-light);
}
.product-reviews-average-visible .product-reviews-average-value {
    color: #eab308;
    font-weight: 600;
}
.product-reviews-average-count {
    color: var(--text-color);
}
.product-reviews-empty {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
    font-style: italic;
}
.product-review-by {
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 0.25rem 0 !important;
}
.product-review-date {
    margin: 0.25rem 0 0 0 !important;
}
.product-review-item {
    position: relative;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}
.product-review-item-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}
.product-review-delete {
    background: none;
    border: none;
    padding: 0.2rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.product-review-delete:hover {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
}
.product-review-item .product-review-stars {
    margin-bottom: 0.15rem;
}
.product-review-comment-text {
    margin: 0.35rem 0 0 0;
    font-size: 0.95rem;
    line-height: 1.4;
}
.product-review-meta {
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-light);
}
.product-reviews-form label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}
/* Star rating: horizontal, grey by default, colored when filled */
.product-review-stars,
.product-review-stars-display,
.product-review-stars-input {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: nowrap;
}
.product-review-stars .star {
    color: #cbd5e1;
    font-size: 1.25rem;
    line-height: 1;
    transition: color 0.15s ease;
}
.product-review-stars .star.filled {
    color: #eab308;
}
.product-review-stars-input .star {
    background: none;
    border: none;
    padding: 0.2rem;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: #cbd5e1;
    transition: color 0.15s ease, transform 0.1s ease;
}
.product-review-stars-input .star:hover {
    transform: scale(1.1);
}
.product-review-stars-input .star.filled {
    color: #eab308;
}
.product-reviews-form .product-review-comment {
    width: 100%;
    padding: 0.5rem 0.6rem;
    margin-top: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.product-reviews-form .product-review-comment {
    min-height: 72px;
    resize: vertical;
}
.product-review-submit {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}
.product-review-submit:hover { background: var(--secondary-color); }
.product-reviews-login {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
}
.product-reviews-login a { color: var(--primary-color); font-weight: 600; }

@media (max-width: 768px) {
    .logo-text {
        font-size: 1.1rem;
    }
}

/* Smartphone: prevent nav bar overlap – logo in flow, icon-only, hide auth in bar */
@media (max-width: 600px) {
    .main-nav {
        padding: 0 0.5rem 0 0.25rem;
        gap: 0.5rem;
        min-height: var(--main-nav-height);
    }
    .nav-logo {
        position: static;
        left: auto;
        transform: none;
        flex-shrink: 0;
    }
    .nav-logo-spacer {
        flex: 1;
        min-width: 0.5rem;
    }
    .logo-text {
        display: none;
    }
    .nav-cart-wrap {
        margin-left: 0;
    }
    .cart-toggle {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
    .nav-back-btn .nav-back-text {
        display: none;
    }
    .nav-back-btn {
        padding: 0.4rem 0.5rem;
    }
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    width: 100%;
}

header .container {
    padding: 0;
}

header h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

.banner {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-bottom: 4px solid rgba(255, 255, 255, 0.2);
    min-height: 200px;
}

.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7) saturate(1.05);
    display: block;
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem 20px;
    padding-top: calc(65px + 2rem);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    z-index: 1;
}

.banner-overlay h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
    max-width: 100%;
    letter-spacing: 0.02em;
}

.banner-overlay .subtitle {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
    max-width: 100%;
    letter-spacing: 0.05em;
}

main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.controls {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Slim bar: toggle to open Control panel sidebar */
.control-panel-bar {
    width: calc(100% + 2 * var(--container-padding-x, 20px));
    margin-left: calc(-1 * var(--container-padding-x, 20px));
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.control-panel-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 20px;
    min-height: 44px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.control-panel-toggle-btn:hover,
.control-panel-toggle-btn.active {
    background-color: var(--secondary-color);
}

.control-panel-toggle-icon {
    display: inline-flex;
    align-items: center;
}

.control-panel-toggle-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: currentColor;
}

/* Control panel sidebar: compact search */
.control-panel-search {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    min-width: 0;
    max-width: 100%;
}

.control-panel-search-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.control-panel-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.control-panel-search-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-panel-search-btn:hover {
    background-color: var(--secondary-color);
}

.control-panel-search-btn .search-btn-icon-svg {
    width: 1.1rem;
    height: 1.1rem;
    color: currentColor;
}

@media (max-width: 1024px) {
    .control-panel-search {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    .control-panel-search-input {
        flex: 1 1 0%;
        min-width: 0;
        width: 0;
    }
    .control-panel-search-btn {
        flex: 0 0 40px;
        width: 40px;
        min-width: 40px;
        max-width: 40px;
    }
}

/* Control panel sidebar: sort */
.control-panel-sort {
    margin-bottom: 1.25rem;
}

.control-panel-sort-label {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.control-panel-sort-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-panel-sort-select {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--card-bg);
    cursor: pointer;
}

.control-panel-sort-direction {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.control-panel-sort-direction:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.control-panel-sort-direction .sort-icon-svg {
    width: 1.1rem;
    height: 1.1rem;
    color: currentColor;
}

.control-panel-filters-title {
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-group label {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.sort-select {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: white;
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 180px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.sort-direction-btn {
    padding: 10px 14px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.sort-direction-btn:hover {
    background-color: var(--secondary-color);
}

.sort-icon {
    display: inline-flex;
    align-items: center;
}

.sort-icon.hidden {
    display: none;
}

.sort-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
    color: currentColor;
}

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

.filter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 1rem;
    position: relative;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-container label {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.sort-select {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.3s;
    min-width: 180px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.sort-select:hover {
    border-color: var(--accent-color);
}

.sort-direction-btn {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 44px;
    width: 44px;
}

.sort-direction-btn:hover {
    border-color: var(--accent-color);
    background-color: #f0f5ed;
}

.sort-direction-btn.active-desc {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.sort-icon {
    font-size: 1.2rem;
    display: inline-block;
    transition: opacity 0.2s;
    line-height: 1;
}

.advanced-toggle {
    margin-left: auto;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.advanced-toggle:hover {
    background-color: var(--accent-color);
}

/* Advanced Filters Panel */
.advanced-filters {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.advanced-filters.hidden {
    display: none;
}

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

.advanced-filters-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.btn-reset-filters {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-reset-filters:hover {
    background-color: #c82333;
}

.advanced-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
}

.filter-group-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    user-select: none;
    padding-right: 1.25rem;
    position: relative;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    max-width: 100%;
}

.filter-group-label::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    margin-top: -2px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.2s;
}

.filter-group.collapsed .filter-group-label::after {
    transform: translateY(-50%) rotate(-135deg);
}

.filter-group.collapsed .filter-group-label ~ * {
    display: none;
}

.classification-search {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.classification-search:focus {
    outline: none;
    border-color: var(--accent-color);
}

.classification-checkbox-group {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px;
}

.classification-checkbox-group::-webkit-scrollbar {
    width: 8px;
}

.classification-checkbox-group::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.classification-checkbox-group::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.classification-checkbox-group::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.checkbox-label.hidden {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    padding: 4px 0;
    transition: color 0.2s;
    min-width: 0;
    max-width: 100%;
}

.checkbox-label span {
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

.checkbox-label:hover {
    color: var(--accent-color);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.range-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
}

.range-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.range-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.filter-select {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-color);
    color: var(--text-color);
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.range-input-group span {
    color: var(--text-light);
    font-size: 0.9rem;
}

.filter-container label {
    font-weight: 600;
    color: var(--text-color);
}

.filter-btn {
    padding: 8px 16px;
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    color: var(--text-color);
}

.filter-btn:hover {
    border-color: var(--accent-color);
    background-color: #f0f5ed;
}

.filter-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* List view (grid) – hidden when plant panel is shown */
.list-view {
    width: 100%;
}
.main-content.list-view-hidden .list-view {
    display: none;
}

/* Plant detail panel – replaces grid, full-width flow layout, page scroll only */
.plant-detail-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: linear-gradient(180deg, rgba(245, 247, 243, 0.5) 0%, var(--bg-color) 12%);
}
.plant-detail-panel.hidden {
    display: none !important;
}

/* Back button is in main-nav; hide panel header to save space */
.plant-detail-panel:not(.hidden) .plant-panel-header {
    display: none;
}
.plant-panel-header {
    flex-shrink: 0;
    padding: 0.75rem 0 1rem 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
}
.plant-panel-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.plant-panel-back:hover {
    background: var(--secondary-color);
}
.plant-panel-body {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none !important;
    grid-auto-rows: minmax(min-content, auto);
    grid-auto-flow: dense;
    gap: 1rem;
    align-items: start;
    padding: 0.75rem 1rem 3.5rem 1rem;
    box-sizing: border-box;
}
.plant-detail-panel #modalBody {
    height: auto !important;
    max-height: none !important;
    grid-template-rows: none !important;
}
/* In 2-column grid, span-2/3/4 = full row */
.plant-detail-panel .widget-span-2,
.plant-detail-panel .widget-span-3,
.plant-detail-panel .widget-span-4 {
    grid-column: span 2;
}
/* Widget cards: clean, compact cards for 2-col grid */
.plant-detail-panel .modal-section.modal-widget {
    height: auto;
    min-height: 88px;
    overflow: visible;
    overflow-y: visible;
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 1.15rem 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.plant-detail-panel .modal-section.modal-widget:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07), 0 8px 20px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
}
.plant-detail-panel .modal-section.modal-widget:has(.plant-gallery) {
    overflow: visible;
    min-height: 200px;
}
/* Widget headings: section titles only (not plant name/scientific) */
.plant-detail-panel .modal-section.modal-widget > h3:not(.modal-plant-scientific) {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-light);
    margin: 0 0 0.65rem 0;
    padding: 0 0 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
}
.plant-detail-panel .modal-plant-name {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--primary-color);
}
.plant-detail-panel .modal-plant-scientific {
    font-size: 1rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-light);
    margin-top: 0.35rem;
}
.plant-detail-panel .plant-detail-description .description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-color);
    white-space: pre-line;
}
.plant-detail-panel .info-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
}
.plant-detail-panel .info-item {
    background: rgba(245, 247, 243, 0.8);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    border: 1px solid transparent;
}
.plant-detail-panel .info-item-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-light);
}
.plant-detail-panel .plant-badges .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(45, 80, 22, 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(45, 80, 22, 0.12);
}
.plant-detail-panel .requirements-list li {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    line-height: 1.45;
}
.plant-detail-panel .requirements-list li:last-child {
    border-bottom: none;
}
/* Image widget: rounded image area */
.plant-detail-panel .modal-image-widget {
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}
.plant-detail-panel .modal-image-widget .modal-plant-image,
.plant-detail-panel .modal-image-widget .image-placeholder {
    border-radius: 12px;
}
/* Shop widget: clearer price and CTA */
.plant-detail-panel .shop-widget .shop-widget-price {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}
.plant-detail-panel .shop-widget .btn-add-to-cart {
    border-radius: 10px;
    padding: 0.6rem 1.1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(45, 80, 22, 0.2);
    transition: box-shadow 0.2s ease, transform 0.05s ease;
}
.plant-detail-panel .shop-widget .btn-add-to-cart:hover {
    box-shadow: 0 4px 12px rgba(45, 80, 22, 0.25);
}
/* Requirement scales: cleaner track in plant panel */
.plant-detail-panel .requirement-scale-track {
    border-radius: 6px;
    overflow: hidden;
}
.plant-detail-panel .requirement-scale-range {
    border-radius: 6px;
}

/* Shop widget: bottom-right in 2-col grid */
.plant-detail-panel .shop-widget {
    grid-column: 2 !important;
    grid-row: -1 !important;
    align-self: end;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .plant-panel-body {
        max-width: 100%;
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .plant-detail-panel .shop-widget {
        grid-column: 2 !important;
        grid-row: -1 !important;
    }
}
@media (max-width: 767px) {
    .plant-panel-body {
        max-width: 100%;
        grid-template-columns: 1fr !important;
        padding: 0.5rem 0.75rem 3.5rem 0.75rem;
        gap: 0.875rem;
    }
    .plant-detail-panel .widget-span-1,
    .plant-detail-panel .widget-span-2,
    .plant-detail-panel .widget-span-3,
    .plant-detail-panel .widget-span-4 {
        grid-column: span 1;
    }
    .plant-detail-panel .shop-widget {
        grid-column: 1 !important;
        grid-row: -1 !important;
    }
    .plant-detail-panel .modal-section.modal-widget {
        padding: 1.1rem 1.2rem;
    }
}

.equipment-card .plant-scientific.equipment-price {
    color: var(--primary-color);
    font-weight: 600;
}

/* Supply/equipment card labels: smaller font and 2-line clamp to avoid long names stretching cards */
.equipment-card .plant-name {
    font-size: 0.9rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* When modal shows equipment/vivarium detail, use flow layout instead of grid */
.plant-detail-panel #modalBody:has(.equipment-detail-layout) {
    display: block !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    height: auto !important;
    max-height: none !important;
    padding: 1rem 0;
    overflow-y: auto;
}

/* Plant product page: normal product layout (no widget grid) */
.plant-detail-panel #modalBody:has(.plant-product-page) {
    display: block !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    max-width: 100% !important;
    padding: 0 1rem 2rem 1rem;
    overflow-y: visible;
}
.plant-product-page {
    max-width: 820px;
    margin: 0 auto;
}
.plant-product-hero {
    display: grid;
    grid-template-columns: minmax(200px, 380px) 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}
.plant-product-gallery {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-color);
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.plant-product-gallery:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.plant-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.plant-product-image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--text-light);
}
.plant-product-gallery-hint {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
}
.plant-product-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.plant-product-name {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--primary-color);
    margin: 0;
}
.plant-product-scientific {
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text-light);
    margin: 0;
}
.plant-product-common {
    font-size: 0.9rem;
    color: var(--text-color);
    margin: 0;
}
.plant-product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.plant-product-badges .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(45, 80, 22, 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(45, 80, 22, 0.12);
}
.plant-product-enclosure {
    margin-top: 0.25rem;
}
.plant-product-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 0.35rem;
}
.plant-product-shop {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.plant-product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}
.plant-product-stock { font-size: 0.9rem; }
.plant-product-stock-ok { color: var(--secondary-color); }
.plant-product-stock-low { color: #b8860b; }
.plant-product-stock-out { color: #c0392b; }
.plant-product-stock-untracked { color: var(--text-light); }
.plant-product-qty {
    width: 100%;
    max-width: 100px;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}
.plant-product-add-cart {
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    background: var(--primary-color);
    color: #fff;
    border: none;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(45, 80, 22, 0.2);
}
.plant-product-add-cart:hover:not(:disabled) {
    background: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(45, 80, 22, 0.25);
}
.plant-product-add-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.plant-product-definitions-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.plant-product-definitions-link:hover {
    text-decoration: underline;
}
.plant-product-section {
    margin-bottom: 1.75rem;
}
.plant-product-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-light);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}
.plant-product-section .plant-detail-description .description {
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-line;
    color: var(--text-color);
    margin: 0;
}
.plant-product-care-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.plant-product-care-list li {
    margin-bottom: 0.35rem;
}
.plant-content-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.6;
    list-style: disc;
}
.plant-content-list li {
    margin-bottom: 0.35rem;
}
.plant-content-link {
    color: var(--accent-color, #2d7d46);
    text-decoration: none;
}
.plant-content-link:hover {
    text-decoration: underline;
}
.vivarium-supplies-section .vivarium-supplies-intro {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-color);
}
.vivarium-plants-grid,
.vivarium-supplies-grid {
    margin-bottom: 1rem;
}
.vivarium-plant-card.vivarium-content-card {
    text-decoration: none;
    color: inherit;
    display: block;
}
.vivarium-plant-card.vivarium-content-card:hover {
    color: inherit;
}
.vivarium-content-card .card-icons,
.vivarium-content-card .quick-add-wrap {
    display: none !important;
}
.vivarium-supply-card.vivarium-content-card {
    cursor: pointer;
    position: relative;
}
.vivarium-supply-card .vivarium-supply-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 6;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-color, #2d7d46);
}
.btn-add-vivarium-supplies {
    margin-top: 0.25rem;
}
.vivarium-build-contents .vivarium-build-list {
    font-size: 0.9rem;
    line-height: 1.6;
}
.vivarium-build-row {
    margin-bottom: 0.5rem;
}
.vivarium-build-label {
    font-weight: 600;
    color: var(--text-light);
    margin-right: 0.35rem;
}
.vivarium-build-item {
    color: var(--text-color);
}
.vivarium-build-plant-link {
    color: var(--accent-color, #2d7d46);
    text-decoration: none;
}
.vivarium-build-plant-link:hover {
    text-decoration: underline;
}
.plant-product-section-info .info-group {
    margin-bottom: 1rem;
}
.plant-product-section-info .info-group:last-of-type {
    margin-bottom: 0;
}
.plant-product-reviews-section .product-reviews-widget {
    margin-top: 0.25rem;
}
@media (max-width: 767px) {
    .plant-product-hero {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    .plant-product-gallery {
        max-width: 320px;
        margin: 0 auto;
        width: 100%;
    }
    .plant-product-page {
        max-width: 100%;
    }
}

.equipment-detail-layout {
    display: grid;
    grid-template-columns: minmax(220px, 380px) 1fr;
    gap: 2rem;
    align-items: start;
    max-width: 920px;
    margin: 0 auto;
    padding: 0 0.5rem;
}
.equipment-detail-image {
    position: sticky;
    top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.equipment-detail-image img.equipment-main-image {
    width: 100%;
    display: block;
    border-radius: 12px;
    object-fit: contain;
    max-height: 380px;
    background: var(--bg-color);
}
.equipment-detail-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.equipment-placeholder {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: var(--bg-color);
    border-radius: 12px;
}
.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Edit / Image / Hide buttons at top right of detail panel, aligned with item name */
.plant-detail-panel .plant-panel-body {
    position: relative;
}
.detail-actions-fixed {
    position: absolute !important;
    top: 0.75rem;
    right: 1rem;
    margin: 0 !important;
    z-index: 25;
    flex-wrap: nowrap;
    align-items: flex-start;
}
.detail-actions .detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--accent-color);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.detail-actions .detail-btn:hover {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.detail-actions .detail-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.detail-actions .detail-btn span {
    white-space: nowrap;
}

.equipment-detail-name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
}
.equipment-detail-description {
    margin: 0;
    line-height: 1.65;
    color: var(--text-light);
    font-size: 0.95rem;
}
.equipment-detail-content .equipment-shop-widget {
    margin-top: 0.5rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.equipment-detail-content .equipment-shop-widget h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}
.equipment-detail-content .equipment-shop-widget .shop-widget-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
@media (max-width: 767px) {
    .equipment-detail-layout {
        grid-template-columns: 1fr;
        padding: 0;
    }
    .equipment-detail-image { position: static; }
}

.stats {
    margin-bottom: 1.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats-card-size {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.card-size-btn {
    padding: 6px 12px;
    border: none;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.card-size-btn:hover {
    background: var(--border-color);
}

.card-size-btn.active {
    background: var(--accent-color);
    color: white;
}

.stats-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-sort-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
    white-space: nowrap;
}

.stats-sort-select {
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    min-width: 0;
}

.stats-sort-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.stats-sort-direction {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.stats-sort-direction:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.stats-sort-direction .sort-icon-svg {
    width: 1rem;
    height: 1rem;
    color: currentColor;
}

.shop-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}
.shop-tab {
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    bottom: -2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.shop-tab:hover {
    color: var(--text-color);
}
.shop-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.plants-grid {
    display: grid;
    margin-bottom: 1rem;
    width: 100%;
}

/* Card size: large (default), medium, small */
.plants-grid.card-size-large {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.plants-grid.card-size-medium {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.plants-grid.card-size-small {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

/* Medium cards: tighter padding and smaller type */
.plants-grid.card-size-medium .plant-info {
    padding: 0.5rem 0.75rem;
}
.plants-grid.card-size-medium .plant-name {
    font-size: 1.1rem;
}
.plants-grid.card-size-medium .plant-scientific {
    font-size: 0.8rem;
}
.plants-grid.card-size-medium .plant-badges {
    gap: 6px;
    margin-bottom: 0.5rem;
}
.plants-grid.card-size-medium .badge {
    padding: 3px 8px;
    font-size: 0.65rem;
}
.plants-grid.card-size-medium .plant-card-icons,
.plants-grid.card-size-medium .card-icons {
    top: 10px;
    right: 10px;
    gap: 6px;
}
.plants-grid.card-size-medium .image-edit-icon,
.plants-grid.card-size-medium .plant-image-icon,
.plants-grid.card-size-medium .card-edit-icon,
.plants-grid.card-size-medium .card-image-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
}
.plants-grid.card-size-medium .image-edit-icon svg,
.plants-grid.card-size-medium .plant-image-icon svg,
.plants-grid.card-size-medium .card-edit-icon svg,
.plants-grid.card-size-medium .card-image-icon svg {
    width: 16px;
    height: 16px;
}
.plants-grid.card-size-medium .care-card-icon {
    top: 90px;
    right: 10px;
    width: 34px;
    height: 34px;
}
.plants-grid.card-size-medium .care-card-icon svg {
    width: 16px;
    height: 16px;
}

/* Small cards */
.plants-grid.card-size-small .plant-info {
    padding: 0.4rem 0.6rem;
}
.plants-grid.card-size-small .plant-name {
    font-size: 0.95rem;
}
.plants-grid.card-size-small .plant-scientific {
    font-size: 0.75rem;
}
.plants-grid.card-size-small .plant-badges {
    gap: 4px;
    margin-bottom: 0.35rem;
}
.plants-grid.card-size-small .badge {
    padding: 2px 6px;
    font-size: 0.6rem;
}
.plants-grid.card-size-small .plant-card-icons,
.plants-grid.card-size-small .card-icons {
    top: 6px;
    right: 6px;
    gap: 4px;
}
.plants-grid.card-size-small .image-edit-icon,
.plants-grid.card-size-small .plant-image-icon,
.plants-grid.card-size-small .card-edit-icon,
.plants-grid.card-size-small .card-image-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
}
.plants-grid.card-size-small .image-edit-icon svg,
.plants-grid.card-size-small .plant-image-icon svg,
.plants-grid.card-size-small .card-edit-icon svg,
.plants-grid.card-size-small .card-image-icon svg {
    width: 14px;
    height: 14px;
}
.plants-grid.card-size-small .care-card-icon {
    top: 68px;
    right: 6px;
    width: 28px;
    height: 28px;
}
.plants-grid.card-size-small .care-card-icon svg {
    width: 14px;
    height: 14px;
}

.plants-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 0 2rem;
}
.plants-pagination .pagination-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.plants-pagination .pagination-per-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pagination-per-page-label {
    font-size: 0.95rem;
    color: var(--text-light);
}
.pagination-per-page-select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    cursor: pointer;
}
.pagination-per-page-select:hover,
.pagination-per-page-select:focus {
    border-color: var(--accent-color);
    outline: none;
}
.plants-pagination.hidden {
    display: none;
}
.pagination-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.pagination-btn:hover:not(:disabled) {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
}
.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pagination-info {
    font-size: 0.95rem;
    color: var(--text-light);
}

.plant-card {
    position: relative;
    z-index: 0;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s, z-index 0s;
    cursor: pointer;
    border: 2px solid transparent;
}

/* Hidden products (for staff view only) */
.plant-card.product-hidden {
    opacity: 0.45;
    filter: grayscale(0.6);
    box-shadow: none;
    border-style: dashed;
}
.plant-card.product-hidden .card-price,
.plant-card.product-hidden .plant-name {
    text-decoration: line-through;
}
.plant-card.product-hidden::after {
    content: 'Hidden';
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(15, 23, 42, 0.85);
    color: #f9fafb;
}

/* Price badge: bottom-left of image container, scales with card size */
.plant-image-container .card-price {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 8px 0 0;
    box-shadow: 2px -2px 6px rgba(0, 0, 0, 0.08);
    z-index: 5;
}

.plants-grid.card-size-medium .plant-image-container .card-price {
    padding: 0.28rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0 6px 0 0;
}

.plants-grid.card-size-small .plant-image-container .card-price {
    padding: 0.22rem 0.4rem;
    font-size: 0.65rem;
    border-radius: 0 4px 0 0;
}

/* Quick-add (cart) button scales with card size */
.plants-grid.card-size-medium .quick-add-wrap {
    bottom: 8px;
    right: 8px;
}
.plants-grid.card-size-medium .quick-add-btn {
    padding: 0.32rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.28rem;
}
.plants-grid.card-size-medium .quick-add-icon .cart-icon-svg {
    width: 1rem;
    height: 1rem;
}
.plants-grid.card-size-medium .quick-add-btn:hover .quick-add-label {
    max-width: 4.5rem;
}
.plants-grid.card-size-medium .quick-add-expanded {
    border-radius: 8px;
}
.plants-grid.card-size-medium .quick-add-qty {
    width: 2rem;
    padding: 0.28rem 0.2rem;
    font-size: 0.8rem;
}
.plants-grid.card-size-medium .quick-add-stepper {
    width: 20px;
}
.plants-grid.card-size-medium .quick-add-stepper .quick-add-plus,
.plants-grid.card-size-medium .quick-add-stepper .quick-add-minus {
    min-height: 14px;
    font-size: 0.85rem;
}
.plants-grid.card-size-medium .quick-add-confirm {
    padding: 0.32rem 0.5rem;
    font-size: 0.7rem;
}

.plants-grid.card-size-small .quick-add-wrap {
    bottom: 6px;
    right: 6px;
}
.plants-grid.card-size-small .quick-add-btn {
    padding: 0.26rem 0.4rem;
    font-size: 0.65rem;
    gap: 0.22rem;
}
.plants-grid.card-size-small .quick-add-icon .cart-icon-svg {
    width: 0.85rem;
    height: 0.85rem;
}
.plants-grid.card-size-small .quick-add-btn:hover .quick-add-label {
    max-width: 3.5rem;
}
.plants-grid.card-size-small .quick-add-expanded {
    border-radius: 6px;
}
.plants-grid.card-size-small .quick-add-qty {
    width: 1.75rem;
    padding: 0.22rem 0.15rem;
    font-size: 0.7rem;
}
.plants-grid.card-size-small .quick-add-stepper {
    width: 18px;
}
.plants-grid.card-size-small .quick-add-stepper .quick-add-plus,
.plants-grid.card-size-small .quick-add-stepper .quick-add-minus {
    min-height: 12px;
    font-size: 0.75rem;
}
.plants-grid.card-size-small .quick-add-confirm {
    padding: 0.26rem 0.4rem;
    font-size: 0.65rem;
}

.plant-card:hover {
    z-index: 10;
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* Hybrid plant card - animated border */
.plant-card.hybrid-plant {
    position: relative;
    border: 2px solid #9370DB;
    animation: hybrid-border-pulse 2s ease-in-out infinite;
}

.plant-card.hybrid-plant::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 12px;
    padding: 2px;
    background: linear-gradient(45deg, #9370DB, #6A5ACD, #8B7EC8, #B19CD9, #9370DB, #6A5ACD);
    background-size: 400% 400%;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: -1;
    animation: hybrid-border-rotate 4s linear infinite;
}

@keyframes hybrid-border-pulse {
    0%, 100% {
        border-color: #9370DB;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(147, 112, 219, 0.4);
    }
    50% {
        border-color: #8B7EC8;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 4px rgba(147, 112, 219, 0.3);
    }
}

@keyframes hybrid-border-rotate {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 400% 50%;
    }
}

/* Carnivorous plant card */
.plant-card.carnivorous-plant {
    display: flex;
    flex-direction: column;
}

.plant-card.carnivorous-plant .plant-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.plant-card.carnivorous-plant .plant-badges {
    margin-bottom: 0;
    margin-top: auto;
}

/* Aquatic plant card - blue themed */
.plant-card.aquatic-plant {
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, rgba(240, 248, 255, 0.6), rgba(230, 240, 250, 0.8));
    border: 2px solid rgba(135, 206, 235, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(135, 206, 235, 0.2);
}

.plant-card.aquatic-plant:hover {
    border-color: rgba(135, 206, 235, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(135, 206, 235, 0.3);
}

.plant-card.aquatic-plant .plant-image-container {
    background: linear-gradient(135deg, #e0f2f7 0%, #c8e8f0 100%);
}

.plant-card.aquatic-plant .plant-info {
    background: linear-gradient(to bottom, rgba(135, 206, 235, 0.1), rgba(135, 206, 235, 0.15));
    border-top: 1px solid rgba(135, 206, 235, 0.3);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.plant-card.aquatic-plant .plant-badges {
    margin-bottom: 0;
    margin-top: auto;
}

.plant-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    position: relative;
}

/* Quick add to cart – bottom right of card image, morphable */
.quick-add-wrap {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
}
.quick-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 999px;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.quick-add-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.quick-add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.quick-add-btn-maxed {
    opacity: 0.5;
    filter: grayscale(0.8);
}
.quick-add-btn-maxed:hover {
    opacity: 0.7;
    filter: grayscale(0.6);
}
.quick-add-icon {
    display: inline-flex;
    align-items: center;
}

.quick-add-icon .cart-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
    color: currentColor;
}
.quick-add-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width 0.2s ease, opacity 0.2s ease;
}
.quick-add-btn:hover .quick-add-label {
    max-width: 6rem;
    opacity: 1;
}
.quick-add-btn.hidden {
    display: none;
}
.quick-add-expanded {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.quick-add-expanded.hidden {
    display: none;
}
.quick-add-expanded-row {
    display: flex;
    align-items: stretch;
}
.quick-add-qty {
    width: 2.5rem;
    padding: 0.35rem 0.25rem;
    border: none;
    border-right: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    background: var(--card-bg);
    color: var(--text-color);
    appearance: textfield;
    -moz-appearance: textfield;
}
.quick-add-qty::-webkit-outer-spin-button,
.quick-add-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.quick-add-stepper {
    display: flex;
    flex-direction: column;
    width: 24px;
}
.quick-add-stepper .quick-add-plus,
.quick-add-stepper .quick-add-minus {
    flex: 1;
    min-height: 18px;
    padding: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.quick-add-stepper .quick-add-minus {
    border-bottom: none;
}
.quick-add-stepper .quick-add-plus:hover,
.quick-add-stepper .quick-add-minus:hover {
    background: var(--accent-color);
    color: white;
}
.quick-add-confirm {
    padding: 0.4rem 0.6rem;
    border: none;
    border-left: 1px solid var(--border-color);
    background: var(--accent-color);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.quick-add-confirm:hover {
    background: var(--secondary-color);
    color: white;
}
.quick-add-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.quick-add-qty:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Show quick-add only on card hover (same as edit and care-card icons) */
.plant-card .quick-add-wrap {
    opacity: 0;
    pointer-events: none;
}
.plant-card:hover .quick-add-wrap,
.plant-image-container:hover .quick-add-wrap {
    opacity: 0.9;
    pointer-events: auto;
}
.quick-add-wrap:hover {
    opacity: 1 !important;
}

/* Popup bubble toast for quick-add messages (e.g. Max stock reached) */
.quick-add-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    padding: 0.6rem 1.2rem;
    background: var(--text-color);
    color: var(--card-bg);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 10000;
    pointer-events: none;
}
.quick-add-toast.quick-add-toast-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Shared Edit / Image buttons across Plants, Equipment, Vivariums */
.card-icons {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.card-icons .card-edit-icon,
.card-icons .card-image-icon {
    position: static;
    top: auto;
    right: auto;
    padding: 0;
    margin: 0;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.card-icons .card-edit-icon svg,
.card-icons .card-image-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
    pointer-events: none;
}
.plant-card .card-icons .card-edit-icon,
.plant-card .card-icons .card-image-icon,
.equipment-card .card-icons .card-edit-icon,
.equipment-card .card-icons .card-image-icon,
.vivarium-card .card-icons .card-edit-icon,
.vivarium-card .card-icons .card-image-icon {
    opacity: 0;
}
.plant-card:hover .card-icons .card-edit-icon,
.plant-card:hover .card-icons .card-image-icon,
.plant-image-container:hover .card-icons .card-edit-icon,
.plant-image-container:hover .card-icons .card-image-icon,
.equipment-card:hover .card-icons .card-edit-icon,
.equipment-card:hover .card-icons .card-image-icon,
.equipment-card .plant-image-container:hover .card-icons .card-edit-icon,
.equipment-card .plant-image-container:hover .card-icons .card-image-icon,
.vivarium-card:hover .card-icons .card-edit-icon,
.vivarium-card:hover .card-icons .card-image-icon,
.vivarium-card .plant-image-container:hover .card-icons .card-edit-icon,
.vivarium-card .plant-image-container:hover .card-icons .card-image-icon {
    opacity: 0.9;
}
.card-edit-icon:hover,
.card-image-icon:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.plant-card-icons {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.plant-card-icons .image-edit-icon,
.plant-card-icons .plant-image-icon {
    position: static;
    top: auto;
    right: auto;
}
.image-edit-icon,
.plant-image-icon {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.plant-card .image-edit-icon,
.plant-card .plant-image-icon {
    opacity: 0;
    pointer-events: none;
}

.plant-card:hover .image-edit-icon,
.plant-image-container:hover .image-edit-icon,
.plant-card:hover .plant-image-icon,
.plant-image-container:hover .plant-image-icon {
    opacity: 0.9;
    pointer-events: auto;
}

.image-edit-icon:hover,
.plant-image-icon:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.image-edit-icon svg,
.plant-image-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
}
.care-card-icon {
    position: absolute;
    top: 112px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.plant-card .care-card-icon {
    opacity: 0;
    pointer-events: none;
}

.plant-card:hover .care-card-icon,
.plant-image-container:hover .care-card-icon {
    opacity: 0.9;
    pointer-events: auto;
}

.care-card-icon:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.care-card-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
}

/* Shoppers: hide all edit buttons and image management (owner/admin only) */
body.shopper-mode .card-edit-icon,
body.shopper-mode .image-edit-icon,
body.shopper-mode .plant-image-icon,
body.shopper-mode .equipment-edit-icon,
body.shopper-mode .equipment-image-icon,
body.shopper-mode .card-image-icon,
body.shopper-mode .plant-detail-edit,
body.shopper-mode .plant-detail-image,
body.shopper-mode .vivarium-detail-edit,
body.shopper-mode .detail-actions-fixed .card-edit-icon,
body.shopper-mode .delete-image-btn,
body.shopper-mode .gallery-set-main-btn {
    display: none !important;
}

/* Equipment/Vivarium use shared .card-icons .card-edit-icon .card-image-icon; keep legacy class names for JS */
.equipment-card-icons,
.equipment-card .card-icons {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.equipment-edit-icon,
.equipment-image-icon {
    /* Legacy: same as .card-edit-icon / .card-image-icon when used without .card-icons */
    padding: 0;
    margin: 0;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.equipment-edit-icon svg,
.equipment-image-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
    pointer-events: none;
}

.plant-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    max-width: 100%;
    display: block;
}

.plant-card:hover .plant-image {
    transform: scale(1.05);
}

.plant-image-container:hover .plant-image {
    transform: scale(1.05);
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-light);
}

/* "Loading..." text shown while images are fetching */
.plant-image-container::before,
.plant-product-gallery::before {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-style: italic;
    color: rgba(100, 120, 100, 0.7);
    pointer-events: none;
    z-index: 0;
}
[data-theme="dark"] .plant-image-container::before,
[data-theme="dark"] .plant-product-gallery::before {
    color: rgba(180, 200, 180, 0.5);
}
/* Hide "Loading..." once the real image or placeholder is visible */
.plant-image-container:has(.plant-image)::before,
.plant-image-container:has(.image-placeholder)::before,
.plant-product-gallery:has(.plant-product-image)::before,
.plant-product-gallery:has(.plant-product-image-placeholder)::before {
    display: none;
}

/* Gallery preview & fullscreen loading overlay */
.gallery-img-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-style: italic;
    color: rgba(200, 200, 200, 0.7);
    pointer-events: none;
    z-index: 1;
}
.gallery-img-loading.hidden { display: none; }

.image-placeholder .placeholder-icon-svg {
    width: 4rem;
    height: 4rem;
    color: currentColor;
}

.plant-info {
    padding: 0.75rem 1rem;
}

.plant-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.plant-scientific {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.card-rating {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.35rem;
}
.card-rating.card-rating-visible {
    color: #eab308;
    font-weight: 600;
}

.plant-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.terrarium,
.badge.open-terrarium {
    background-color: #d4ed6e !important;
    color: #5a6e2f !important;
}

.badge.closed-terrarium {
    background-color: #6b8e23 !important; /* moss green */
    color: #ffffff !important;
}

.badge.paludarium {
    background-color: #1b4332 !important;
    color: #d1f4e0 !important;
}

.badge.desertarium {
    background-color: #e6d5b8 !important;
    color: #8b6914 !important;
}

/* Alias for data using 'Deserterium' spelling */
.badge.deserterium {
    background-color: #e6d5b8 !important;
    color: #8b6914 !important;
}

.badge.aerarium {
    background-color: #b3d9ff !important;
    color: #1e4d72 !important;
}

/* Alias for data using 'Aererium' spelling */
.badge.aererium {
    background-color: #b3d9ff !important;
    color: #1e4d72 !important;
}

.badge.aquarium {
    background-color: #1a4d7a !important;
    color: #b8d4f0 !important;
}

/* Riparium: water's edge - teal/cyan suggesting riverbanks and stream edges */
.badge.riparium {
    background-color: #0d9488 !important; /* teal/cyan - water meeting land */
    color: #ccfbf1 !important;            /* light cyan */
}

.badge.indoor,
.badge.house-plant {
    background-color: #c94a4a !important; /* red brick/terracotta roof - typical house color */
    color: #ffffff !important;             /* white text for good contrast */
}

.badge.outdoor {
    background-color: #8b6914 !important; /* earthy brown/gold - outdoor/natural color */
    color: #ffffff !important;              /* white text for good contrast */
}

.badge.vivarium {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
}

.badge.hybrid {
    background: linear-gradient(135deg, #9370DB, #6A5ACD, #8B7EC8) !important;
    color: #fff !important;
}

.badge.carnivorous {
    background: linear-gradient(135deg, #efd700, #ff8001, #ff3700) !important;
    color: #fff !important;
}

.badge.aquatic {
    background: linear-gradient(135deg, #87CEEB, #5F9EA0, #16439d) !important;
    color: #fff !important;
}

.plant-quick-info {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-row {
    display: flex;
    gap: 8px;
}

.info-label {
    font-weight: 600;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

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

.modal-content {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    width: calc(100vw - 10vh);
    max-width: calc(100vw - 10vh);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    box-sizing: border-box;
}

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

/* Modal body widget grid layout */
/* Grid automatically accounts for gaps when using fr units */
/* Available width = modal-content width (100vw - 10vh) - modal-content padding (2rem each side = 4rem total) */
/* Available height = modal-content height (90vh) - modal-content padding (2rem top + 2rem bottom = 4rem) */
/* Grid columns: 4 equal columns | Grid rows: 4 equal rows */
/* Rows and columns distribute space proportionally */
#modalBody {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: repeat(4, 1fr);
    grid-auto-flow: dense;
    gap: 1rem;
    align-items: stretch;
    width: 100%;
    height: calc(90vh - 4rem);
    box-sizing: border-box;
}

/* Widgets should fill their grid cells */
.modal-section.modal-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Convert sections to widgets */
.modal-section {
    grid-column: span 1;
    grid-row: span 1;
}

/* Ensure all modal sections that are widgets get widget styling */
.modal-section.modal-widget {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    align-self: stretch;
    box-sizing: border-box;
    width: 100%;
}

.modal-section.modal-widget:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Widgets with galleries need special overflow handling */
.modal-section.modal-widget:has(.plant-gallery) {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Widget size classes - width */
.widget-span-1 { grid-column: span 1; }
.widget-span-2 { grid-column: span 2; }
.widget-span-3 { grid-column: span 3; }
.widget-span-4 { grid-column: span 4; }

/* Widget size classes - height */
.widget-row-1 { grid-row: span 1; }
.widget-row-2 { grid-row: span 2; }
.widget-row-3 { grid-row: span 3; }
.widget-row-4 { grid-row: span 4; }

/* Full-width widgets */
.modal-section-full {
    grid-column: 1 / -1;
}

/* Image widget click hint */
.modal-image-widget:hover .image-gallery-hint {
    background: rgba(0,0,0,0.9);
}

/* Gallery preview image - fit largest dimension */
.gallery-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
}

/* Gallery thumbnail selection highlight */
.gallery-thumbnail.selected {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
}

.gallery-thumbnail {
    transition: outline 0.2s ease;
}

/* Set as Main button on large preview */
.gallery-set-main-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.gallery-set-main-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Equipment/vivarium gallery: no "Set as main" */
.gallery-no-set-main .gallery-set-main-btn {
    display: none;
}

/* Modal Pages */
.modal-page {
    display: contents;
}

.modal-page[style*="display: none"] {
    display: none !important;
}
.plant-detail-panel #modal-page-2.active {
    display: block !important;
    max-width: 900px;
    margin: 0 auto;
}

/* Modern gallery */
.plant-gallery-modern {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
}
.plant-gallery-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}
.plant-gallery-header-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}
.plant-gallery-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
}
.plant-gallery-item-name {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.25;
    color: var(--text-color);
    letter-spacing: -0.02em;
}
.plant-gallery-scientific-name {
    font-size: 0.95rem;
    font-style: italic;
    margin: 0;
    color: var(--text-light);
    font-weight: 500;
}
.plant-gallery-back {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.plant-gallery-back:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.plant-gallery-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}
.plant-gallery-count {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: auto;
}
.plant-gallery-stage {
    position: relative;
    background: #1a1a1a;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.plant-gallery-stage-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: 320px;
}
.plant-gallery-stage .gallery-preview-image {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.plant-gallery-placeholder {
    font-size: 5rem;
    color: rgba(255,255,255,0.3);
}
.plant-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: #1a1a1a;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.plant-gallery-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}
.plant-gallery-prev { left: 1rem; }
.plant-gallery-next { right: 1rem; }
.plant-gallery-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}
.plant-gallery-set-main {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    margin: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}
.plant-gallery-thumbnails-wrap {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
}
.plant-gallery-thumbnails {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 72px;
}
.plant-gallery-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    background: var(--bg-color);
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.plant-gallery-thumb:hover {
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.plant-gallery-thumb.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}
.plant-gallery-thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
.plant-gallery-thumb-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.plant-gallery-thumb-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.65rem;
    z-index: 2;
}
.plant-gallery-thumb-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(211, 47, 47, 0.95);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.plant-gallery-thumb:hover .plant-gallery-thumb-delete {
    opacity: 1;
}
.plant-gallery-empty-message {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-light);
}
.plant-gallery-empty-message p { margin: 0.5rem 0; }

/* Fullscreen button on stage */
.plant-gallery-fullscreen-btn {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.95);
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    z-index: 5;
    transition: background 0.2s, color 0.2s;
}
.plant-gallery-fullscreen-btn:hover {
    background: rgba(255,255,255,0.95);
    color: #1a1a1a;
}

/* Fullscreen overlay */
.gallery-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.gallery-fullscreen-overlay.gallery-fullscreen-open {
    opacity: 1;
    visibility: visible;
}
.gallery-fullscreen-overlay .gallery-fullscreen-image {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
.gallery-fullscreen-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.gallery-fullscreen-close:hover {
    background: rgba(255,255,255,0.25);
}
.gallery-fullscreen-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 2.25rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.gallery-fullscreen-arrow:hover {
    background: rgba(255,255,255,0.3);
}
.gallery-fullscreen-prev { left: 1.5rem; }
.gallery-fullscreen-next { right: 1.5rem; }
.gallery-fullscreen-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
}
@media (max-width: 767px) {
    .plant-gallery-stage-inner { min-height: 260px; }
    .plant-gallery-arrow { width: 40px; height: 40px; font-size: 1.5rem; }
    .plant-gallery-prev { left: 0.5rem; }
    .plant-gallery-next { right: 0.5rem; }
    .plant-gallery-thumb { width: 56px; height: 56px; }
}

/* Responsive widget grid layout */
/* Default: 4 columns - this is the base layout */
/* Only override for smaller screens */

/* Ensure 4 columns for all screens 768px and wider by default */
@media (min-width: 768px) {
    .modal-content {
        width: calc(100vw - 10vh);
        max-width: calc(100vw - 10vh);
    }
    
    #modalBody {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: repeat(4, 1fr);
        grid-auto-flow: dense;
        gap: 1rem;
        align-items: stretch;
        width: 100%;
        height: calc(90vh - 4rem);
        box-sizing: border-box;
    }
    
    .widget-span-1 { grid-column: span 1; }
    .widget-span-2 { grid-column: span 2; }
    .widget-span-3 { grid-column: span 3; }
    .widget-span-4 { grid-column: span 4; }
}

/* 2 columns for tablets - this overrides the above for narrow screens */
@media (min-width: 768px) and (max-width: 1023px) {
    #modalBody {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(4, 1fr);
        height: calc(95vh - 3rem);
    }
    
    .widget-span-3 { grid-column: span 2; } /* Max 2 columns */
    .widget-span-4 { grid-column: span 2; } /* Max 2 columns */
}

@media (max-width: 767px) {
    .modal-content {
        width: calc(100vw - 10vh);
        max-width: calc(100vw - 10vh);
    }
    
    #modalBody {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
        grid-auto-flow: dense;
        gap: 0.75rem;
        align-items: stretch;
        width: 100%;
        height: calc(95vh - 1.5rem);
        box-sizing: border-box;
    }
    
    .widget-span-1,
    .widget-span-2,
    .widget-span-3,
    .widget-span-4 {
        grid-column: span 1; /* All widgets full width on mobile */
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 0;
    color: white;
    cursor: pointer;
    transition: color 0.3s, background-color 0.3s;
    z-index: 1001;
    background-color: #d32f2f;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 0;
    margin: 0;
    font-family: Arial, sans-serif;
}

.close::after {
    content: '×';
    font-size: 2rem;
    font-weight: bold;
    display: block;
    line-height: 1;
    color: white;
}

.close:hover {
    background-color: #b71c1c;
}

.close:hover::after {
    color: white;
}

.modal-plant-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* Image widget styling */
.modal-image-widget {
    padding: 0 !important;
    min-height: 300px;
    display: flex;
    align-items: stretch;
}

.modal-image-widget > div:first-child {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: stretch;
}

.modal-image-container {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
}

.modal-plant-name {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.modal-plant-scientific {
    font-size: 1.1rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 0;
    line-height: 1.3;
}

.modal-section {
    margin-bottom: 0;
}

/* Widget content styling */
.modal-widget h3 {
    color: var(--secondary-color);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
}

.modal-widget h4 {
    color: var(--secondary-color);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.modal-widget p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    font-size: 0.9rem;
    text-align: justify;
}

.modal-widget ul {
    margin: 0;
    padding-left: 1.25rem;
}

.modal-widget li {
    margin-bottom: 0.4rem;
    line-height: 1.4;
    font-size: 0.9rem;
}

.modal-section h3 {
    color: var(--secondary-color);
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.info-item {
    background: var(--bg-color);
    padding: 0.5rem;
    border-radius: 6px;
}

.info-item-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
    text-transform: uppercase;
}

/* Info Group Styles */
.info-group {
    margin-bottom: 0.75rem;
}

.info-group:last-child {
    margin-bottom: 0;
}

.info-group-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* Submerged Details - Subtle aquatic accent, coherent with design */
.info-group.submerged-details .info-group-title {
    color: rgba(14, 165, 233, 0.8); /* Aquatic blue, but muted */
    border-bottom-color: rgba(14, 165, 233, 0.2);
}

.info-group.submerged-details .info-item {
    background: var(--bg-color); /* Same as other sections */
}

.info-group.submerged-details .info-item-label {
    color: var(--text-light); /* Same as other sections */
}

.info-group.submerged-details .info-item-value {
    color: var(--text-color); /* Same as other sections */
}

/* Blue background for requirement scales in submerged details */
.info-group.submerged-details .requirement-scale-track {
    background: linear-gradient(to right,
        rgba(219, 234, 254, 0.8) 0%,
        rgba(191, 219, 254, 0.9) 25%,
        rgba(147, 197, 253, 0.9) 50%,
        rgba(191, 219, 254, 0.9) 75%,
        rgba(219, 234, 254, 0.8) 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.info-group.submerged-details .requirement-scale-range {
    background: linear-gradient(to right,
        rgba(14, 165, 233, 0.6) 0%,
        rgba(6, 182, 212, 0.7) 50%,
        rgba(14, 165, 233, 0.6) 100%);
}

.info-group.submerged-details .requirement-scale-ideal {
    background: rgba(14, 165, 233, 0.9);
    box-shadow: 0 0 4px rgba(14, 165, 233, 0.3);
}

.info-group.submerged-details .requirement-scale-ideal-label {
    color: rgba(14, 165, 233, 0.9);
}

/* Requirement Scale Styles */
.requirement-scale-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.requirement-description {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: normal;
    font-style: italic;
    margin-top: 0.25rem;
}

.requirement-scale-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.requirement-scale-track {
    position: relative;
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, 
        #e8f5e9 0%, 
        #c8e6c9 25%, 
        #a5d6a7 50%, 
        #81c784 75%, 
        #66bb6a 100%);
    border-radius: 4px;
    overflow: visible;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.requirement-scale-tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 8px;
    background: rgba(0, 0, 0, 0.2);
    transform: translateX(-50%);
    z-index: 1;
}

.requirement-scale-range {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(to right, 
        rgba(45, 80, 22, 0.3) 0%, 
        rgba(74, 124, 42, 0.5) 50%, 
        rgba(45, 80, 22, 0.3) 100%);
    border-radius: 4px;
    border: 1px solid rgba(45, 80, 22, 0.4);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.requirement-scale-ideal {
    position: absolute;
    top: -2px;
    width: 3px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(45, 80, 22, 0.6);
    transform: translateX(-50%);
    z-index: 2;
}

.requirement-scale-ideal-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    z-index: 3;
}

.requirement-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.1rem;
}

.requirement-scale-value {
    font-weight: 600;
    color: var(--text-color);
}

.requirement-text {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-top: 0.25rem;
}

/* Enclosure Size Scale Styles */
.enclosure-size-scale {
    margin-top: 0.5rem;
}

.enclosure-size-track {
    position: relative;
    width: 100%;
    height: 35px;
    background: #e8f5e9;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
}

.enclosure-size-segment {
    position: relative;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.3rem 0.15rem;
    transition: all 0.2s ease;
    min-width: 0;
}

.enclosure-size-segment:last-child {
    border-right: none;
}

.enclosure-size-segment.minimum {
    background: linear-gradient(135deg, 
        rgba(45, 80, 22, 0.15) 0%, 
        rgba(74, 124, 42, 0.25) 50%,
        rgba(45, 80, 22, 0.15) 100%);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        0 0 0 2px rgba(45, 80, 22, 0.3),
        0 2px 8px rgba(45, 80, 22, 0.2);
    border-left: none;
    border-right: none;
    position: relative;
    z-index: 2;
    animation: pulseEnclosure 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.enclosure-size-segment.minimum::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(45, 80, 22, 0.1) 0%, 
        transparent 50%,
        rgba(74, 124, 42, 0.1) 100%);
    pointer-events: none;
}

@keyframes pulseEnclosure {
    0%, 100% {
        background: linear-gradient(135deg, 
            rgba(45, 80, 22, 0.15) 0%, 
            rgba(74, 124, 42, 0.25) 50%,
            rgba(45, 80, 22, 0.15) 100%);
        box-shadow: 
            inset 0 1px 2px rgba(255, 255, 255, 0.3),
            0 0 0 2px rgba(45, 80, 22, 0.3),
            0 2px 8px rgba(45, 80, 22, 0.2);
    }
    50% {
        background: linear-gradient(135deg, 
            rgba(45, 80, 22, 0.25) 0%, 
            rgba(74, 124, 42, 0.35) 50%,
            rgba(45, 80, 22, 0.25) 100%);
        box-shadow: 
            inset 0 1px 2px rgba(255, 255, 255, 0.4),
            0 0 0 2px rgba(45, 80, 22, 0.5),
            0 4px 12px rgba(45, 80, 22, 0.3);
    }
}


.enclosure-size-label {
    font-weight: 600;
    font-size: 0.65rem;
    color: var(--text-color);
    text-transform: uppercase;
    margin-bottom: 0.05rem;
    line-height: 1.1;
}

.enclosure-size-segment.minimum .enclosure-size-label {
    color: var(--primary-color);
    font-weight: 700;
}

.enclosure-size-height {
    font-size: 0.6rem;
    color: var(--text-light);
    font-weight: 500;
    line-height: 1.1;
}

.enclosure-size-segment.minimum .enclosure-size-height {
    color: var(--text-color);
    font-weight: 600;
}


/* Safety Information Styles */
.safety-section {
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
}

.safety-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.safety-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
}

.safety-item.warning {
    border-color: #ff9800;
    background: #fff3e0;
}

.safety-item.safe {
    border-color: #4caf50;
    background: #f1f8e9;
}

.safety-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.safety-icon {
    font-size: 1.2rem;
}

.safety-value {
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Additional Information Styles */
.additional-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.additional-info-item {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
}

.additional-info-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.additional-info-value {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Taxonomy Styles - Hierarchical Display */
.taxonomy-hierarchy {
    margin-top: 0.25rem;
    background: var(--bg-color);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-y: auto;
}

.taxonomy-level {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.2rem 0;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.taxonomy-level[data-level="0"] {
    border-left-color: var(--primary-color);
    font-weight: 600;
    padding-left: 0.5rem !important;
}

.taxonomy-level[data-level="1"] {
    border-left-color: var(--secondary-color);
    opacity: 0.95;
}

.taxonomy-level[data-level="2"] {
    border-left-color: var(--accent-color);
    opacity: 0.9;
}

.taxonomy-level[data-level="3"] {
    border-left-color: #a8d08f;
    opacity: 0.85;
}

.taxonomy-level[data-level="4"] {
    border-left-color: #c5e1a5;
    opacity: 0.8;
}

.taxonomy-level:hover {
    background: rgba(45, 80, 22, 0.05);
    border-radius: 4px;
}

.taxonomy-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: capitalize;
    min-width: 80px;
    flex-shrink: 0;
}

.taxonomy-value {
    color: var(--text-color);
    font-size: 0.95rem;
    font-style: italic;
    font-family: 'Georgia', serif;
    flex-grow: 1;
}

.special-notes {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    border-radius: 6px;
}

.special-notes strong {
    color: #e65100;
    display: block;
    margin-bottom: 0.5rem;
}

.special-notes p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.6;
    text-align: justify;
}

.info-item-value {
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.3;
}

.description {
    line-height: 1.8;
    color: var(--text-color);
    text-align: justify;
    white-space: pre-line;
}

/* Plant detail: ensure description widget is visible and in a fixed grid position */
.plant-detail-panel .plant-description-widget {
    min-height: 80px;
    grid-column: 1;
    grid-row: 2;
}
.plant-detail-panel .plant-detail-description,
.plant-detail-panel .plant-detail-description .description {
    display: block;
    visibility: visible;
    margin: 0;
}
.plant-detail-panel .description-empty {
    color: var(--text-light);
    font-style: italic;
    font-size: 0.9rem;
}
.plant-detail-panel .product-reviews-widget .product-review-item {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    background: rgba(245, 247, 243, 0.8);
    border: 1px solid var(--border-color);
}
.plant-detail-panel .taxonomy-link {
    border-radius: 4px;
    padding: 0.1rem 0.2rem;
    transition: background 0.2s ease, color 0.2s ease;
}
.plant-detail-panel .taxonomy-link:hover {
    background: rgba(45, 80, 22, 0.08);
    color: var(--secondary-color);
}

.requirements-list {
    list-style: none;
    padding: 0;
}

.requirements-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.requirements-list li:last-child {
    border-bottom: none;
}

.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.hidden {
    display: none !important;
}

/* When any edit modal is open, only the modal scrolls – one scrollbar */
html:has(.upload-modal.show),
body:has(.upload-modal.show) {
    overflow: hidden;
    height: 100%;
}

/* Edit Plant Details / Image Upload Modal – full-page style (no overlay, no click-outside close) */
.upload-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    background-color: var(--bg-color);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    box-sizing: border-box;
    align-items: stretch;
    justify-content: stretch;
    -webkit-overflow-scrolling: touch;
}

.upload-modal.show {
    display: flex;
    flex-direction: column;
}

.upload-modal-content {
    background-color: var(--bg-color);
    padding: 1.5rem 2rem 3rem;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
    animation: modalSlideIn 0.25s ease;
}

.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.upload-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s;
}

.upload-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.upload-tab:hover {
    color: var(--text-color);
}

.upload-section {
    display: none;
}

.upload-section.active {
    display: block;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-label {
    display: block;
    padding: 15px 20px;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input-label:hover {
    border-color: var(--accent-color);
    background: #f0f5ed;
}

.file-input-label.drag-over {
    border-color: var(--accent-color);
    background: #e8f5e9;
}

#fileInput {
    display: none;
}

.url-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.upload-plant-description {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    box-sizing: border-box;
    background: var(--card-bg);
    color: var(--text-color);
}
.upload-plant-description:focus {
    outline: none;
    border-color: var(--accent-color);
}
.upload-plant-description::placeholder {
    color: var(--text-light);
    opacity: 0.9;
}

/* Consistent row layout for all edit-plant sections */
.edit-plant-name-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.edit-plant-name-row + .edit-plant-name-row {
    margin-top: 0.75rem;
}
.edit-plant-details-section,
.edit-plant-shopping-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
.edit-plant-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem 1rem;
}
.edit-plant-detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.edit-plant-detail-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}
/* Base input style – same look for all text/number inputs in edit plant modal */
.edit-plant-input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-color);
    box-sizing: border-box;
}
.edit-plant-input:focus {
    outline: none;
    border-color: var(--accent-color);
}
.edit-plant-input,
.edit-plant-select,
.upload-plant-description,
.edit-plant-textarea-lines,
.edit-plant-text {
    user-select: text;
    -webkit-user-select: text;
}
.edit-plant-input::placeholder {
    color: var(--text-light);
    opacity: 0.9;
}
.edit-plant-select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-color);
}
.edit-plant-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.vivarium-plant-table-wrap {
    max-height: 280px;
    overflow: auto;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    margin-bottom: 0.5rem;
}
.vivarium-plant-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.vivarium-plant-table th,
.vivarium-plant-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.vivarium-plant-table thead th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 1;
}
.vivarium-plant-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .vivarium-plant-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}
.vivarium-plant-th-include,
.vivarium-plant-td-include {
    width: 2.5rem;
    text-align: center;
    vertical-align: middle;
}
.vivarium-plant-table .vivarium-plant-checkbox {
    cursor: pointer;
}

.vivarium-plant-table-wrap {
    position: relative;
}

.vivarium-plant-image-tooltip {
    display: none;
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border-color);
    background: var(--card-bg);
}

.vivarium-plant-image-tooltip.show {
    display: block;
}

.vivarium-plant-image-tooltip img {
    display: block;
    width: 180px;
    height: 180px;
    object-fit: cover;
}

.edit-plant-size-row {
    grid-column: 1 / -1;
}
.edit-plant-size-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.edit-plant-size-inputs .edit-plant-input {
    width: 6rem;
}
.edit-plant-size-sep {
    color: var(--text-light);
    font-weight: 600;
}
.edit-plant-text {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-color);
    box-sizing: border-box;
}
.edit-plant-text:focus {
    outline: none;
    border-color: var(--accent-color);
}
.edit-plant-details-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}
.edit-plant-field-hint {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-light);
}
.edit-plant-textarea-lines {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
    background: var(--card-bg);
    color: var(--text-color);
}
.edit-plant-textarea-lines:focus {
    outline: none;
    border-color: var(--accent-color);
}
.edit-plant-textarea-lines::placeholder {
    color: var(--text-light);
    opacity: 0.9;
}
.edit-plant-suitable-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
.edit-plant-suitable-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.edit-plant-tag {
    padding: 0.4rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.edit-plant-tag:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
/* Unselected: show dedicated vivarium color as border + light fill */
.edit-plant-tag.open-terrarium { border-color: #5a6e2f; color: #5a6e2f; background: rgba(212, 237, 110, 0.2); }
.edit-plant-tag.closed-terrarium { border-color: #6b8e23; color: #6b8e23; background: rgba(107, 142, 35, 0.2); }
.edit-plant-tag.paludarium { border-color: #1b4332; color: #1b4332; background: rgba(27, 67, 50, 0.15); }
.edit-plant-tag.deserterium { border-color: #8b6914; color: #8b6914; background: rgba(230, 213, 184, 0.4); }
.edit-plant-tag.aerarium { border-color: #1e4d72; color: #1e4d72; background: rgba(179, 217, 255, 0.3); }
.edit-plant-tag.aquarium { border-color: #1a4d7a; color: #1a4d7a; background: rgba(26, 77, 122, 0.15); }
.edit-plant-tag.riparium { border-color: #0d9488; color: #0d9488; background: rgba(13, 148, 136, 0.15); }
.edit-plant-tag.indoor { border-color: #c94a4a; color: #c94a4a; background: rgba(201, 74, 74, 0.2); }
.edit-plant-tag.outdoor { border-color: #8b6914; color: #8b6914; background: rgba(139, 105, 20, 0.2); }
.edit-plant-tag.edit-plant-tag-selected {
    border-color: transparent;
}
.edit-plant-tag.edit-plant-tag-selected:hover {
    filter: brightness(1.1);
}
/* Match card badge colors per enclosure type (selected = solid fill) */
.edit-plant-tag.edit-plant-tag-selected.open-terrarium {
    background-color: #d4ed6e;
    color: #5a6e2f;
}
.edit-plant-tag.edit-plant-tag-selected.closed-terrarium {
    background-color: #6b8e23;
    color: #ffffff;
}
.edit-plant-tag.edit-plant-tag-selected.paludarium {
    background-color: #1b4332;
    color: #d1f4e0;
}
.edit-plant-tag.edit-plant-tag-selected.deserterium {
    background-color: #e6d5b8;
    color: #8b6914;
}
.edit-plant-tag.edit-plant-tag-selected.aerarium {
    background-color: #b3d9ff;
    color: #1e4d72;
}
.edit-plant-tag.edit-plant-tag-selected.aquarium {
    background-color: #1a4d7a;
    color: #b8d4f0;
}
.edit-plant-tag.edit-plant-tag-selected.riparium {
    background-color: #0d9488;
    color: #ccfbf1;
}
.edit-plant-tag.edit-plant-tag-selected.indoor {
    background-color: #c94a4a;
    color: #ffffff;
}
.edit-plant-tag.edit-plant-tag-selected.outdoor {
    background-color: #8b6914;
    color: #ffffff;
}
.edit-plant-requirements-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
.edit-plant-requirements-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem 1rem;
}
.edit-plant-range-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.edit-plant-range-row .edit-plant-size-inputs .edit-plant-input {
    width: 5rem;
}
@media (max-width: 900px) {
    .edit-plant-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .edit-plant-requirements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .edit-plant-details-grid {
        grid-template-columns: 1fr;
    }
    .edit-plant-requirements-grid {
        grid-template-columns: 1fr;
    }
}

.drag-drop-area {
    padding: 20px;
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    min-height: 200px;
    text-align: center;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1rem;
}

.drag-drop-area:hover,
.drag-drop-area.drag-over {
    border-color: var(--accent-color);
    background: #e8f5e9;
}

.drag-drop-area p {
    margin: 10px 0;
    color: var(--text-light);
    text-align: justify;
}

.drag-drop-empty {
    text-align: center;
    padding: 20px;
}

.drag-drop-gallery {
    width: 100%;
}

.drag-drop-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.btn-clear-gallery {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-gallery:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
}

.drag-drop-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.drag-drop-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.drag-drop-gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.drag-drop-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.drag-drop-gallery-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    line-height: 1;
    padding: 0;
}

.drag-drop-gallery-item:hover .remove-btn {
    opacity: 1;
}

.drag-drop-gallery-item .remove-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

.drag-drop-gallery-item .image-number {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}

.upload-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin: 1rem 0;
    display: none;
}

.upload-preview.show {
    display: block;
}

.upload-buttons {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #f0f5ed;
    border-color: var(--accent-color);
}

/* Add New Plant - fixed bottom-right */
.btn-add-plant {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.btn-add-plant:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.btn-add-plant:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(107, 166, 68, 0.4);
}
.btn-add-plant-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 400;
}

/* Photo Gallery */
.plant-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Upload Gallery Preview */
.upload-gallery {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.upload-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.upload-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.upload-gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.upload-gallery-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.upload-gallery-item:hover .remove-btn {
    opacity: 1;
}

.upload-gallery-item .remove-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

.upload-gallery-item .image-number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* Hybrid badge - card image top-left */
.hybrid-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    background: linear-gradient(135deg, #9370DB, #6A5ACD, #8B7EC8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(147, 112, 219, 0.4);
    user-select: none;
    pointer-events: none;
}

.carnivorous-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    background: linear-gradient(135deg, #efd700, #ff8001, #ff3700);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(220, 20, 60, 0.4);
    user-select: none;
    pointer-events: none;
}

.aquatic-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    background: linear-gradient(135deg, #87CEEB, #5F9EA0, #16439d);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(135, 206, 235, 0.4);
    user-select: none;
    pointer-events: none;
}

/* Badge positioning when multiple badges exist */
.plant-image-container:has(.hybrid-badge) .carnivorous-badge,
.plant-image-container:has(.hybrid-badge) .aquatic-badge {
    left: auto;
    right: 6px;
}

.plant-image-container:has(.carnivorous-badge) .aquatic-badge {
    top: 40px;
    left: 6px;
    right: auto;
}

/* Carnivorous plant icon overlay */
.carnivorous-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border-radius: 8px;
    border: 3px solid #ff8001;
    background: rgba(255, 255, 255, 0.95);
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    animation: carnivorous-pulse 2s ease-in-out infinite;
}

.carnivorous-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 5px;
}

/* Scale carnivorous icon with card size */
.plants-grid.card-size-medium .carnivorous-icon {
    width: 36px;
    height: 36px;
    top: 6px;
    left: 6px;
    border-width: 2px;
    padding: 1px;
}
.plants-grid.card-size-small .carnivorous-icon {
    width: 28px;
    height: 28px;
    top: 5px;
    left: 5px;
    border-width: 2px;
    padding: 1px;
}
.plants-grid.card-size-medium .carnivorous-badge {
    padding: 3px 6px;
    font-size: 0.65rem;
    top: 5px;
    left: 5px;
}
.plants-grid.card-size-small .carnivorous-badge {
    padding: 2px 5px;
    font-size: 0.55rem;
    top: 4px;
    left: 4px;
}

@keyframes carnivorous-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        border-color: #ff8001;
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 3px 12px rgba(255, 128, 1, 0.6);
        border-color: #ff5500;
    }
}

.variety-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    background: linear-gradient(135deg, #ffd700, #ffb347, #ff8c00);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Reposition variety badge when other badges are present */
.plant-image-container:has(.hybrid-badge) .variety-badge,
.plant-image-container:has(.carnivorous-badge) .variety-badge,
.plant-image-container:has(.aquatic-badge) .variety-badge {
    top: 40px;
    left: auto;
    right: 6px;
}

.plant-image-container:has(.hybrid-badge):has(.carnivorous-badge) .variety-badge,
.plant-image-container:has(.hybrid-badge):has(.aquatic-badge) .variety-badge,
.plant-image-container:has(.carnivorous-badge):has(.aquatic-badge) .variety-badge {
    top: 74px;
    left: 6px;
    right: auto;
}

.gallery-btn-view,
.gallery-btn-main,
.gallery-btn-download {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    min-height: 28px;
    width: auto;
    min-width: auto;
    max-width: 85%;
    margin: 0 auto;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    gap: 4px;
}

.gallery-btn-download {
    background: rgba(76, 175, 80, 0.9);
    color: white;
}

.gallery-btn-main {
    background: rgba(255, 215, 0, 0.9);
    color: #333;
    padding: 8px 16px;
    min-height: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    line-height: 1;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Fix emoji alignment - wrap content in span for proper centering */
.gallery-btn-main span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.gallery-btn-view:hover,
.gallery-btn-main:hover,
.gallery-btn-download:hover {
    background: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gallery-btn-download:hover {
    background: #45a049;
    color: white;
}

.gallery-btn-main:hover {
    background: #ffd700;
}

.main-image-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: none;
    padding: 0;
    font-size: 1.2rem;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.delete-image-btn {
    transition: all 0.2s ease;
}

.delete-image-btn:hover {
    background: rgba(183, 28, 28, 1) !important;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4) !important;
}

.delete-image-btn:active {
    transform: scale(0.95);
}

/* Gallery Lightbox */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

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

.lightbox-nav {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-btn.lightbox-download {
    background: rgba(76, 175, 80, 0.8);
    border-color: rgba(76, 175, 80, 0.9);
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: scale(1.1);
}

.lightbox-btn.lightbox-download:hover {
    background: rgba(69, 160, 73, 0.9);
    border-color: #45a049;
}

.lightbox-counter {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

/* Site footer – multi-column, newsletter, social (light theme) */
.site-footer {
    margin-top: 3rem;
    background: var(--footer-bg);
    color: #2c3e50;
    padding: 2.5rem 0 1.5rem;
}

.footer-container {
    min-height: 0;
    width: 100%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding-x, 20px);
    padding-right: var(--container-padding-x, 20px);
    box-sizing: border-box;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2rem 1.5rem;
    margin-bottom: 2rem;
}

.footer-heading {
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 0.75rem 0;
    text-transform: none;
    letter-spacing: 0.02em;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.4rem;
}

.footer-links a {
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-newsletter {
    max-width: 320px;
}

.footer-brand {
    font-size: 1.1rem;
    color: #2c3e50;
}

.footer-brand strong {
    color: #5b7c4b;
    font-weight: 700;
}

.footer-tagline {
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0.5rem 0 0.35rem 0;
}

.footer-desc {
    font-size: 0.85rem;
    color: #2c3e50;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.footer-signup {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.footer-email {
    flex: 1;
    min-width: 160px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    color: var(--text-color);
}

.footer-email::placeholder {
    color: var(--text-light);
}

.footer-btn {
    padding: 0.5rem 1.25rem;
    background: #5b7c4b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

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

.footer-privacy-note {
    font-size: 0.75rem;
    color: #5a6c5a;
    margin: 0;
    line-height: 1.4;
    max-width: 280px;
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-social {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-follow {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-right: 0.25rem;
}

.footer-social-link {
    color: #5a6c5a;
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-social-link:hover {
    color: var(--primary-color);
}

.footer-copy {
    font-size: 0.85rem;
    color: #2c3e50;
    margin: 0;
}

.footer-credit {
    font-size: 0.8rem;
    color: #5a6c5a;
    margin: 0.25rem 0 0 0;
    width: 100%;
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-newsletter {
        grid-column: span 2;
        max-width: none;
    }
}

@media (max-width: 600px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .footer-newsletter {
        grid-column: span 1;
    }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
}

[data-theme="dark"] .site-footer {
    background: var(--footer-bg);
    color: var(--text-color);
}

[data-theme="dark"] .footer-heading,
[data-theme="dark"] .footer-tagline,
[data-theme="dark"] .footer-copy {
    color: var(--text-color);
}

[data-theme="dark"] .footer-links a,
[data-theme="dark"] .footer-brand,
[data-theme="dark"] .footer-desc {
    color: var(--text-color);
}

[data-theme="dark"] .footer-links a:hover {
    color: var(--primary-color);
}

[data-theme="dark"] .footer-brand strong {
    color: var(--primary-color);
}

[data-theme="dark"] .footer-email {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .footer-btn {
    background: var(--primary-color);
    color: #fff;
}

[data-theme="dark"] .footer-btn:hover {
    background: var(--secondary-color);
}

[data-theme="dark"] .footer-privacy-note,
[data-theme="dark"] .footer-credit,
[data-theme="dark"] .footer-social-link {
    color: var(--text-light);
}

[data-theme="dark"] .footer-social-link:hover {
    color: var(--primary-color);
}

[data-theme="dark"] .footer-bottom {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .footer-follow {
    color: var(--text-color);
}

/* Responsive Design */

/* Large screens (1200px and up) */
@media (min-width: 1200px) {
    .container {
        --container-padding-x: 40px;
    }
    
    .plants-grid.card-size-large {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* Extra large screens (1600px and up) */
@media (min-width: 1600px) {
    .container {
        --container-padding-x: 60px;
    }
    
    .plants-grid.card-size-large {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
    
    .banner-overlay {
        max-width: 1400px;
    }
}

/* Ultra wide screens (2000px and up) */
@media (min-width: 2000px) {
    .container {
        --container-padding-x: 80px;
    }
    
    .plants-grid.card-size-large {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    }
    
    .banner-overlay {
        max-width: 1600px;
    }
}

/* Tablets and medium screens (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .plants-grid.card-size-large {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .advanced-filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* iPad / tablet: reduce gap between banner and content (769px - 1024px) */
@media (max-width: 1024px) {
    main {
        padding: 1rem 0 1.5rem 0;
    }
    
    .main-layout {
        margin-top: 0.75rem;
    }
    .equipment-card .plant-name {
        font-size: 0.8rem;
    }
}

/* Tablets (768px and below) */
@media (max-width: 768px) {
    .banner {
        height: 220px;
        min-height: 180px;
    }
    
    .banner-overlay {
        top: 0;
        padding: 1.5rem 15px;
        padding-top: calc(65px + 1.5rem);
    }
    
    .banner-overlay h1 {
        font-size: 2.2rem;
    }
    
    .banner-overlay .subtitle {
        font-size: 0.9rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 0.75rem 0 1.5rem 0;
    }
    
    .main-layout {
        margin-top: 0.5rem;
    }
    
    .control-panel-bar {
        padding: 0;
    }
    
    .view-group {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
    
    .controls {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }

    .plants-grid.card-size-large {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .plants-grid.card-size-medium {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .plants-grid.card-size-small {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    /* Half-size scaling: text, tags, padding, icons scaled down on mobile (M and S only; L is full width) */
    .plants-grid.card-size-large .plant-info {
        padding: 0.4rem 0.5rem;
    }
    .plants-grid.card-size-large .plant-name {
        font-size: 0.85rem;
    }
    .plants-grid.card-size-large .equipment-card .plant-name {
        font-size: 0.75rem;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .plants-grid.card-size-large .plant-scientific {
        font-size: 0.65rem;
    }
    .plants-grid.card-size-large .plant-badges {
        gap: 4px;
        margin-bottom: 0.35rem;
    }
    .plants-grid.card-size-large .badge {
        padding: 2px 5px;
        font-size: 0.55rem;
    }
    .plants-grid.card-size-large .plant-image-container .card-price {
        padding: 0.2rem 0.4rem;
        font-size: 0.6rem;
    }
    .plants-grid.card-size-large .plant-card-icons,
    .plants-grid.card-size-large .card-icons {
        top: 6px;
        right: 6px;
        gap: 4px;
    }
    .plants-grid.card-size-large .image-edit-icon,
    .plants-grid.card-size-large .plant-image-icon,
    .plants-grid.card-size-large .card-edit-icon,
    .plants-grid.card-size-large .card-image-icon {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
    }
    .plants-grid.card-size-large .image-edit-icon svg,
    .plants-grid.card-size-large .plant-image-icon svg,
    .plants-grid.card-size-large .card-edit-icon svg,
    .plants-grid.card-size-large .card-image-icon svg {
        width: 12px;
        height: 12px;
    }
    .plants-grid.card-size-large .quick-add-wrap {
        bottom: 5px;
        right: 5px;
    }
    .plants-grid.card-size-large .quick-add-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.6rem;
    }
    .plants-grid.card-size-large .quick-add-icon .cart-icon-svg {
        width: 0.9rem;
        height: 0.9rem;
    }
    .plants-grid.card-size-large .quick-add-qty {
        width: 1.6rem;
        padding: 0.2rem 0.15rem;
        font-size: 0.6rem;
    }
    .plants-grid.card-size-large .quick-add-confirm {
        padding: 0.22rem 0.4rem;
        font-size: 0.6rem;
    }

    .plants-grid.card-size-medium .plant-info {
        padding: 0.35rem 0.45rem;
    }
    .plants-grid.card-size-medium .plant-name {
        font-size: 0.75rem;
    }
    .plants-grid.card-size-medium .plant-scientific {
        font-size: 0.6rem;
    }
    .plants-grid.card-size-medium .plant-badges {
        gap: 3px;
        margin-bottom: 0.25rem;
    }
    .plants-grid.card-size-medium .badge {
        padding: 1px 4px;
        font-size: 0.5rem;
    }
    .plants-grid.card-size-medium .plant-image-container .card-price {
        padding: 0.16rem 0.35rem;
        font-size: 0.55rem;
    }
    .plants-grid.card-size-medium .plant-card-icons,
    .plants-grid.card-size-medium .card-icons {
        top: 5px;
        right: 5px;
        gap: 3px;
    }
    .plants-grid.card-size-medium .image-edit-icon,
    .plants-grid.card-size-medium .plant-image-icon,
    .plants-grid.card-size-medium .card-edit-icon,
    .plants-grid.card-size-medium .card-image-icon {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }
    .plants-grid.card-size-medium .image-edit-icon svg,
    .plants-grid.card-size-medium .plant-image-icon svg,
    .plants-grid.card-size-medium .card-edit-icon svg,
    .plants-grid.card-size-medium .card-image-icon svg {
        width: 10px;
        height: 10px;
    }
    .plants-grid.card-size-medium .quick-add-wrap {
        bottom: 4px;
        right: 4px;
    }
    .plants-grid.card-size-medium .quick-add-btn {
        padding: 0.2rem 0.35rem;
        font-size: 0.55rem;
    }
    .plants-grid.card-size-medium .quick-add-icon .cart-icon-svg {
        width: 0.8rem;
        height: 0.8rem;
    }
    .plants-grid.card-size-medium .quick-add-qty {
        width: 1.4rem;
        padding: 0.16rem 0.1rem;
        font-size: 0.55rem;
    }
    .plants-grid.card-size-medium .quick-add-confirm {
        padding: 0.18rem 0.35rem;
        font-size: 0.55rem;
    }

    .plants-grid.card-size-small .plant-info {
        padding: 0.28rem 0.38rem;
    }
    .plants-grid.card-size-small .plant-name {
        font-size: 0.65rem;
    }
    .plants-grid.card-size-small .plant-scientific {
        font-size: 0.55rem;
    }
    .plants-grid.card-size-small .plant-card {
        display: flex;
        flex-direction: column;
    }
    .plants-grid.card-size-small .plant-info {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }
    .plants-grid.card-size-small .card-rating {
        margin-top: auto;
        margin-bottom: 0.2rem;
    }
    .plants-grid.card-size-small .plant-badges,
    .plants-grid.card-size-small .plant-card.carnivorous-plant .plant-badges,
    .plants-grid.card-size-small .plant-card.aquatic-plant .plant-badges {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 3px;
        margin-top: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0.2rem;
        max-width: 100%;
    }
    .plants-grid.card-size-small .plant-badges .badge {
        width: 100%;
        aspect-ratio: 1;
        max-width: 14px;
        max-height: 14px;
        border-radius: 50%;
        padding: 0;
        font-size: 0;
        line-height: 0;
        text-indent: -9999px;
        overflow: hidden;
        color: transparent;
        min-width: 0;
    }
    .plants-grid.card-size-small .plant-badges .badge:nth-child(n + 11) {
        display: none;
    }
    .plants-grid.card-size-small .plant-image-container .card-price {
        padding: 0.12rem 0.28rem;
        font-size: 0.5rem;
    }
    .plants-grid.card-size-small .plant-card-icons,
    .plants-grid.card-size-small .card-icons {
        top: 4px;
        right: 4px;
        gap: 2px;
    }
    .plants-grid.card-size-small .image-edit-icon,
    .plants-grid.card-size-small .plant-image-icon,
    .plants-grid.card-size-small .card-edit-icon,
    .plants-grid.card-size-small .card-image-icon {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
    }
    .plants-grid.card-size-small .image-edit-icon svg,
    .plants-grid.card-size-small .plant-image-icon svg,
    .plants-grid.card-size-small .card-edit-icon svg,
    .plants-grid.card-size-small .card-image-icon svg {
        width: 9px;
        height: 9px;
    }
    .plants-grid.card-size-small .care-card-icon {
        top: 42px;
        right: 4px;
        width: 18px;
        height: 18px;
    }
    .plants-grid.card-size-small .care-card-icon svg {
        width: 9px;
        height: 9px;
    }
    .plants-grid.card-size-small .carnivorous-icon {
        width: 20px;
        height: 20px;
        top: 4px;
        left: 4px;
        border-width: 1.5px;
        padding: 1px;
    }
    .plants-grid.card-size-small .carnivorous-badge {
        padding: 2px 4px;
        font-size: 0.5rem;
        top: 3px;
        left: 3px;
    }
    .plants-grid.card-size-medium .carnivorous-icon {
        width: 28px;
        height: 28px;
        top: 5px;
        left: 5px;
    }
    .plants-grid.card-size-medium .carnivorous-badge {
        padding: 2px 5px;
        font-size: 0.6rem;
    }
    .plants-grid.card-size-small .plant-image-container:has(.carnivorous-badge) .aquatic-badge,
    .plants-grid.card-size-small .plant-image-container:has(.carnivorous-icon) .aquatic-badge {
        top: 22px;
        left: 4px;
    }
    .plants-grid.card-size-small .plant-image-container:has(.hybrid-badge) .carnivorous-badge,
    .plants-grid.card-size-small .plant-image-container:has(.hybrid-badge) .aquatic-badge {
        right: 4px;
    }
    .plants-grid.card-size-small .quick-add-wrap {
        bottom: 3px;
        right: 3px;
    }
    .plants-grid.card-size-small .quick-add-btn {
        padding: 0.16rem 0.28rem;
        font-size: 0.5rem;
    }
    .plants-grid.card-size-small .quick-add-icon .cart-icon-svg {
        width: 0.7rem;
        height: 0.7rem;
    }
    .plants-grid.card-size-small .quick-add-qty {
        width: 1.2rem;
        padding: 0.12rem 0.08rem;
        font-size: 0.5rem;
    }
    .plants-grid.card-size-small .quick-add-confirm {
        padding: 0.14rem 0.28rem;
        font-size: 0.5rem;
    }

    .search-container {
        flex-direction: column;
    }
    
    #searchInput {
        width: 100%;
    }
    
    #searchBtn {
        width: 100%;
    }

    .filter-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sort-container {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .sort-select {
        flex: 1;
        min-width: 150px;
    }
    
    .sort-direction-btn {
        flex-shrink: 0;
    }
    
    .filter-container label {
        width: 100%;
    }

    .advanced-filters {
        padding: 1.25rem;
    }
    
    .advanced-filters-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .advanced-toggle {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }

    .modal-content {
        padding: 1.5rem;
        width: calc(100vw - 10vh);
        max-width: calc(100vw - 10vh);
    }

    .close {
        right: 15px;
        top: 15px;
        width: 35px;
        height: 35px;
    }
    
    .close::after {
        font-size: 1.5rem;
    }

    .plant-gallery {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.75rem;
    }

    .lightbox-content img {
        max-height: 70vh;
    }

    .lightbox-close {
        top: -35px;
        font-size: 2.5rem;
    }
    
    .info-grid,
    .safety-grid,
    .additional-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
    .banner {
        height: 180px;
        min-height: 150px;
    }
    
    .banner-overlay {
        top: 0;
        padding: 1rem 15px;
        padding-top: calc(65px + 1rem);
    }
    
    .banner-overlay h1 {
        font-size: 1.75rem;
        margin-bottom: 0.25rem;
    }
    
    .banner-overlay .subtitle {
        font-size: 0.85rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    main {
        padding: 0.5rem 0 1rem 0;
    }
    
    .main-layout {
        margin-top: 0.35rem;
    }
    
    .controls {
        padding: 1rem;
        border-radius: 8px;
        margin-top: 1.25rem;
    }
    
    .search-container {
        margin-bottom: 1rem;
    }
    
    .filter-container {
        margin-top: 0.75rem;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .plants-grid.card-size-large {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .plants-grid.card-size-medium {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .plants-grid.card-size-small {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .plant-card {
        border-radius: 8px;
    }

    .advanced-filters {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .advanced-filters-header h3 {
        font-size: 1.1rem;
    }
    
    .btn-reset-filters {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .modal-content {
        padding: 1rem;
        border-radius: 12px;
        max-height: 95vh;
        width: calc(100vw - 10vh);
        max-width: calc(100vw - 10vh);
    }
    
    .modal-plant-name {
        font-size: 1.5rem;
    }
    
    .modal-plant-scientific {
        font-size: 1rem;
    }
    
    .modal-section h3 {
        font-size: 1.1rem;
    }

    .close {
        right: 10px;
        top: 10px;
        width: 32px;
        height: 32px;
    }
    
    .close::after {
        font-size: 1.25rem;
    }

    .plant-gallery {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.5rem;
    }

    .lightbox-content {
        max-width: 95%;
    }
    
    .lightbox-content img {
        max-height: 65vh;
    }

    .lightbox-close {
        top: -30px;
        font-size: 2rem;
    }
    
    .lightbox-btn {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .upload-modal-content {
        margin: 0.5rem;
        padding: 1rem;
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }
    
    .upload-tabs {
        flex-wrap: wrap;
    }
    
    .upload-tab {
        padding: 8px 12px;
        font-size: 0.9rem;
        flex: 1;
        min-width: 0;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .site-footer {
        padding: 1.5rem 0 1rem;
    }
}

/* Extra small devices (320px and below) */
@media (max-width: 320px) {
    .banner {
        height: 150px;
        min-height: 120px;
    }
    
    .banner-overlay {
        top: 0;
        padding: 0.75rem 10px;
        padding-top: calc(65px + 0.75rem);
    }
    
    .banner-overlay h1 {
        font-size: 1.4rem;
    }
    
    .banner-overlay .subtitle {
        font-size: 0.75rem;
    }
    
    .container {
        --container-padding-x: 10px;
    }
    
    main {
        padding: 0.35rem 0 0.75rem 0;
    }
    
    .main-layout {
        margin-top: 0.25rem;
    }
    
    .controls {
        padding: 0.75rem;
    }
    
    .plant-card {
        border-radius: 6px;
    }
    
    .modal-content {
        padding: 0.75rem;
        width: calc(100vw - 10vh);
        max-width: calc(100vw - 10vh);
    }
}

