/* =============================================
   Frish Design System — Lunaria Palette
   ============================================= */

/* --- Light Theme (default) --- */
:root,
[data-theme="light"] {
    --bg: #ebe4e1;
    --bg-emph: #f5eeea;
    --bg-deemph: #d5cfcc;
    --fg: #484646;
    --fg-emph: #3e3c3d;
    --fg-deemph: #827e7d;

    --soft-blue: #566e85;
    --soft-green: #5a7259;
    --soft-red: #886051;
    --soft-violet: #6c6686;

    --vivid-blue: #124d71;
    --vivid-green: #3b6a39;
    --vivid-red: #8b4a2c;

    --bg-blue: #3889b4;
    --bg-green: #3a926f;
    --bg-red: #b86364;
    --bg-dark-blue: #004d6c;
    --bg-light-yellow: #f7cb46;

    /* Surfaces & borders */
    --surface: #f5eeea;
    --surface-raised: #ffffff;
    --border: #d5cfcc;
    --border-focus: #3889b4;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.12);

    /* Map tiles */
    --map-filter: none;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg: #36464e;
    --bg-emph: #263941;
    --bg-deemph: #404f56;
    --fg: #caced8;
    --fg-emph: #dfe2ed;
    --fg-deemph: #78828a;

    --soft-blue: #799dc0;
    --soft-green: #82a284;
    --soft-red: #be8a7e;
    --soft-violet: #9693c2;

    --vivid-blue: #53a1de;
    --vivid-green: #8acc86;
    --vivid-red: #ff9a7b;

    --bg-blue: #4189b6;
    --bg-green: #419278;
    --bg-red: #b3686d;
    --bg-dark-blue: #005376;

    /* Keep yellow same */
    --bg-light-yellow: #f7cb46;

    /* Surfaces & borders */
    --surface: #2e3e46;
    --surface-raised: #3a4a52;
    --border: #4a5a62;
    --border-focus: #53a1de;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.35);

    /* Map tiles */
    --map-filter: brightness(0.85) contrast(1.1) saturate(0.8);
}

/* --- Tokens --- */
:root {
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --line-height: 1.5;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --sidebar-width: 220px;
    --header-height: 56px;
    --bottom-nav-height: 60px;
    --content-max-width: 1200px;
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--fg);
    line-height: var(--line-height);
    min-height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
}

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

a:hover {
    text-decoration: underline;
}

/* =============================================
   App Shell
   ============================================= */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header {
    background: var(--bg-dark-blue);
    color: #fff;
    padding: 0 var(--space-md);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

header h1 {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.theme-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: background var(--transition-fast);
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.15);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* --- Main Content --- */
#content {
    flex: 1;
    padding: var(--space-md);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-md));
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

/* =============================================
   Bottom Navigation (Mobile)
   ============================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-raised);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: var(--space-xs) 0;
    height: var(--bottom-nav-height);
    z-index: 100;
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.bottom-nav.hidden {
    display: none;
}

.nav-btn {
    background: none;
    border: none;
    font-size: var(--text-xs);
    padding: var(--space-xs) var(--space-sm);
    color: var(--fg-deemph);
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    width: auto;
    margin: 0;
}

.nav-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-btn:hover {
    color: var(--fg);
    background: var(--bg-deemph);
}

.nav-btn.active {
    color: var(--vivid-blue);
    background: transparent;
}

/* Nav label */
.nav-label {
    font-size: var(--text-xs);
    line-height: 1;
}

/* =============================================
   Forms
   ============================================= */
.form-group {
    margin-bottom: var(--space-md);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--fg-emph);
}

input[type="text"],
input[type="datetime-local"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    background: var(--surface-raised);
    color: var(--fg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(56,137,180,0.15);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

small, .form-text {
    display: block;
    font-size: var(--text-xs);
    color: var(--fg-deemph);
    margin-top: var(--space-xs);
}

/* =============================================
   Buttons
   ============================================= */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    background: var(--bg-dark-blue);
    color: #fff;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    cursor: pointer;
    width: 100%;
    margin-top: var(--space-sm);
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

button:hover, .btn:hover {
    filter: brightness(1.1);
}

button:active, .btn:active {
    transform: scale(0.98);
}

button.secondary, .btn-secondary {
    background: var(--bg-deemph);
    color: var(--fg-emph);
}

button.secondary:hover, .btn-secondary:hover {
    background: var(--border);
}

button.danger, .btn-danger {
    background: var(--bg-red);
    color: #fff;
}

button.danger:hover, .btn-danger:hover {
    background: var(--vivid-red);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =============================================
   Image Preview & Thumbnails
   ============================================= */
.image-preview {
    margin-top: var(--space-sm);
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.image-thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.image-thumb {
    position: relative;
    width: 80px;
    height: 80px;
}

.image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.remove-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    border-radius: var(--radius-full);
    background: var(--bg-red);
    color: white;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    border: 2px solid var(--surface-raised);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   Fish Cards
   ============================================= */
.fish-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.fish-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base);
    cursor: pointer;
}

.fish-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Fish Gallery */
.fish-gallery {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.fish-gallery::-webkit-scrollbar {
    display: none;
}

.fish-gallery img {
    min-width: 100%;
    height: 220px;
    object-fit: cover;
    scroll-snap-align: start;
}

.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: var(--space-sm) 0;
    background: var(--surface-raised);
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--border);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.gallery-dot.active {
    background: var(--vivid-blue);
}

.fish-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.fish-card-content {
    padding: var(--space-md);
}

.fish-card h3 {
    margin-bottom: var(--space-sm);
    font-size: var(--text-lg);
    color: var(--fg-emph);
}

.fish-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--fg-deemph);
    margin-bottom: var(--space-sm);
}

