/* === GENERAL === */
* {
    font-family: Helvetica, sans-serif;
}

/* === LIGHT THEME === */

:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --panel: #ffffff;
    --border: #ddd;
    --primary: #2c7be5;
}

/* === DARK THEME === */

:root[data-theme="dark"] {
    --bg: #121212;
    --text: #eaeaea;
    --panel: #1e1e1e;
    --border: #333;
    --primary: #4c8dff;
}

/* === APPLY THEMING === */

body {
    background: var(--bg);
    color: var(--text);
}

input,
textarea,
select {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
}

button {
    background: var(--primary);
    color: white;
}

/* === LEAFLET THEME SUPPORT === */

/* === LEAFLET CONTROL THEMING === */

/* Generic control background and text */
.leaflet-control,
.leaflet-control a,
.leaflet-control button {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
    font-family: sans-serif;
}

/* Zoom buttons */
.leaflet-control-zoom a {
    width: 30px;
    height: 30px;
    line-height: 28px; /* center the "+" and "-" */
    text-align: center;
    font-size: 1.2rem;
    cursor: pointer;
    display: block;
}

/* Hover effect for zoom buttons */
.leaflet-control-zoom a:hover {
    background: var(--primary);
    color: white;
}

/* Attribution text */
.leaflet-control-attribution {
    background: var(--panel);
    color: var(--text);
    border-radius: 4px;
    border: 1px solid var(--border);
    padding: 2px 4px;
    font-size: 0.7rem;
}

/* Scale control */
.leaflet-control-scale-line {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 0.7rem;
}

.leaflet-control-attribution {
    background: var(--bg) !important;
    color: var(--text) !important;
}

/* Marker tooltips */
.leaflet-tooltip {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* Popup background and text */
.leaflet-popup-content-wrapper {
    background: var(--panel);
    color: var(--text);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.leaflet-popup-tip {
    background: var(--panel);
}

/* === MAP SIZING === */

html, body {
    height: 100%;
    margin: 0;
}

#map {
    height: 100vh;
    width: 100%;
}

/* === CONTROLS DIV === */

#controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 9999;
    align-items: stretch; /* stretch all triggers */
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;

    height: 36px;
    padding: 0 0.6rem;

    border-radius: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 0 5px rgba(0,0,0,0.25);
    cursor: pointer;
}

.control-btn.icon-only {
    width: 36px;
    padding: 0;
}

.control-btn img {
    width: 24px;
    height: 24px;
}

/* === GENERIC DROPDOWN === */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.arrow {
    font-size: 0.7rem;
}

/* === DROPDOWN MENU === */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    display: none;
    background: var(--panel);
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 0 5px rgba(0,0,0,0.25);
    overflow: hidden;
    z-index: 10;
}

/* === DROPDOWN ITEM === */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    white-space: nowrap;
}

.dropdown-item img {
    width: 24px;
    height: 24px;
}

.dropdown-item:hover {
    background-color: rgba(0,0,0,0.08);
}

/* === MODAL BACKDROP === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* === MODAL BOX === */
.modal-content {
    background: var(--panel);
    color: var(--text);
    padding: 1.25rem;
    border-radius: 8px;
    width: min(90vw, 420px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* === TITLES === */
.modal-content h3 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    text-align: center;
}

/* === FORM FIELDS === */
.modal-content label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    padding: 0.45rem 0.55rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.95rem;
}

.modal-content textarea {
    resize: vertical;
    min-height: 70px;
}

/* === BUTTONS === */
.modal-content button {
    padding: 0.45rem 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.modal-content button[type="submit"] {
    background: #2c7be5;
    color: white;
}

.modal-content button[type="submit"]:hover {
    background: #1f5fbf;
}

.modal-content button[type="button"] {
    background: #e0e0e0;
}

/* === ACTION BAR (SHOP FORM) === */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* === ERRORS === */
.error {
    margin-top: 0.5rem;
    color: #d9534f;
    font-size: 0.85rem;
    text-align: center;
}

/* === MOBILE IMPROVEMENTS === */
@media (max-width: 480px) {
    .modal-content {
        padding: 1rem;
    }
}

/* === FULLSCREEN INFO MODAL === */

.info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;

    align-items: center;
    justify-content: center;

    z-index: 2000;
}

.info-modal.open {
    display: flex;
}

.info-modal-content {
    position: relative;
    background: var(--panel);
    color: var(--text);

    width: min(90vw, 500px);
    padding: 2rem;
    border-radius: 12px;

    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* Close button */
.info-close {
    position: absolute;
    top: 10px;
    right: 12px;

    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
}
