/* Base Variables - Modern Premium Theme */
:root {
    --primary: #2e7d32;
    /* Deep Niederrhein Farm Green */
    --primary-hover: #1b5e20;
    --secondary: #0284c7;
    /* River Rhine Blue */
    --danger: #d32f2f;
    /* Rustic red for negative status */
    --bg-color: #f4f9f4;
    /* Very light earthy/green tint */
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-muted: #57534e;
    /* Warm stone gray */
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
    --font-family: 'Inter', sans-serif;
}

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

.hidden {
    display: none !important;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    /* App feels native, no full-page scrolling */
}

/* Splash Screen Loading Overlay */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('bg.jpg');
    /* The user will save their image as bg.jpg */
    background-size: cover;
    background-position: center;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}

#splash-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    /* Dark overlay to make text readable */
    z-index: 1;
}

.splash-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.splash-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.splash-subtitle {
    font-size: 1.5rem;
    font-weight: 500;
}

#splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Application Layout */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100vw;
}

.app-header {
    position: relative;
    z-index: 2000;
    height: 60px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    font-size: 1.25rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.content-area {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
    /* Prevents leaflet map transforms from bleeding over header */
}

/* Map Container */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* General Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}

.primary-btn {
    background-color: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.primary-btn.full-width {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 1rem;
    margin-top: 1rem;
}

.secondary-btn {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn:hover {
    background-color: var(--bg-color);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.icon-btn:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* Sidebar overlaying map */
.sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.hidden {
    display: none;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.description {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Sections in Sidebar */
.voting-section,
.products-section,
.gallery-section {
    margin-bottom: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}

.product-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.product-votes {
    display: flex;
    gap: 0.5rem;
}

.p-vote-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.p-vote-btn.up:hover {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #34d399;
}

.p-vote-btn.down:hover {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.vote-prompt {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.vote-buttons {
    display: flex;
    gap: 0.5rem;
}

.vote-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    background: white;
}

.vote-btn.positive:hover {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #34d399;
}

.vote-btn.negative:hover {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

/* Photo Gallery */
.gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    background-color: var(--bg-color);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-vote {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: space-around;
    padding: 0.25rem;
}

.photo-vote button {
    background: transparent;
    color: white;
    font-size: 0.875rem;
}

.photo-vote button:hover {
    opacity: 0.8;
}

/* Modal for Add Form */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    /* darkened overlay */
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 90%;
    max-width: 450px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
}

.modal.hidden .modal-content {
    opacity: 0;
}

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

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.dynamic-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dynamic-input-row input {
    flex: 1;
}

.remove-row-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-row-btn:hover {
    background-color: #fee2e2;
    border-color: var(--danger);
}

.instruction-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.coord-input {
    margin-bottom: 0.5rem;
    background-color: var(--bg-color);
}

.info-alert {
    display: flex;
    gap: 0.75rem;
    background-color: #eff6ff;
    color: #1e3a8a;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.info-alert i {
    font-size: 1rem;
    color: #3b82f6;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    color: var(--text-main);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-weight: 500;
    font-size: 0.875rem;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(46, 125, 50, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0);
    }
}

.pulse-active {
    animation: pulse 2s infinite;
}

.nearby-shop-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.nearby-shop-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.nearby-shop-item:last-child {
    border-bottom: none;
}

.ns-info h4 {
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.ns-dist {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .sidebar {
        width: 100%;
        height: 65vh;
        top: auto;
        bottom: 0;
        border-radius: 20px 20px 0 0;
    }

    .sidebar.hidden {
        display: none;
    }

    .primary-btn,
    .secondary-btn {
        padding: 0.75rem 1rem;
    }
}

.ad-banner {
    width: 100%;
    background: white;
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 1000;
}

.ad-badge {
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
}

.ad-content {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.3;
}

.ad-close {
    color: var(--text-muted);
    font-size: 1.2rem;
    background: transparent;
    padding: 0.2rem;
}

/* Map Marker Styles (Dynamic) */
.map-label {
    background: white;
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 3px 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto !important;
}

.map-label::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--primary);
}

.map-label .label-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.map-label .label-products {
    font-size: 0.65rem;
    color: var(--primary);
    font-weight: 500;
    line-height: 1.1;
}

.map-dot {
    background-color: var(--primary);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}                                              