/* HerbAPI — Plant Database Stylesheet */

:root {
    --bg: #faf9f6;
    --bg-card: #ffffff;
    --bg-sidebar: #2d3a2e;
    --text: #1a1a1a;
    --text-muted: #666;
    --text-sidebar: #e0e0e0;
    --accent: #4a7c59;
    --accent-hover: #3d6b4a;
    --accent-light: #e8f0ea;
    --border: #ddd;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);

    /* Planting calendar colors */
    --cal-indoor: #7b68ee;
    --cal-direct: #3cb371;
    --cal-transplant: #ff8c00;
    --cal-glass: #87ceeb;
    --cal-harvest: #dc143c;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

em {
    font-style: italic;
}

/* Layout */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
}

.brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 0.7rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: background 0.15s;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}

/* Language toggle */

.sidebar-lang {
    margin-top: auto;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
}

.lang-toggle {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

.lang-btn {
    padding: 0.3rem 0.75rem;
    background: transparent;
    color: rgba(255,255,255,0.5);
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s;
}

.lang-btn:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.05);
}

.lang-btn-active {
    background: var(--accent);
    color: #fff;
}

.lang-btn-active:hover {
    background: var(--accent-hover);
    color: #fff;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.user-name {
    font-weight: 500;
}

.logout-link,
.login-link {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}

.logout-link:hover,
.login-link:hover {
    color: #fff;
}

/* Content */

.content {
    flex: 1;
    padding: 2rem 3rem;
}

.page {
    animation: fadeIn 0.2s ease;
}

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

h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

h2 {
    font-size: 1.3rem;
    margin: 2rem 0 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.name-common {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.description {
    margin: 1rem 0;
    line-height: 1.7;
}

/* Search */

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-bar input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--bg-card);
    transition: border-color 0.15s;
}

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

.search-bar button {
    padding: 0.6rem 1.2rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}

.search-bar button:hover {
    background: var(--accent-hover);
}

/* Cards */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.plant-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s, transform 0.15s;
}

.plant-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.card-scientific {
    font-size: 1rem;
    display: block;
    margin-bottom: 0.25rem;
}

.card-common {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Tables */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

thead {
    background: var(--accent-light);
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}

td {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

tr:hover td {
    background: var(--accent-light);
}

/* Badges */

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--accent-light);
    color: var(--accent);
}

.badge.organic {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge.demeter {
    background: #fff3e0;
    color: #e65100;
}

/* Info grid (species detail) */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.info-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
}

.info-item.badge {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Planting Calendar */

.planting-calendar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.cal-row {
    display: grid;
    grid-template-columns: 120px repeat(12, 1fr);
    gap: 2px;
    margin-bottom: 2px;
}

.cal-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.cal-label {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
}

.cal-cell {
    height: 28px;
    border-radius: 3px;
    background: #f0f0f0;
    text-align: center;
    line-height: 28px;
}

.cal-cell.active.cal-indoor {
    background: var(--cal-indoor);
}

.cal-cell.active.cal-direct {
    background: var(--cal-direct);
}

.cal-cell.active.cal-transplant {
    background: var(--cal-transplant);
}

.cal-cell.active.cal-glass {
    background: var(--cal-glass);
}

.cal-cell.active.cal-harvest {
    background: var(--cal-harvest);
}

/* 52-Week Planting Calendar */

.week-calendar {
    padding: 0.5rem;
    border: none;
    box-shadow: none;
    background: transparent;
}

.wcal-month-row {
    display: grid;
    grid-template-columns: 100px repeat(52, 1fr);
    gap: 1px;
    margin-bottom: 2px;
}

.wcal-month-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border);
}

