/* === Grounded Companion Theme === */
/* Backyard / microscopic insect aesthetic */

:root {
    --color-yard: #1a1a0e;
    --color-yard-dark: #111108;
    --color-leaf: #7cfc00;
    --color-amber: #daa520;
    --color-amber-dim: #8b6914;
    --color-danger: #dc2626;
    --color-spicy: #ff6b35;
    --color-fresh: #00bfff;
    --color-salty: #e0e0e0;
    --color-sour: #c8ff00;
}

/* Tailwind custom colors via config */
@layer base {
    body {
        background-color: var(--color-yard);
        color: var(--color-leaf);
        font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
        background-image:
            radial-gradient(ellipse at 20% 50%, rgba(124, 252, 0, 0.02) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(218, 165, 32, 0.03) 0%, transparent 50%),
            radial-gradient(ellipse at 50% 80%, rgba(124, 252, 0, 0.01) 0%, transparent 50%);
    }
}

/* Tailwind custom utilities */
.bg-yard { background-color: var(--color-yard); }
.bg-yard-dark { background-color: var(--color-yard-dark); }
.text-leaf { color: var(--color-leaf); }
.text-amber { color: var(--color-amber); }
.border-amber { border-color: var(--color-amber); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-yard-dark); }
::-webkit-scrollbar-thumb { background: var(--color-amber-dim); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-amber); }

/* Tab buttons */
.tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(218, 165, 32, 0.6);
    white-space: nowrap;
    border-radius: 0.5rem 0.5rem 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
}
.tab-btn:hover {
    color: var(--color-amber);
    background: rgba(218, 165, 32, 0.08);
}
.tab-btn.active {
    color: var(--color-leaf);
    background: rgba(124, 252, 0, 0.08);
    border-color: rgba(218, 165, 32, 0.3);
}

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards */
.card {
    background: linear-gradient(135deg, rgba(26, 26, 14, 0.9), rgba(17, 17, 8, 0.95));
    border: 1px solid rgba(218, 165, 32, 0.2);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s;
}
.card:hover {
    border-color: rgba(218, 165, 32, 0.5);
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.08);
    transform: translateY(-1px);
}