.fish-meta span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.fish-notes {
    font-style: italic;
    margin: var(--space-sm) 0;
    color: var(--fg-deemph);
}

.fish-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.fish-actions button {
    flex: 1;
    margin: 0;
}

/* =============================================
   Fly Cards
   ============================================= */
.flies-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.fly-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-base);
}

.fly-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.fly-card img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.fly-card h3 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--fg-emph);
}

.fly-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.fly-actions button {
    flex: 1;
    margin: 0;
}

.fly-edit-form {
    padding: var(--space-sm);
}

.fly-edit-form .form-group {
    margin-bottom: 0.75rem;
}

.fly-edit-form input[type="text"],
.fly-edit-form textarea {
    font-size: var(--text-sm);
    padding: var(--space-sm);
}

/* =============================================
   Map
   ============================================= */
#map {
    height: 400px;
    width: 100%;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.leaflet-tile-pane {
    filter: var(--map-filter);
}

/* =============================================
   View Controls
   ============================================= */
#view-controls {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

#view-controls button {
    flex: 1;
    margin: 0;
}

/* =============================================
   Utility Classes
   ============================================= */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: var(--space-md);
}

.mb-2 {
    margin-bottom: var(--space-md);
}

/* =============================================
   Loading Indicator
   ============================================= */
.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--fg-deemph);
}

/* =============================================
   Flash Messages
   ============================================= */
.flash {
    padding: 0.75rem var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
}

.flash.success {
    background: rgba(58,146,111,0.15);
    color: var(--vivid-green);
    border: 1px solid rgba(58,146,111,0.3);
}

.flash.error {
    background: rgba(184,99,100,0.15);
    color: var(--vivid-red);
    border: 1px solid rgba(184,99,100,0.3);
}

/* =============================================
   Settings / Token Display
   ============================================= */
.token-display {
    background: var(--bg-deemph);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    word-break: break-all;
    margin: var(--space-md) 0;
    color: var(--fg-emph);
}

/* =============================================
   Choices.js Overrides
   ============================================= */
.choices {
    width: 100%;
    margin-bottom: var(--space-sm);
}

.choices__inner {
    background-color: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-height: 45px;
    font-size: var(--text-base);
    color: var(--fg);
}

.choices__input {
    font-size: var(--text-base);
    padding: var(--space-sm);
    background: transparent;
    color: var(--fg);
}

.choices__list--dropdown {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    background: var(--surface-raised);
    border: 1px solid var(--border);
}

.choices__list--dropdown .choices__item--selectable {
    font-size: var(--text-sm);
    padding: 0.75rem;
    color: var(--fg);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--bg-dark-blue);
    color: white;
}

/* =============================================
   Responsive: Tablet (≥640px)
   ============================================= */
@media (min-width: 640px) {
    .fish-list {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .fish-gallery img {
        height: 240px;
    }
}

/* =============================================
   Responsive: Desktop (≥1024px)
   ============================================= */
@media (min-width: 1024px) {
    /* Convert bottom nav to sidebar */
    .bottom-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        right: auto;
        width: var(--sidebar-width);
        flex-direction: column;
        justify-content: flex-start;
        padding: var(--space-md) var(--space-sm);
        gap: var(--space-xs);
        border-top: none;
        border-right: 1px solid var(--border);
        height: auto;
        z-index: 50;
    }

    .nav-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
        font-size: var(--text-sm);
        border-radius: var(--radius-md);
    }

    .nav-btn.active {
        background: var(--bg-deemph);
        color: var(--vivid-blue);
    }

    .nav-label {
        font-size: var(--text-sm);
    }

    /* Offset content for sidebar */
    #content {
        margin-left: var(--sidebar-width);
        padding-bottom: var(--space-md);
    }

    .fish-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .flies-list {
        grid-template-columns: repeat(3, 1fr);
    }

    #map {
        height: 500px;
    }
}

/* =============================================
   Mobile-friendly dropdown
   ============================================= */
