﻿/* IslandNotes styles. Colors and sizes live in :root so they're easy to tweak in one place. */

:root {
    --bg: #f7f3e8;            /* cream page background */
    --surface: #fffdf7;       /* cards, sidebar */
    --surface-sunk: #f0ead9;  /* inputs, image wells */
    --border: #e6dcc4;
    --ink: #3b3328;           /* main text, warm dark brown */
    --muted: #7d715f;         /* secondary text */
    --accent: #3a9b6c;        /* leaf green */
    --accent-strong: #2c7d55;
    --accent-soft: #e2f2e8;
    --sun: #f2c14e;           /* highlight yellow */
    --sun-soft: #fdf1cf;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(59, 51, 40, 0.06), 0 4px 12px rgba(59, 51, 40, 0.06);
    --shadow-lift: 0 2px 4px rgba(59, 51, 40, 0.08), 0 10px 24px rgba(59, 51, 40, 0.10);

    --font: "Nunito", ui-rounded, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.01em;
}

h1:focus {
    outline: none;
}

a {
    color: var(--accent-strong);
}

img {
    max-width: 100%;
}

/* ---------- Page header ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 2rem;
}

.page-header .count {
    color: var(--muted);
    font-weight: 600;
    margin-top: 0.25rem;
}

.loading {
    color: var(--muted);
    font-weight: 600;
    padding: 2rem 0;
}

/* ---------- Filters (date + "available" toggle) ---------- */

.filter-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    box-shadow: var(--shadow);
}

.filter-container input[type="datetime-local"] {
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface-sunk);
    border: none;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
}

.filter-container input[type="datetime-local"]:focus-visible {
    outline: 2px solid var(--accent);
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 700;
    user-select: none;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: #d8cfba;
    border-radius: 999px;
    transition: background 0.2s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.switch input:checked + .slider {
    background: var(--accent);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.switch input:focus-visible + .slider {
    outline: 2px solid var(--accent-strong);
    outline-offset: 2px;
}

@media (max-width: 560px) {
    .filter-container {
        width: 100%;
        justify-content: space-between;
        border-radius: var(--radius);
        padding: 0.5rem 0.9rem 0.5rem 0.5rem;
    }
}

/* ---------- Item grid ---------- */

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

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 0.6rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.grid-item:hover,
a.grid-item:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-color: var(--sun);
    outline: none;
}

.item-image {
    width: 76px;
    height: 76px;
    object-fit: contain;
    padding: 6px;
    background: var(--surface-sunk);
    border-radius: 50%;
}

.item-label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-transform: capitalize;
}

@media (max-width: 560px) {
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.6rem;
    }

    .grid-item {
        padding: 0.7rem 0.4rem 0.6rem;
    }

    .item-image {
        width: 60px;
        height: 60px;
    }

    .item-label {
        font-size: 0.8rem;
    }
}

/* Loading placeholders (Components/LoadingGrid.razor) */
.skeleton {
    background: linear-gradient(90deg, var(--surface-sunk) 25%, #f8f3e6 50%, var(--surface-sunk) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-image {
    width: 76px;
    height: 76px;
    border-radius: 50%;
}

.skeleton-label {
    width: 70%;
    height: 0.9rem;
    border-radius: 999px;
}

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

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }
}

@media (max-width: 560px) {
    .skeleton-image {
        width: 60px;
        height: 60px;
    }
}

.item-detail {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}

/* ---------- Detail page ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-decoration: none;
}

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

.detail-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem 2rem;
    align-items: center;
    max-width: 720px;
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-card .item-image {
    width: 140px;
    height: 140px;
    padding: 14px;
}

.detail-card h1 {
    font-size: 2rem;
    text-transform: capitalize;
    margin-bottom: 1rem;
}

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

.stats div {
    background: var(--surface-sunk);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
}

.stats dt {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stats dd {
    margin: 0.15rem 0 0;
    font-weight: 700;
}

@media (max-width: 560px) {
    .detail-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .stats {
        width: 100%;
        text-align: left;
    }
}

/* ---------- Home page ---------- */

.hero {
    background: linear-gradient(135deg, var(--accent) 0%, #5bb98b 100%);
    color: white;
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.hero h1 {
    font-size: 2.1rem;
}

.hero p {
    margin: 0.35rem 0 0;
    font-weight: 600;
    opacity: 0.9;
}

.section-title {
    font-size: 1.25rem;
    margin: 0 0 0.9rem;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    margin-bottom: 2.25rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover,
.stat-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-color: var(--sun);
    outline: none;
}

.stat-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.stat-number {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}

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

.category-grid .grid-item {
    padding: 1.1rem 0.6rem 1rem;
}

/* ---------- Blazor error bar ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--sun-soft);
    color: var(--ink);
    border: 1px solid var(--sun);
    border-radius: var(--radius-sm);
    padding: 0.7rem 2.5rem 0.7rem 1.1rem;
    box-shadow: var(--shadow-lift);
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.6rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius-sm);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