/* Boss cards are larger */
.boss-card {
    background: linear-gradient(135deg, rgba(26, 26, 14, 0.9), rgba(40, 10, 10, 0.3));
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.2s;
}
.boss-card:hover {
    border-color: rgba(220, 38, 38, 0.6);
    box-shadow: 0 0 25px rgba(220, 38, 38, 0.1);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-tier1 { background: rgba(124, 252, 0, 0.15); color: var(--color-leaf); border: 1px solid rgba(124, 252, 0, 0.3); }
.badge-tier2 { background: rgba(218, 165, 32, 0.15); color: var(--color-amber); border: 1px solid rgba(218, 165, 32, 0.3); }
.badge-tier3 { background: rgba(220, 38, 38, 0.15); color: #ef4444; border: 1px solid rgba(220, 38, 38, 0.3); }

.badge-spicy { background: rgba(255, 107, 53, 0.15); color: var(--color-spicy); border: 1px solid rgba(255, 107, 53, 0.3); }
.badge-fresh { background: rgba(0, 191, 255, 0.15); color: var(--color-fresh); border: 1px solid rgba(0, 191, 255, 0.3); }
.badge-salty { background: rgba(224, 224, 224, 0.15); color: var(--color-salty); border: 1px solid rgba(224, 224, 224, 0.3); }
.badge-sour { background: rgba(200, 255, 0, 0.15); color: var(--color-sour); border: 1px solid rgba(200, 255, 0, 0.3); }

.badge-generic { background: rgba(124, 252, 0, 0.1); color: var(--color-leaf); border: 1px solid rgba(124, 252, 0, 0.2); }
.badge-chopping { background: rgba(165, 42, 42, 0.2); color: #cd853f; border: 1px solid rgba(165, 42, 42, 0.4); }
.badge-stabbing { background: rgba(138, 43, 226, 0.15); color: #da70d6; border: 1px solid rgba(138, 43, 226, 0.3); }
.badge-busting { background: rgba(218, 165, 32, 0.15); color: var(--color-amber); border: 1px solid rgba(218, 165, 32, 0.3); }

/* Input fields */
.input-field {
    background: var(--color-yard-dark);
    border: 1px solid rgba(218, 165, 32, 0.3);
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    color: var(--color-leaf);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.input-field::placeholder { color: rgba(124, 252, 0, 0.3); }
.input-field:focus { border-color: rgba(124, 252, 0, 0.5); }

.select-field {
    background: var(--color-yard-dark);
    border: 1px solid rgba(218, 165, 32, 0.3);
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    color: var(--color-leaf);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}
.select-field:focus { border-color: rgba(124, 252, 0, 0.5); }

/* Stat bars */
.stat-bar-bg {
    background: rgba(124, 252, 0, 0.1);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.stat-bar-fill.green { background: var(--color-leaf); }
.stat-bar-fill.amber { background: var(--color-amber); }
.stat-bar-fill.red { background: var(--color-danger); }

/* Map filter chips */
.map-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(218, 165, 32, 0.3);
    background: rgba(218, 165, 32, 0.1);
    color: var(--color-amber);
    transition: all 0.2s;
}
.map-filter-chip:hover {
    background: rgba(218, 165, 32, 0.2);
}
.map-filter-chip.active {
    background: rgba(124, 252, 0, 0.15);
    border-color: rgba(124, 252, 0, 0.5);
    color: var(--color-leaf);
}

/* Leaflet map overrides */
#leaflet-map {
    background: #0d0d06;
}
.leaflet-tile-pane { opacity: 0.3; }
.leaflet-popup-content-wrapper {
    background: var(--color-yard-dark) !important;
    color: var(--color-leaf) !important;
    border: 1px solid rgba(218, 165, 32, 0.3) !important;
    border-radius: 0.5rem !important;
}
.leaflet-popup-tip {
    background: var(--color-yard-dark) !important;
}
.leaflet-popup-content {
    color: var(--color-leaf) !important;
    font-size: 0.85rem !important;
}
.leaflet-popup-content b { color: var(--color-amber); }
.leaflet-control-zoom a {
    background: var(--color-yard-dark) !important;
    color: var(--color-leaf) !important;
    border-color: rgba(218, 165, 32, 0.3) !important;
}
.leaflet-control-zoom a:hover {
    background: rgba(218, 165, 32, 0.2) !important;
}

/* Info rows inside cards */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.8rem;
}
.info-label { color: rgba(218, 165, 32, 0.7); }
.info-value { color: var(--color-leaf); font-weight: 500; }

/* Phase progression for mutations */
.phase-block {
    border-left: 3px solid rgba(218, 165, 32, 0.3);
    padding-left: 0.75rem;
    margin: 0.4rem 0;
}
.phase-block.phase1 { border-color: rgba(124, 252, 0, 0.5); }
.phase-block.phase2 { border-color: rgba(218, 165, 32, 0.6); }
.phase-block.phase3 { border-color: rgba(220, 38, 38, 0.6); }

/* Search dropdown */
.search-section-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-amber);
    background: rgba(218, 165, 32, 0.08);
    border-bottom: 1px solid rgba(218, 165, 32, 0.15);
}
.search-result-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(218, 165, 32, 0.08);
    transition: background 0.15s;
}
.search-result-item:hover {
    background: rgba(124, 252, 0, 0.08);
}

/* Strategy text */
.strategy-text {
    font-size: 0.8rem;
    line-height: 1.6;
    color: rgba(124, 252, 0, 0.8);
}

/* Material tags */
.material-tag {
    display: inline-block;
    background: rgba(218, 165, 32, 0.12);
    border: 1px solid rgba(218, 165, 32, 0.2);
    color: var(--color-amber);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    margin: 0.1rem;
}

/* Support / Buy Me a Coffee button */
.support-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a1a0e;
    background: linear-gradient(135deg, var(--color-amber), #f0c040);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.support-btn:hover {
    background: linear-gradient(135deg, #f0c040, var(--color-amber));
    box-shadow: 0 0 12px rgba(218, 165, 32, 0.4);
    transform: translateY(-1px);
}

/* Sticky footer ad */
.ad-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--color-yard-dark);
    border-top: 1px solid rgba(218, 165, 32, 0.2);
    padding: 0.25rem 0;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .tab-btn { padding: 0.4rem 0.6rem; font-size: 0.7rem; }
    #global-search { width: 180px; }
    #search-results-dropdown { width: 320px; }
    #leaflet-map { height: 400px !important; }
}

/* Hide scrollbar for tab navigation */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(124, 252, 0, 0.2);
    border-top-color: var(--color-leaf);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
