/**
 * Marjanetti — Custom Styles
 */

/* Bold nav menu links */
.main-nav .nav > li > a {
    font-weight: 700 !important;
}

/* Mobile menu — force consistent centering on every nav item.
   text-align alone was not enough; some interaction (slideToggle /
   background-header scroll handler) appears to shift the first item.
   Flex on the <li> centers the <a> regardless of text-align. */
@media (max-width: 767px) {
    .header-area .main-nav .nav li {
        display: flex !important;
        justify-content: center !important;
        align-items: stretch !important;
    }
    .header-area .main-nav .nav li a {
        text-align: center !important;
        width: 100% !important;
        display: block !important;
    }
    .header-area .main-nav .nav li.has-sub {
        flex-direction: column;
        padding-right: 0 !important;
    }
    .header-area .main-nav .nav li.has-sub::after {
        display: none !important;
    }
}

/* ===== Hero with forest background ===== */
.hero-forest {
    background: linear-gradient(rgba(20, 35, 25, 0.55), rgba(20, 35, 25, 0.65)),
                url('../images/forest-hero.jpg') center center / cover no-repeat;
    min-height: 560px;
    display: flex;
    align-items: center;
}
.hero-forest .header-text h6 {
    color: #9bd3ec !important;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.hero-forest .header-text h2 {
    color: #fff !important;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.hero-forest .header-text h2 em {
    color: #9bd3ec;
    font-style: normal;
}
.hero-forest .header-text p {
    color: #f1f1f1 !important;
    font-size: 16px;
    line-height: 1.6;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.hero-forest .main-button-gradient {
    margin-top: 15px;
    display: inline-block;
}
.hero-cta-big a {
    font-size: 17px !important;
    padding: 14px 38px !important;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* CTA section with wild berries forest background */
section.simple-cta {
    background-image: linear-gradient(rgba(20, 30, 20, 0.55), rgba(20, 30, 20, 0.65)),
                      url('../images/cta-berries.jpg') !important;
    background-position: center 30% !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
}

/* Admin panel — real tabs (folder-tab style connecting to the card) */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding-left: 8px;
}
.admin-tab {
    display: inline-block;
    padding: 11px 22px;
    background: #e9eff5;
    color: #5a6b7c;
    border: 1px solid #d8e2ec;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
    top: 1px;
}
.admin-tab:hover {
    background: #dde6ef;
    color: #3d7dca;
    text-decoration: none;
}
.admin-tab.active {
    background: #fff;
    color: #3d7dca;
    border-color: #d8e2ec;
    box-shadow: inset 0 3px 0 0 #3d7dca;
    /* Bridges over the card's top border so the active tab connects */
    z-index: 2;
}
.admin-card {
    background: #fff;
    border: 1px solid #d8e2ec;
    border-radius: 12px;
    border-top-left-radius: 0;
    padding: 24px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 1;
}
@media (max-width: 575px) {
    .admin-tabs { padding-left: 0; }
    .admin-tab { padding: 10px 14px; font-size: 13px; }
}
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.admin-toolbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.admin-toolbar-right select {
    padding: 4px 8px;
    border: 1px solid #d8e2ec;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    margin-left: 4px;
}
.admin-table {
    width: 100%;
    font-size: 13px;
}
.admin-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table td {
    vertical-align: top;
}
.admin-table tr.row-hidden {
    background: #fff8f8;
}
.admin-actions form {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.btn-hold {
    background: #ffc107;
    color: #333;
}
.btn-hold:hover {
    background: #e0a800;
    color: #000;
}
.btn-promote {
    background: #3d7dca;
    color: #fff;
}
.btn-promote:hover {
    background: #2c5f9e;
    color: #fff;
}
.muted-small {
    font-size: 11px;
    color: #999;
}
.badge-admin {
    background: #3d7dca;
    color: #fff;
}
.badge-admin-hidden {
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 4px;
}
.admin-stat {
    background: linear-gradient(-145deg, #e6f1fa 0%, #fff 100%);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    border: 1px solid #d3e7f5;
}
.admin-stat-num {
    font-size: 32px;
    font-weight: 900;
    color: #3d7dca;
    line-height: 1;
}
.admin-stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Site footer (legal links) */
.site-footer {
    background: #22303d;
    padding: 28px 0;
    margin-top: 0;
    text-align: center;
}
.site-footer-links a {
    color: #9bd3ec;
    font-size: 14px;
    margin: 0 6px;
    text-decoration: none;
}
.site-footer-links a:hover {
    color: #fff;
    text-decoration: underline;
}
.site-footer-links span {
    color: #5a6b78;
}
.site-footer-copy {
    color: #8a98a3;
    font-size: 12px;
    margin-top: 8px;
}

/* Legal pages (kayttoehdot.php, tietosuoja.php) */
.legal-content h2 {
    font-weight: 900;
    color: #111;
    margin-bottom: 4px;
}
.legal-content h4 {
    margin-top: 28px;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #2c5f9e;
}
.legal-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}
.legal-updated {
    color: #999;
    font-size: 13px;
    margin-bottom: 20px !important;
}
.legal-list {
    margin: 8px 0 12px 0;
    padding-left: 22px;
    list-style: disc;
}
.legal-list li {
    margin-bottom: 6px;
    line-height: 1.55;
    list-style: disc;
}
.legal-note {
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #777;
}
.legal-note a {
    color: #3d7dca;
}

/* About page (tietoa.php) berry banner */
.tietoa-hero {
    margin-top: 0;
    padding: 150px 0 70px;
    background: linear-gradient(rgba(20, 35, 25, 0.55), rgba(20, 35, 25, 0.65)),
                url('../images/tietoa-berries.jpg') center center / cover no-repeat;
}
.tietoa-hero-text h6 {
    color: #9bd3ec;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.tietoa-hero-text h1 {
    color: #fff;
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
@media (max-width: 767px) {
    .tietoa-hero {
        padding: 120px 0 50px;
    }
}

/* ===== Listings / search page (ilmoitukset.php) ===== */
.haku-page {
    margin-top: 0;
    padding-top: 130px;
    padding-bottom: 60px;
}
.haku-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.haku-sidebar {
    flex: 0 0 270px;
    background: #fff;
    border: 1px solid #e6eef6;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 130px;
}
.haku-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.haku-sidebar-title { font-weight: 700; color: #2c5f9e; margin: 0; }
.haku-clear { font-size: 13px; color: #3d7dca; }
.haku-fg { margin-bottom: 13px; }
.haku-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}
.haku-sidebar input[type="text"],
.haku-sidebar input[type="number"],
.haku-sidebar select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fbfd;
}
.haku-range { display: flex; align-items: center; gap: 6px; }
.haku-range input { flex: 1; }
.haku-range span { color: #aaa; }
.haku-apply {
    width: 100%;
    border: none;
    cursor: pointer;
    padding: 11px;
    margin-top: 6px;
    border-radius: 8px;
}

/* Results column */
.haku-results { flex: 1; min-width: 0; }
.haku-results-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.haku-count { font-size: 15px; font-weight: 700; color: #2c5f9e; }
.haku-sort { font-size: 13px; color: #888; margin: 0; }
.haku-sort select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    margin-left: 4px;
    background: #fff;
}
.haku-empty {
    text-align: center;
    padding: 50px 0;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #eee;
}

/* List cards */
.haku-list { display: flex; flex-direction: column; gap: 14px; }
.listing-row {
    display: flex;
    gap: 16px;
    background: #fff;
    border: 1px solid #e6eef6;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.2s, transform 0.2s;
}
.listing-row:hover {
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
    text-decoration: none;
    color: #333;
}
.listing-row-photo {
    flex: 0 0 180px;
    height: 180px;
}
.listing-row-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #eef3f9;
}
.listing-row-photo .listing-photo-placeholder { height: 100%; }
.listing-row-body { flex: 1; min-width: 0; padding: 16px 18px 16px 0; }
.listing-row-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.listing-row-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c5f9e;
    margin: 2px 0 4px;
}
.listing-row-price {
    font-size: 18px;
    font-weight: 800;
    color: #3d7dca;
    margin: 0 0 6px;
}
.listing-row-desc {
    font-size: 14px;
    color: #777;
    margin: 0 0 8px;
    line-height: 1.5;
}
.listing-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
}
.listing-row-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13px;
    color: #999;
}
.listing-row-foot i { margin-right: 4px; }
.badge-cleaned { background: #6cb4ee; color: #fff; }

.haku-toggle {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 14px;
}

@media (max-width: 900px) {
    .haku-layout { flex-direction: column; }
    .haku-sidebar {
        flex: none;
        width: 100%;
        position: static;
        display: none;
    }
    .haku-sidebar.open { display: block; }
    .haku-toggle { display: inline-flex; }
    .listing-row-photo { flex-basis: 130px; height: 130px; }
}
@media (max-width: 560px) {
    .listing-row { flex-direction: column; }
    .listing-row-photo { flex-basis: auto; width: 100%; height: 180px; }
    .listing-row-body { padding: 0 16px 16px; }
}

/* ===== Kartta page (dedicated map + filter sidebar) ===== */
.kartta-page {
    margin-top: 0;
    padding-top: 110px; /* clear the absolute header */
}
.kartta-layout {
    position: relative;
    height: calc(100vh - 110px);
    min-height: 520px;
}
/* Floating filter panel overlaid on the map */
.kartta-sidebar {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 300px;
    max-height: calc(100% - 28px);
    overflow-y: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    padding: 20px;
    z-index: 1000;
}
.kartta-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.kartta-sidebar-title {
    font-weight: 700;
    color: #2c5f9e;
    margin: 0;
}
/* Close (X) — only meaningful on mobile */
.kartta-sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #999;
    cursor: pointer;
}
/* Floating toggle button — hidden on desktop, shown on mobile */
.kartta-toggle {
    display: none;
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1001;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}
.kartta-filter-group { margin-bottom: 16px; }
.kartta-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
}
.kartta-sidebar select,
.kartta-sidebar input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fbfd;
}
.kartta-check {
    display: block;
    font-weight: 400;
    font-size: 14px;
    margin-bottom: 4px;
    cursor: pointer;
}
.kartta-check input { width: auto; margin-right: 6px; }
.kartta-range {
    display: flex;
    align-items: center;
    gap: 6px;
}
.kartta-range input { flex: 1; }
.kartta-range span { color: #aaa; }
.kartta-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}
.kartta-actions .main-gradient-button { width: 100%; padding: 10px; }
.kartta-clear-btn {
    width: 100%;
    padding: 9px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #555;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.kartta-clear-btn:hover { background: #e6e6e6; }
.kartta-count {
    margin-top: 14px;
    font-size: 13px;
    color: #777;
    text-align: center;
}
.kartta-map-wrap { position: absolute; inset: 0; }
#kartta-map { width: 100%; height: 100%; }

@media (max-width: 767px) {
    /* Panel hidden behind a toggle button; opens as an overlay card */
    .kartta-toggle { display: inline-flex; }
    .kartta-sidebar {
        display: none;
        top: 64px;
        left: 14px;
        right: 14px;
        width: auto;
        max-height: calc(100% - 80px);
    }
    .kartta-sidebar.open { display: block; }
    .kartta-sidebar-close { display: block; }
}

/* ===== Messaging (Viestit) ===== */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    background: #dc3545;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    vertical-align: middle;
}