.wcal-label {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.wcal-row {
    display: grid;
    grid-template-columns: 100px repeat(52, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.wcal-cell {
    height: 18px;
    border-radius: 2px;
    background: #f0f0f0;
}

.wcal-cell.active.cal-indoor  { background: var(--cal-indoor); }
.wcal-cell.active.cal-direct  { background: var(--cal-direct); }
.wcal-cell.active.cal-transplant { background: var(--cal-transplant); }
.wcal-cell.active.cal-glass   { background: var(--cal-glass); }
.wcal-cell.active.cal-harvest { background: var(--cal-harvest); }

.wcal-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-left: 100px;
    flex-wrap: wrap;
}

.wcal-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.wcal-legend-swatch {
    width: 14px;
    height: 10px;
    border-radius: 2px;
}

.wcal-legend-swatch.cal-indoor  { background: var(--cal-indoor); }
.wcal-legend-swatch.cal-direct  { background: var(--cal-direct); }
.wcal-legend-swatch.cal-transplant { background: var(--cal-transplant); }
.wcal-legend-swatch.cal-glass   { background: var(--cal-glass); }
.wcal-legend-swatch.cal-harvest { background: var(--cal-harvest); }

/* Pagination */

.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.pagination button {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.85rem;
}

.pagination button:hover:not(:disabled) {
    background: var(--accent-light);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Search results */

.result-count {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-result {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: var(--shadow);
}

.search-result-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.badge-family {
    background: #e8eaf6;
    color: #283593;
}

.badge-species {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-cultivar {
    background: #fff3e0;
    color: #e65100;
}

.badge-meta {
    background: var(--accent-light);
    color: var(--text-muted);
    font-size: 0.72rem;
}

.result-scientific {
    font-style: italic;
}

.result-cultivar-name {
    font-weight: 600;
}

.result-common-name {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-species-link {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-species-link em {
    font-style: italic;
}

.result-uses {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.result-desc {
    width: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

/* Table toolbar (search + per-page on same row) */

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-toolbar .search-bar {
    flex: 1;
    margin-bottom: 0;
    min-width: 200px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Filter bar */

.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.filter-group select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    font-size: 0.85rem;
    cursor: pointer;
}

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

.filter-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Column toggle bar */

.column-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.column-toggle-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-right: 0.25rem;
    font-weight: 600;
}

.col-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.col-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.col-btn-active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

/* Per-page selector */

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.per-page-selector select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 0.85rem;
    cursor: pointer;
}

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

/* View toggle button */

.view-toggle-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text);
    transition: all 0.15s;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* Truncated cell */

.cell-truncated {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* External link styling in tables */

.external-link {
    color: var(--accent);
    font-size: 0.85rem;
}

.external-link:hover {
    text-decoration: underline;
}

/* Species name in tables */

.species-name {
    white-space: nowrap;
}

/* Sources page */

.sources-intro {
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 700px;
    line-height: 1.7;
}

.sources-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}

.source-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.source-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.source-url {
    font-size: 0.85rem;
    color: var(--accent);
}

.source-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.source-details {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.source-detail {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    align-items: baseline;
}

.source-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 70px;
}

.source-detail-value {
    color: var(--text);
}

.source-license {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Hero section */

.hero {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Stats cards */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: box-shadow 0.15s, transform 0.15s;
}

.stat-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.stat-card-loading {
    opacity: 0.4;
}

.stat-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Quick filters */

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.quick-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.15s;
    cursor: pointer;
}

.quick-filter-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qf-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.qf-nitrogen { border-left: 3px solid #4caf50; }
.qf-bee { border-left: 3px solid #ffc107; }
.qf-ground { border-left: 3px solid #8bc34a; }
.qf-tree { border-left: 3px solid #795548; }

@media (max-width: 768px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .quick-filters {
        gap: 0.5rem;
    }

    .quick-filter-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* 404 */

.not-found {
    text-align: center;
    padding: 4rem 0;
}

.not-found h1 {
    font-size: 4rem;
    color: var(--text-muted);
}

/* Empty states */

.empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem 0;
}

.error {
    color: #c62828;
    background: #ffebee;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

/* Cultivar detail page */

.cultivar-detail .species-link {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.cultivar-detail .description {
    margin: 1.5rem 0;
    line-height: 1.7;
    max-width: 800px;
}

.cultivar-detail .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.cultivar-detail .info-item {
    background: var(--accent-light);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}

.cultivar-detail .info-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.cultivar-detail .info-value {
    font-weight: 600;
    font-size: 1rem;
}

.supplier-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.supplier-link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.supplier-link-card .sku {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.supplier-link-card .price {
    font-weight: 600;
    color: var(--accent);
}

.supplier-link-card .external-link {
    background: var(--accent);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.85rem;
}

.supplier-link-card .external-link:hover {
    background: var(--accent-hover);
}

/* ========================================
   Detail pages — two-column card layout
   ======================================== */

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.detail-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.detail-card-header {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-card-empty {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* Attribute table inside detail cards */

.attr-table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: none;
    border-radius: 0;
}

.attr-table thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.attr-table tbody tr:nth-child(even) {
    background: var(--bg);
}

.attr-table tbody tr:nth-child(odd) {
    background: var(--bg-card);
}

.attr-table th {
    width: 200px;
    min-width: 140px;
    text-align: right;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    vertical-align: top;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
    background: transparent;
    border-top: none;
}

.attr-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-top: none;
    word-break: break-word;
}

/* Placeholder (em dash) — muted style */

.placeholder,
td.placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Wildlife bars (nectar/pollen 1-4 scale) */

.wildlife-bar-wrap {
    display: inline-block;
    width: 80px;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    vertical-align: middle;
}

.wildlife-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.wildlife-bar-1 { background: #c8e6c9; }
.wildlife-bar-2 { background: #81c784; }
.wildlife-bar-3 { background: #4caf50; }
.wildlife-bar-4 { background: #2e7d32; }

.wildlife-bar-label {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Native status badges */

.native-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--accent-light);
    color: var(--text);
}

.native-badge-heimisch {
    background: #e8f5e9;
    color: #2e7d32;
}

.native-badge-archaeophyt {
    background: #e3f2fd;
    color: #1565c0;
}

.native-badge-neophyt {
    background: #fff3e0;
    color: #e65100;
}

/* Species / cultivar images inside detail cards */

.image-card-body {
    padding: 0.75rem;
    text-align: center;
}

.species-image {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    object-fit: cover;
}

.image-attribution {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    max-width: 360px;
}

.attribution-link {
    color: var(--accent);
    font-size: 0.75rem;
}

.attribution-link:hover {
    text-decoration: underline;
}

/* Species-fallback estimated values */

.estimated-value {
    color: var(--accent);
    font-style: italic;
}

.estimated-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
    opacity: 0.7;
}

.species-fallback-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 1.25rem;
    opacity: 0.7;
}

/* ── Bottom navigation (mobile only) ──────────────────────── */

.bottom-nav {
    display: none;
}

/* Responsive */

@media (max-width: 768px) {
    /* Hide sidebar completely on mobile */
    .sidebar {
        display: none;
    }

    /* Show bottom nav */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-sidebar);
        border-top: 1px solid rgba(255,255,255,0.1);
        justify-content: space-around;
        align-items: center;
        padding: 0.35rem 0;
        padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    }

    .bottom-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
        color: rgba(255,255,255,0.55);
        text-decoration: none;
        font-size: 0.6rem;
        padding: 0.25rem 0.4rem;
        border-radius: 4px;
        transition: color 0.15s;
        min-width: 44px;
        text-align: center;
    }

    .bottom-nav-link:hover,
    .bottom-nav-link:active {
        color: #fff;
        text-decoration: none;
    }

    .bottom-nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    .bottom-nav-label {
        font-weight: 500;
        letter-spacing: 0.3px;
    }

    /* Language toggle in bottom nav */
    .bottom-nav .lang-toggle {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .bottom-nav .lang-btn {
        padding: 0.2rem 0.45rem;
        font-size: 0.65rem;
    }

    /* Content adjustments */
    .content {
        padding: 1rem;
        margin-left: 0;
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    }

    /* Cards */
    .card-grid {
        grid-template-columns: 1fr;
    }

    /* Info grid */
    .info-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Detail page two-column → single column */
    .detail-row {
        grid-template-columns: 1fr;
    }

    /* Tables: scrollable + smaller text */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.82rem;
    }

    th, td {
        padding: 0.45rem 0.6rem;
    }

    .attr-table th {
        width: auto;
        min-width: 90px;
        font-size: 0.8rem;
    }

    .attr-table td {
        font-size: 0.85rem;
    }

    .cell-truncated {
        max-width: 150px;
    }

    /* Filter bar: stack vertically */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

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

    .filter-group select {
        flex: 1;
        min-width: 0;
    }

    /* Table toolbar: stack */
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar .search-bar {
        min-width: 0;
    }

    .toolbar-right {
        justify-content: space-between;
    }

    /* Column toggle: scroll horizontally */
    .column-toggle {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* 52-week calendar: horizontal scroll */
    .planting-calendar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wcal-month-row,
    .wcal-row {
        min-width: 500px;
    }

    .wcal-legend {
        padding-left: 0;
        flex-wrap: wrap;
    }

    /* Hero */
    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    /* Pagination */
    .pagination {
        gap: 0.5rem;
    }

    .pagination button {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Search results */
    .search-result {
        padding: 0.6rem 0.75rem;
    }
}

/* ── Companion Planting Page ──────────────────────────────── */

.companion-section {
    margin: 1.5rem 0;
}

.companion-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
}

.companion-beneficial .companion-section-title {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.companion-antagonistic .companion-section-title {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #ef5350;
}

.companion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.75rem;
    padding-top: 0.75rem;
}

.companion-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.companion-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.companion-card-header {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.companion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}

.companion-badge-beneficial {
    background: #e8f5e9;
    color: #2e7d32;
}

.companion-badge-antagonistic {
    background: #ffebee;
    color: #c62828;
}

.companion-card-body {
    padding: 0.75rem;
}

.companion-pair {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.companion-species {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.companion-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.companion-name-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.companion-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.companion-link:hover {
    text-decoration: underline;
}

.companion-sci {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.companion-arrow {
    font-size: 1.1rem;
    color: var(--text-light);
    flex-shrink: 0;
    padding: 0 0.25rem;
}

.companion-mechanism {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.4;
}

.mechanism-label {
    font-weight: 600;
    color: var(--text-light);
}

.companion-source {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
}

.companion-source:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .companion-grid {
        grid-template-columns: 1fr;
    }
    .companion-pair {
        flex-direction: column;
        align-items: flex-start;
    }
    .companion-arrow {
        transform: rotate(90deg);
        align-self: center;
    }
}

/* Companion planting on species detail page */
.companion-detail-body {
    padding: 0.75rem 1rem 1rem;
}

.companion-sub {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.75rem 0 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid;
}

.companion-sub:first-child {
    margin-top: 0;
}

.companion-sub.beneficial {
    color: var(--green, #2e7d32);
    border-color: var(--green, #2e7d32);
}

.companion-sub.antagonistic {
    color: var(--red, #c62828);
    border-color: var(--red, #c62828);
}

.companion-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
}

.companion-list li {
    padding: 0.3rem 0;
    line-height: 1.45;
}

.companion-icon {
    font-weight: 700;
}

.companion-icon.beneficial {
    color: var(--green, #2e7d32);
}

.companion-icon.antagonistic {
    color: var(--red, #c62828);
}

.companion-detail-link {
    color: var(--link, #1565c0);
    text-decoration: none;
}

.companion-detail-link:hover {
    text-decoration: underline;
}

.companion-mechanism-inline {
    color: var(--text-muted, #666);
    font-size: 0.9em;
}
