@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --color-bg: #f1f5f3;
    --color-surface: rgba(255, 255, 255, 0.88);
    --color-surface-strong: #ffffff;
    --color-primary: #1fbf81;
    --color-primary-dark: #0c7c52;
    --color-secondary: #5271ff;
    --color-accent: #f7b500;
    --color-text: #1f2a2e;
    --color-text-soft: #5f6a6f;
    --color-border: rgba(31, 42, 46, 0.08);
    --shadow-soft: 0 20px 45px rgba(31, 89, 71, 0.08);
    --shadow-strong: 0 30px 60px rgba(21, 65, 54, 0.18);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-xl: 42px;
    --blur-backdrop: blur(18px);
    --transition-fast: 180ms ease;
    --transition-medium: 320ms ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0d1513;
        --color-surface: rgba(13, 21, 19, 0.85);
        --color-surface-strong: #17211e;
        --color-text: #ecefee;
        --color-text-soft: #a8b4b0;
        --color-border: rgba(236, 239, 238, 0.08);
        --shadow-soft: 0 25px 60px rgba(0, 0, 0, 0.35);
        --shadow-strong: 0 40px 80px rgba(0, 0, 0, 0.45);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    background: radial-gradient(circle at 15% 25%, rgba(82, 113, 255, 0.16), transparent 45%),
                radial-gradient(circle at 80% 10%, rgba(31, 191, 129, 0.18), transparent 50%),
                var(--color-bg);
    color: var(--color-text);
    display: flex;
    justify-content: center;
    padding: 1.5rem clamp(1rem, 2vw, 2.5rem) 5.5rem;
}

.app-shell {
    width: min(1180px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    position: relative;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.15rem 1.75rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--blur-backdrop);
    border: 1px solid var(--color-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(31, 191, 129, 0.22), rgba(82, 113, 255, 0.25));
    color: var(--color-primary);
}

.brand-icon svg {
    width: 28px;
    height: 28px;
}

.brand strong {
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.brand small {
    color: var(--color-text-soft);
    font-size: 0.85rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chip {
    border: 1px solid var(--color-border);
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    color: inherit;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
}

.chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(31, 191, 129, 0.12);
}

.chip.primary {
    border-color: transparent;
    background: linear-gradient(135deg, rgba(31, 191, 129, 0.92), rgba(82, 209, 171, 0.92));
    color: #fff;
    box-shadow: 0 18px 35px rgba(31, 191, 129, 0.18);
}

.chip.primary span:first-child {
    font-size: 1.5rem;
    line-height: 1;
}

.chip.outline {
    background: transparent;
    border-color: rgba(31, 191, 129, 0.35);
    color: var(--color-primary);
}

.chip.stretched {
    justify-content: center;
    width: 100%;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(31, 191, 129, 0.12);
    color: var(--color-primary);
    font-weight: 600;
}

.user-pill img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.hero-banner {
    display: grid;
    gap: 1.5rem;
    padding: clamp(1.5rem, 2vw, 2.5rem);
    background: linear-gradient(145deg, rgba(31, 191, 129, 0.18), rgba(82, 113, 255, 0.22));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(31, 191, 129, 0.1);
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    inset: -25% auto auto -20%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent 65%);
    pointer-events: none;
}

.hero-content h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    letter-spacing: -0.02em;
    max-width: 28ch;
}

.hero-content p {
    margin-top: 0.75rem;
    max-width: 46ch;
    color: var(--color-text-soft);
    line-height: 1.6;
}

.hero-stats {
    display: flex;
    gap: clamp(1rem, 3vw, 2.5rem);
    flex-wrap: wrap;
}

.hero-stats div {
    min-width: 140px;
    display: grid;
    gap: 0.2rem;
}

.hero-stats strong {
    font-size: 1.85rem;
    color: var(--color-primary);
}

.hero-stats span {
    color: var(--color-text-soft);
    font-size: 0.9rem;
}

.view-stack {
    display: grid;
    gap: 1.5rem;
}

.view {
    background: var(--color-surface-strong);
    border-radius: var(--radius-lg);
    padding: clamp(1.25rem, 2vw, 2rem);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-medium), transform var(--transition-medium);
}

.view.is-active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.view-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--color-text-soft);
}

.view-header h2 {
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.01em;
}

.search-bar {
    background: rgba(31, 45, 53, 0.04);
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(31, 45, 53, 0.08);
}