/* Conversation list */
.msg-conv-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.msg-conv {
    display: block;
    background: #fff;
    border: 1px solid #e6eef6;
    border-radius: 12px;
    padding: 14px 18px;
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.2s, transform 0.2s;
}
.msg-conv:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    text-decoration: none;
    color: #333;
}
.msg-conv-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.msg-conv-top strong { color: #2c5f9e; }
.msg-conv-time {
    margin-left: auto;
    font-size: 12px;
    color: #aaa;
}
.msg-conv-listing {
    font-size: 13px;
    color: #3d7dca;
    margin-top: 2px;
}
.msg-conv-snippet {
    font-size: 14px;
    color: #777;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Thread view */
.msg-thread-head {
    margin: 10px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.msg-thread-head h3 { font-weight: 700; color: #2c5f9e; margin: 0; }
.msg-thread {
    background: #f5f9fd;
    border-radius: 12px;
    padding: 18px;
    max-height: 460px;
    overflow-y: auto;
    margin-bottom: 14px;
}
.msg-row {
    display: flex;
    margin-bottom: 10px;
}
.msg-row.msg-mine { justify-content: flex-end; }
.msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    position: relative;
}
.msg-theirs .msg-bubble {
    background: #fff;
    border: 1px solid #e6eef6;
    border-bottom-left-radius: 4px;
}
.msg-mine .msg-bubble {
    background: linear-gradient(-145deg, #3d7dca 0%, #5a96d6 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-time {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}
.msg-reply-form textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    resize: vertical;
}
.msg-reply-form button { margin-top: 8px; }

/* Listing detail — extended fields table */
.listing-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0;
}
.listing-detail-table th {
    text-align: left;
    font-weight: 600;
    color: #2c5f9e;
    font-size: 14px;
    padding: 6px 12px 6px 0;
    white-space: nowrap;
    vertical-align: top;
    width: 42%;
}
.listing-detail-table td {
    padding: 6px 0;
    font-size: 14px;
    color: #444;
}

/* Guide page (miten-toimii.php) */
.guide-hero {
    background: linear-gradient(rgba(20, 35, 45, 0.55), rgba(20, 35, 45, 0.65)),
                url('../images/forest-hero.jpg') center center / cover no-repeat;
}
.guide-steps {
    margin-top: 10px;
}
.guide-step {
    text-align: center;
    padding: 24px 18px;
    height: 100%;
}
.guide-step-num {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    line-height: 54px;
}
.guide-step h5 {
    font-weight: 700;
    margin-bottom: 8px;
    color: #2c5f9e;
}
.guide-step p {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}
.guide-fact {
    background: #fff;
    border-left: 4px solid #3d7dca;
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
.guide-fact p {
    font-size: 17px;
    line-height: 1.6;
    margin-bottom: 6px;
}
.guide-fact a {
    color: #3d7dca;
    font-weight: 600;
    font-size: 14px;
}

/* About page (tietoa.php) bullet lists and body text */
.tietoa-content p {
    font-size: 20px;
    line-height: 1.6;
}
.tietoa-list {
    list-style: none;
    padding-left: 0;
    margin: 16px 0;
}
.tietoa-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 18px;
}
.tietoa-list li::before {
    content: "🫐";
    position: absolute;
    left: 0;
    top: 0;
}

/* Social share buttons on listing detail */
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.share-buttons h6 {
    width: 100%;
    margin: 0 0 4px 0;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    text-decoration: none;
    color: #fff;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}
.share-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
    color: #fff;
    text-decoration: none;
}
.share-fb    { background: #1877f2; }
.share-x     { background: #000; }
.share-wa    { background: #25d366; }
.share-email { background: #6c757d; }
.share-copy  { background: #3d7dca; }

/* Map filters under "Ilmoitukset kartalla" */
.map-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 15px;
    position: relative;
    z-index: 5;
}
.map-filters .filter-pill {
    padding: 5px 14px;
    font-size: 13px;
    position: relative;
    z-index: 5;
    cursor: pointer;
}

/* ===== Global max font size (page/section headings only) ===== */
/* line-height must be unitless so it scales with the clamped font-size —
   the template's fixed px line-heights (e.g. 74px) leave huge gaps on mobile */
.main-banner .header-text h2,
.page-heading h1,
.simple-cta h4,
.section-heading h4 {
    font-size: clamp(20px, 4vw, 42px) !important;
    line-height: 1.2 !important;
}

/* Service cards — keep small */
.service-item h4 {
    font-size: 16px !important;
}

/* Tighter heading margins */
.section-heading {
    margin-bottom: 15px !important;
}
.section-heading h4 {
    margin-bottom: 5px !important;
    text-transform: none !important;
}
.section-heading h6 {
    margin-bottom: 5px !important;
}
.main-banner .header-text h2 {
    margin-bottom: 10px !important;
}
.main-banner .header-text p {
    margin-bottom: 15px !important;
}

/* Search input */
.search-box {
    max-width: 400px;
    margin: 0 auto 20px;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    background: #f9f9f9;
    transition: border-color 0.3s;
}
.search-box input:focus {
    border-color: #3d7dca;
    outline: none;
    background: #fff;
}
.search-box i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
}

/* ===== Flash Messages =====
   Header is position:absolute, height 110px — push the first alert
   below it so it isn't hidden under the header banner. */
.alert {
    margin-top: 130px;
    border-radius: 10px;
    position: relative;
    z-index: 50;
}
.alert + .alert {
    margin-top: 10px;
}

/* ===== Listing Cards ===== */
.listing-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.listing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.listing-card img.listing-photo {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #eef3f9;
}

.listing-photo-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(-145deg, rgba(61, 125, 202, 0.15) 0%, rgba(155, 211, 236, 0.15) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #3d7dca;
}

.listing-card-body {
    padding: 20px;
}

.listing-card-body h5 {
    margin: 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.listing-card-body h5 a {
    color: #4a4a4a;
    text-decoration: none;
}

.listing-card-body h5 a:hover {
    color: #3d7dca;
}

.listing-price {
    font-size: 20px;
    font-weight: 700;
    color: #3d7dca;
    margin: 4px 0;
}

.listing-location,
.listing-seller {
    font-size: 13px;
    color: #888;
    margin: 2px 0;
}

.listing-location i,
.listing-seller i {
    width: 16px;
    margin-right: 4px;
}

/* Badge for berry type */
.badge-berry {
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Status badges */
.badge-available {
    background: #28a745;
    color: #fff;
}

.badge-sold {
    background: #6c757d;
    color: #fff;
}

.badge-paused {
    background: #ffc107;
    color: #333;
}

.badge-buying {
    background: #17a2b8;
    color: #fff;
}

.badge-fresh {
    background: #28a745;
    color: #fff;
}

.badge-frozen {
    background: #6cb4ee;
    color: #fff;
}

/* ===== Filters ===== */
.filters ul li {
    cursor: pointer;
    display: inline-block;
}

.filters ul li span {
    display: inline-block;
    transition: opacity 0.3s;
}

.filters ul li:not(.active) span {
    opacity: 0.6;
    background: #ddd;
    color: #666;
}

.filters ul li:hover span {
    opacity: 1;
}

/* Location filter */
.filters-location ul li {
    cursor: pointer;
    display: inline-block;
}

.filters-location ul li.active span {
    background: #3d7dca !important;
    color: #fff !important;
    border-color: #3d7dca !important;
}

.filters-location ul li:hover span {
    background: #e6f1fa;
}

/* Server-side filter pills (ilmoitukset.php) */
a.filter-pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: #e8e8e8;
    color: #555;
    transition: all 0.3s;
}
a.filter-pill:hover {
    background: #3d7dca;
    color: #fff;
    text-decoration: none;
}
/* .active must come AFTER :hover so it wins at equal specificity */
a.filter-pill.active,
a.filter-pill.active:hover {
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
}

a.filter-pill-sm {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: #e0e0e0;
    color: #444;
    transition: all 0.3s;
}
a.filter-pill-sm.active {
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
}
a.filter-pill-sm:hover {
    background: #3d7dca;
    color: #fff;
    text-decoration: none;
}

a.filter-pill-loc {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid #4585c0;
    color: #2c5f9e;
    background: #fff;
    transition: all 0.3s;
}
a.filter-pill-loc.active {
    background: #4585c0;
    color: #fff;
    border-color: #4585c0;
}
a.filter-pill-loc:hover {
    background: #d3e7f5;
    text-decoration: none;
}

/* ===== Pagination ===== */
.pagination-nav {
    margin-top: 20px;
    margin-bottom: 40px;
}
.pagination {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}
.pagination li a,
.pagination li span {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    color: #4a4a4a;
    background: #f5f5f5;
    border: 1px solid #eee;
    transition: all 0.3s;
}
.pagination li a:hover {
    background: #3d7dca;
    color: #fff;
    border-color: #3d7dca;
}
.pagination li.active span {
    background: linear-gradient(-145deg, #3d7dca 0%, #9bd3ec 100%);
    color: #fff;
    border-color: #3d7dca;
}
.pagination li.disabled span {
    opacity: 0.4;
    cursor: default;
}

/* ===== Forms ===== */
.form-page {
    padding-top: 140px;
    padding-bottom: 60px;
    min-height: 80vh;
}

.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: #fff;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.form-container h2 {
    margin-bottom: 24px;
    font-weight: 700;
    color: #4a4a4a;
}

.form-container .form-group {
    margin-bottom: 16px;
}

.form-container label {
    font-weight: 600;
    font-size: 14px;
    color: #4a4a4a;
    margin-bottom: 6px;
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="number"],
.form-container input[type="tel"],
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #f9f9f9;
}

.form-container input:focus,
.form-container select:focus,
.form-container textarea:focus {
    border-color: #3d7dca;
    outline: none;
    background: #fff;
}

.form-container textarea {
    min-height: 100px;
    resize: vertical;
}

.form-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 4px;
}

/* Google OAuth button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s;
    text-decoration: none;
}

.btn-google:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
    text-decoration: none;
}

.btn-google img {
    width: 20px;
    height: 20px;
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #aaa;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.divider span {
    padding: 0 12px;
}

/* ===== Form Tables ===== */
.form-table {
    width: 100%;
    border-collapse: collapse;
}

.form-table th,
.form-table td {
    padding: 10px 12px;
    vertical-align: top;
    border-bottom: 1px solid #f0f0f0;
}

.form-table th {
    width: 160px;
    text-align: right;
    font-weight: 600;
    font-size: 14px;
    color: #4a4a4a;
    padding-top: 18px;
    white-space: nowrap;
}

.form-table td {
    padding-top: 10px;
}

.form-table td input[type="text"],
.form-table td input[type="email"],
.form-table td input[type="password"],
.form-table td input[type="number"],
.form-table td input[type="tel"],
.form-table td select,
.form-table td textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #f9f9f9;
    box-sizing: border-box;
}

.form-table td input:focus,
.form-table td select:focus,
.form-table td textarea:focus {
    border-color: #3d7dca;
    outline: none;
    background: #fff;
}

.form-table td textarea {
    min-height: 160px;
    resize: vertical;
}

.form-table .map-pin-selector {
    height: 400px;
}

.form-table tr:last-child th,
.form-table tr:last-child td {
    border-bottom: none;
}

.form-table small {
    display: block;
    margin-top: 4px;
}

@media (max-width: 600px) {
    .form-table th {
        display: block;
        width: 100%;
        text-align: left;
        padding-bottom: 2px;
    }
    .form-table td {
        display: block;
        width: 100%;
        padding-top: 0;
    }
}

/* ===== Dashboard ===== */
.dashboard-section {
    padding-top: 140px;
    padding-bottom: 60px;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.dashboard-table th {
    font-weight: 600;
    color: #4a4a4a;
    background: #f9f9f9;
}

.dashboard-table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-edit {
    background: #3d7dca;
    color: #fff;
}

.btn-edit:hover {
    background: #3570b8;
    color: #fff;
    text-decoration: none;
}

.btn-delete {
    background: #dc3545;
    color: #fff;
}

.btn-delete:hover {
    background: #c82333;
    color: #fff;
}

/* ===== Map ===== */
#map {
    border-radius: 15px;
    overflow: hidden;
}

.map-pin-selector {
    height: 300px;
    border-radius: 10px;
    border: 1px solid #ddd;
    margin-top: 8px;
}

/* ===== Page Heading (for subpages) ===== */
section.page-heading {
    margin-top: 80px !important;
    padding-bottom: 0 !important;
}
section.page-heading .header-text {
    padding-bottom: 15px !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
}
section.page-heading .header-text h1 {
    margin-bottom: 0;
}
section.page-heading .header-text h4 {
    margin-bottom: 5px;
}

/* ===== Listing Detail ===== */
.listing-detail {
    margin-top: 0;
    padding-top: 120px;
    padding-bottom: 60px;
}

.listing-detail-photo {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    border-radius: 15px;
}

.listing-detail-info {
    background: #fff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.listing-detail-info h2 {
    font-weight: 700;
    margin-bottom: 8px;
}

.seller-info {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.seller-info h5 {
    margin-bottom: 12px;
    font-weight: 600;
}

.protected-info {
    color: #888;
    font-style: italic;
    font-size: 13px;
}

/* ===== Photo Upload ===== */
.photo-upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
    background: #f9f9f9;
}

.photo-upload-area:hover {
    border-color: #3d7dca;
}

.photo-upload-area img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
}

/* ===== Responsive fixes ===== */
@media (max-width: 991px) {
    .form-page,
    .dashboard-section,
    .listing-detail {
        padding-top: 100px;
    }

    .form-container {
        margin: 0 15px;
        padding: 25px;
    }
}

/* Grid layout for listings */
#listings-grid {
    display: flex;
    flex-wrap: wrap;
}
