:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --background-color: #e9ecef;
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --text-color: #212529;
    --border-color: #ddd;
    --button-bg: #fff;
    --popup-bg: #fff;
    --popup-border: #eee;
}

body.dark-mode {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --light-color: #212529;
    --dark-color: #f8f9fa;
    --background-color: #121212;
    --text-color: #f8f9fa;
    --border-color: #495057;
    --button-bg: #343a40;
    --popup-bg: #2b2b2b;
    --popup-border: #444;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

#app-header {
    background-color: var(--light-color);
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1001; /* Above map */
    transition: background-color 0.3s ease;
}

#header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#app-header h1 {
    text-align: center;
    font-size: 1.5rem;
    color: var(--dark-color);
    margin: 0;
    flex-grow: 1;
}

#auth-buttons, #theme-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

#theme-switcher {
    justify-content: flex-end;
}

#auth-buttons button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-weight: 500;
}

#auth-buttons #register-btn {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Theme Switcher Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

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

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

#tabs-container {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.tab-button {
    flex: 1;
    padding: 12px 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--button-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tab-button:hover {
    background-color: var(--background-color);
    border-color: #ccc;
}

.tab-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}

.tab-button img {
    width: 20px;
    height: 20px;
    filter: grayscale(1);
    opacity: 0.7;
}

.tab-button.active img {
    filter: none;
    opacity: 1;
}

#map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    background-color: var(--background-color);
}

/* Leaflet Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background-color: var(--popup-bg);
    color: var(--text-color);
}

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

.leaflet-popup-content {
    margin: 15px !important;
    font-size: 14px;
    line-height: 1.6;
}

.popup-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--popup-border);
    padding-bottom: 10px;
}

.popup-header img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.popup-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--dark-color);
}

.popup-body p {
    margin: 0 0 8px;
}

.popup-body strong {
    color: var(--dark-color);
}

.popup-posts {
    margin-top: 10px;
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid var(--popup-border);
    padding: 5px;
    border-radius: 5px;
}

.popup-post {
    font-style: italic;
    padding-bottom: 5px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--popup-border);
}

.popup-post:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.popup-actions {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--popup-border);
}

.popup-actions button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
}

.popup-actions button:hover {
    background: var(--primary-dark);
}

.popup-footer {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #6c757d;
}

.leaflet-marker-icon {
    transition: transform 0.3s ease-out;
}