.search-bar .icon svg {
    width: 18px;
    height: 18px;
    color: var(--color-text-soft);
}

.search-bar input,
.search-bar select {
    border: none;
    background: transparent;
    font: inherit;
    color: inherit;
    outline: none;
}

.search-bar select {
    padding-left: 0.5rem;
    border-left: 1px solid rgba(31, 42, 46, 0.12);
}

.feed-grid {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.feed-card {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.9), rgba(245, 250, 248, 0.9));
    border: 1px solid rgba(31, 191, 129, 0.08);
    box-shadow: 0 18px 35px rgba(8, 49, 34, 0.08);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.feed-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-strong);
}

.feed-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.feed-card h3 {
    font-size: 1.1rem;
}

.feed-meta {
    display: flex;
    justify-content: space-between;
    color: var(--color-text-soft);
    font-size: 0.85rem;
}

.feed-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.feed-actions button,
.feed-actions a {
    background: none;
    border: none;
    color: var(--color-primary);
    font: inherit;
    cursor: pointer;
}

.floating-action {
    margin: 1.5rem auto 0;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    border: none;
    background: rgba(31, 191, 129, 0.1);
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.floating-action:hover {
    transform: translateY(-2px);
}

.map-wrapper {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0, 1fr);
}

#map-container {
    width: 100%;
    height: clamp(320px, 45vh, 540px);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.map-panel {
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    display: grid;
    gap: 0.6rem;
}

.map-panel h3 {
    font-size: 1.05rem;
}

.map-panel ul {
    list-style: none;
    color: var(--color-text-soft);
    font-size: 0.9rem;
    display: grid;
    gap: 0.5rem;
}

.pill-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pill-group input {
    border-radius: 999px;
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.9rem;
    flex: 1 1 160px;
    font: inherit;
    background: rgba(255, 255, 255, 0.8);
}

.capture-layout {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.capture-device,
.capture-ai {
    background: rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 1rem;
    box-shadow: var(--shadow-soft);
}

.camera-frame {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0d1f1a;
}

#camera-stream,
#capture-canvas {
    width: 100%;
    display: block;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

#capture-canvas { display: none; }

.camera-overlay {
    position: absolute;
    inset: auto 0 1.25rem 0;
    display: flex;
    justify-content: center;
    gap: 0.9rem;
}

.round-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: rgba(0, 0, 0, 0.3);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.round-btn span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
}

.round-btn.capture span {
    background: linear-gradient(135deg, #1fbf81, #0c7c52);
}

.round-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.round-btn:not(:disabled):active {
    transform: scale(0.95);
}

.geo-status {
    margin-top: 0.85rem;
    color: var(--color-text-soft);
    font-size: 0.9rem;
    text-align: center;
}

.preview-card {
    border-radius: var(--radius-md);
    background: rgba(14, 37, 30, 0.08);
    padding: 0.75rem;
    min-height: 180px;
    display: grid;
    place-items: center;
}

.preview-card img {
    width: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.ai-console {
    margin-top: 1rem;
    background: rgba(6, 33, 23, 0.75);
    color: #e8fff7;
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: grid;
    gap: 0.9rem;
    box-shadow: 0 25px 50px rgba(6, 33, 23, 0.35);
}

.ai-console header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ai-console header small {
    color: rgba(232, 255, 247, 0.7);
}

.ai-stream {
    display: grid;
    gap: 0.75rem;
    max-height: 220px;
    overflow: auto;
}

.ai-message {
    padding: 0.75rem 0.9rem;
    border-radius: 18px;
    background: rgba(232, 255, 247, 0.15);
    font-size: 0.95rem;
    line-height: 1.5;
}

.ai-message.is-user {
    background: rgba(82, 209, 171, 0.2);
    justify-self: end;
}

.ai-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.75rem 1rem;
    border-radius: 16px;
}

.ai-result strong {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(232, 255, 247, 0.6);
}

.ai-result span {
    font-size: 1.05rem;
    font-weight: 600;
}

.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.ai-chips button {
    border: 1px solid rgba(232, 255, 247, 0.28);
    background: rgba(232, 255, 247, 0.08);
    color: inherit;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    font: inherit;
}

.ai-chips button.active {
    background: rgba(82, 209, 171, 0.32);
    border-color: transparent;
}

.ai-extra {
    font-size: 0.85rem;
    color: rgba(232, 255, 247, 0.75);
}

.field {
    display: grid;
    gap: 0.35rem;
}

.field span {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(232, 255, 247, 0.65);
}

.field input,
.field select,
.field textarea {
    border-radius: 12px;
    border: 1px solid rgba(232, 255, 247, 0.35);
    background: rgba(232, 255, 247, 0.08);
    color: inherit;
    padding: 0.65rem 0.8rem;
    font: inherit;
}

.profile-card {
    display: grid;
    gap: 1.25rem;
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.profile-photo {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.profile-stats {
    display: flex;
    gap: clamp(1rem, 6vw, 3rem);
    flex-wrap: wrap;
}

.profile-stats strong {
    font-size: 1.4rem;
    color: var(--color-primary);
}

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

.profile-gallery img {
    width: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.profile-gallery img:hover {
    transform: scale(1.03);
}

.settings-grid {
    display: grid;
    gap: 1.25rem;
}

.settings-grid fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: grid;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.8);
}

.settings-grid legend {
    font-weight: 600;
    padding: 0 0.3rem;
}

.settings-grid label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--color-text-soft);
}