@media (max-width: 639px) {
    .choices__list--dropdown {
        max-height: 250px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =============================================
   Fish Detail Page
   ============================================= */
.detail-page {
    max-width: 800px;
    margin: 0 auto;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    width: auto;
    padding: var(--space-sm) var(--space-md);
}

.detail-hero {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-md);
}

.detail-hero .fish-gallery img {
    height: 300px;
}

.detail-content {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
}

.detail-title {
    font-size: var(--text-2xl);
    color: var(--fg-emph);
    margin-bottom: var(--space-md);
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg);
    border-radius: var(--radius-md);
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-meta-label {
    font-size: var(--text-xs);
    color: var(--fg-deemph);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.detail-meta-value {
    font-size: var(--text-base);
    color: var(--fg-emph);
}

.detail-notes {
    margin-bottom: var(--space-lg);
}

.detail-notes h3 {
    font-size: var(--text-sm);
    color: var(--fg-deemph);
    margin-bottom: var(--space-xs);
}

.detail-notes p {
    font-style: italic;
    color: var(--fg);
}

.detail-map-container {
    margin-bottom: var(--space-lg);
}

.detail-map-container h3 {
    font-size: var(--text-sm);
    color: var(--fg-deemph);
    margin-bottom: var(--space-sm);
}

#detail-map {
    height: 250px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.detail-actions {
    display: flex;
    gap: var(--space-sm);
}

.detail-actions button {
    flex: 1;
    margin: 0;
}

@media (min-width: 640px) {
    .detail-meta-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .detail-hero .fish-gallery img {
        height: 400px;
    }

    #detail-map {
        height: 300px;
    }
}

/* =============================================
   Profile Page
   ============================================= */
.profile-page {
    max-width: 700px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--bg-deemph);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-deemph);
}

.profile-username {
    font-size: var(--text-xl);
    color: var(--fg-emph);
}

.profile-section {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-md);
}

.profile-section h3 {
    font-size: var(--text-lg);
    color: var(--fg-emph);
    margin-bottom: var(--space-md);
}

.token-group {
    margin-bottom: var(--space-md);
}

.token-actions {
    display: flex;
    gap: var(--space-sm);
}

.token-actions button {
    flex: 1;
    margin: 0;
}

/* =============================================
   Stats Grid
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--vivid-blue);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--fg-deemph);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* =============================================
   Species Bar Chart
   ============================================= */
.top-species {
    margin-bottom: var(--space-lg);
}

.top-species h4 {
    font-size: var(--text-sm);
    color: var(--fg-deemph);
    margin-bottom: var(--space-sm);
}

.species-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.species-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.species-bar-label {
    font-size: var(--text-sm);
    color: var(--fg);
    min-width: 120px;
    flex-shrink: 0;
}

.species-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-deemph);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.species-bar-fill {
    height: 100%;
    background: var(--bg-blue);
    border-radius: var(--radius-full);
    min-width: 4px;
    transition: width var(--transition-slow);
}

.species-bar-count {
    font-size: var(--text-sm);
    color: var(--fg-deemph);
    min-width: 24px;
    text-align: right;
}

.recent-record h4 {
    font-size: var(--text-sm);
    color: var(--fg-deemph);
    margin-bottom: var(--space-xs);
}

/* =============================================
   Custom Map Markers
   ============================================= */
.custom-fish-marker {
    background: transparent;
    border: none;
}

.map-popup {
    min-width: 140px;
}

.map-popup b {
    font-size: var(--text-sm);
}

.map-popup small {
    color: var(--fg-deemph);
}

/* =============================================
   Toast Notifications
   ============================================= */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    right: var(--space-md);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    background: var(--surface-raised);
    color: var(--fg);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    pointer-events: auto;
    animation: toastIn 300ms ease, toastOut 300ms ease 2700ms forwards;
    border-left: 3px solid var(--bg-green);
}

.toast.error {
    border-left-color: var(--bg-red);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(30px); }
}

/* =============================================
   Skeleton Loaders
   ============================================= */
.skeleton {
    background: linear-gradient(90deg, var(--bg-deemph) 25%, var(--bg) 50%, var(--bg-deemph) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-card {
    height: 280px;
    border-radius: var(--radius-lg);
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-sm);
}

.skeleton-text.short {
    width: 60%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================
   Page Transitions
   ============================================= */
#content {
    animation: fadeIn var(--transition-base) ease;
}

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

/* =============================================
   View Control Active State
   ============================================= */
#view-controls button.active {
    background: var(--bg-dark-blue);
    color: #fff;
}

/* =============================================
   Personal Record Badge
   ============================================= */
.pr-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: linear-gradient(135deg, var(--bg-light-yellow), #f0a030);
    color: #3e3c3d;
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pr-badge svg {
    width: 12px;
    height: 12px;
}

/* =============================================
   Species Collection Counter
   ============================================= */
.species-counter {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--bg-deemph);
    color: var(--fg-emph);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
}

/* =============================================
   Streak Tracker
   ============================================= */
.streak-card {
    background: linear-gradient(135deg, var(--bg-dark-blue), var(--bg-blue));
    color: #fff;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
}

.streak-value {
    font-size: var(--text-3xl);
    font-weight: 700;
}

.streak-label {
    font-size: var(--text-sm);
    opacity: 0.85;
}
