/* ── Plot Buddies — Shared Styles (PWA + Sunlight + Touch + Bottom Nav) ──── */

/* ═══════════════════════════════════════════════════════════════════════════
   SUNLIGHT MODE — high contrast for outdoor use
   ═══════════════════════════════════════════════════════════════════════════ */

body.sunlight-mode {
    --bg: #fafaf7 !important;
    --bg-card: #ffffff !important;
    --bg-card-hover: #f0f0ea !important;
    --border: #666666 !important;
    --text: #1a1a1a !important;
    --text-dim: #444444 !important;
    --accent: #2d6a27 !important;
    --accent-glow: rgba(45, 106, 39, 0.15) !important;
    --danger: #c0392b !important;
    --danger-bg: rgba(192, 57, 43, 0.08) !important;
    --shadow: 0 2px 12px rgba(0,0,0,0.15) !important;
    --herb: #2d6a27 !important;
    --veggie: #c0651a !important;
    --fruit: #c02040 !important;
    --gold: #b8860b !important;
    font-size: 17px !important;
}

body.sunlight-mode::before {
    background: none !important;
}

body.sunlight-mode .site-header {
    background: #ffffff !important;
    border-bottom: 2px solid #333 !important;
    backdrop-filter: none !important;
}

body.sunlight-mode .card {
    background: #ffffff !important;
    border: 2px solid #555 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

body.sunlight-mode .card:hover {
    border-color: #2d6a27 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
}

body.sunlight-mode .hero h1,
body.sunlight-mode .page-header h1 {
    background: none !important;
    -webkit-text-fill-color: #1a3a16 !important;
    color: #1a3a16 !important;
}

body.sunlight-mode .search-wrap input {
    background: #ffffff !important;
    border: 2px solid #555 !important;
    color: #1a1a1a !important;
}

body.sunlight-mode .search-wrap input:focus {
    border-color: #2d6a27 !important;
    box-shadow: 0 0 0 4px rgba(45, 106, 39, 0.2) !important;
}

body.sunlight-mode .search-results {
    background: #ffffff !important;
}

body.sunlight-mode .badge {
    font-weight: 700 !important;
}

body.sunlight-mode .stats-bar .stat-card {
    background: #ffffff !important;
    border: 2px solid #555 !important;
}

body.sunlight-mode .zone-btn {
    background: #eee !important;
    border: 2px solid #888 !important;
    color: #333 !important;
}

body.sunlight-mode .zone-btn.active {
    background: #2d6a27 !important;
    color: #fff !important;
}

body.sunlight-mode a {
    color: #1a5a1a !important;
}

body.sunlight-mode .nav-links a {
    color: #333 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUNLIGHT TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.sunlight-toggle {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.sunlight-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.08);
}

.sunlight-toggle:active {
    transform: scale(0.95);
    background: var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOUCH UX IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Larger tap targets (WCAG: min 44x44) */
.site-header .nav-links a {
    padding: 10px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-radius: 8px;
}

.search-wrap input {
    min-height: 48px;
}

.card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.card:active {
    transform: scale(0.98);
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.zone-btn {
    min-height: 44px;
    min-width: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

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

/* Active states for taps (no hover reliance) */
a:active, button:active, .card:active {
    opacity: 0.85;
}

/* Spacing between clickable elements */
.card-grid { gap: 20px; }
.zone-btn-row { gap: 10px; }
.nav-links { gap: 6px; }

/* Prevent text selection on interactive elements */
.zone-btn, .card, .sunlight-toggle, .bottom-nav-link {
    -webkit-user-select: none;
    user-select: none;
}

/* Pull-to-refresh feel — subtle overscroll behavior */
body {
    overscroll-behavior-y: contain;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION BAR (thumb zone)
   ═══════════════════════════════════════════════════════════════════════════ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 1000;
    padding: 4px 0;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.bottom-nav-list {
    display: flex;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0 8px;
    max-width: 600px;
    margin: 0 auto;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-dim);
    padding: 6px 10px;
    min-width: 56px;
    min-height: 52px;
    border-radius: 12px;
    transition: color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
    font-size: 0.7rem;
    gap: 2px;
}

.bottom-nav-link .bn-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.bottom-nav-link .bn-label {
    font-size: 0.65rem;
    font-weight: 500;
}

.bottom-nav-link:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

.bottom-nav-link:active {
    transform: scale(0.92);
    background: var(--accent-glow);
}

.bottom-nav-link.active {
    color: var(--accent);
    font-weight: 700;
}

.bottom-nav-link.active::before {
    content: '';
    position: absolute;
    top: 2px;
    width: 20px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.bottom-nav-link {
    position: relative;
}

/* Body padding for bottom nav */
body.has-bottom-nav {
    padding-bottom: 80px;
}

body.has-bottom-nav main {
    padding-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — hide desktop nav on mobile, show bottom nav
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
    body.has-bottom-nav {
        padding-bottom: 0;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none !important;
    }
    .site-header .container {
        justify-content: space-between;
    }
    .site-header {
        padding: 10px 0;
    }
    .bottom-nav {
        display: block;
    }
    body.has-bottom-nav {
        padding-bottom: 80px;
    }
    /* Make search in hero full width on mobile */
    .hero .search-wrap {
        max-width: 100%;
    }
    /* Larger touch-friendly inputs */
    select, input[type="text"], input[type="search"], textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOUCH-FRIENDLY SCROLLBARS
   ═══════════════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}