.admin-board {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-widget {
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(31, 191, 129, 0.15);
    background: rgba(31, 191, 129, 0.08);
    display: grid;
    gap: 0.5rem;
}

.admin-detail {
    margin-top: 1.5rem;
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    min-height: 200px;
    background: rgba(255, 255, 255, 0.65);
}

.bottom-nav {
    position: fixed;
    inset: auto 0 1.5rem 0;
    margin: 0 auto;
    width: min(620px, calc(100% - 2rem));
    display: grid;
    grid-auto-flow: column;
    gap: 0.35rem;
    padding: 0.6rem;
    border-radius: var(--radius-xl);
    background: rgba(15, 34, 28, 0.75);
    box-shadow: 0 25px 50px rgba(10, 28, 21, 0.35);
    backdrop-filter: blur(20px);
    z-index: 1000;
}

.bottom-nav__btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    padding: 0.55rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    display: grid;
    gap: 0.2rem;
    justify-items: center;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.bottom-nav__btn .icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
}

.bottom-nav__btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

.bottom-nav__btn.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.modal,
.profile-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(9, 20, 16, 0.65);
    padding: 1.5rem;
    z-index: 1500;
}

.modal.show,
.profile-modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 2vw, 2rem);
    display: grid;
    gap: 1rem;
    max-width: min(900px, 100%);
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-strong);
}

.modal-close {
    position: absolute;
    inset: 1rem 1rem auto auto;
    border: none;
    background: rgba(15, 34, 28, 0.1);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.modal-info {
    display: grid;
    gap: 0.85rem;
}

#modal-photo {
    width: 100%;
    border-radius: var(--radius-md);
    object-fit: cover;
}

#modal-comments {
    max-height: 240px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.85rem;
    display: grid;
    gap: 0.75rem;
}

.comment-item {
    background: rgba(31, 191, 129, 0.09);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
}

.auth-form,
#profile-form {
    display: grid;
    gap: 1rem;
}

.auth-form label,
#profile-form label {
    display: grid;
    gap: 0.45rem;
}

.auth-form input,
#profile-form input,
#profile-form select {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(31, 42, 46, 0.1);
    font: inherit;
}

.logout-form {
    display: inline;
}

.hidden { display: none !important; }

@media (min-width: 860px) {
    .map-wrapper {
        grid-template-columns: minmax(0, 1fr) 280px;
    }
}

@media (max-width: 920px) {
    body {
        padding: 1rem 1rem 5.5rem;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .header-actions {
        justify-content: space-between;
    }

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

    .hero-stats {
        justify-content: center;
    }

    .view {
        padding: 1.1rem;
    }

    .capture-layout {
        grid-template-columns: 1fr;
    }

    .bottom-nav {
        width: calc(100% - 1.5rem);
        inset: auto 0 1rem 0;
    }
}

@media (max-width: 560px) {
    .chip.primary span:first-child {
        display: none;
    }

    .search-bar {
        flex-wrap: wrap;
    }

    .search-bar select {
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(31, 42, 46, 0.08);
        margin-top: 0.5rem;
        padding-top: 0.65rem;
    }

    .pill-group input {
        flex: 1 1 100%;
    }

    .profile-photo {
        width: 64px;
        height: 64px;
    }

    .hero-stats strong {
        font-size: 1.4rem;
    }
}
