:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #e94560;
    --background-color: #f0f2f5;
    --text-color: #1a1a2e;
    --light-text: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e1e4e8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden; /* Prevent body scroll */
}

body {
    display: flex;
    flex-direction: column;
}

/* New structure for app content */
#app-content {
    display: flex;
    flex-direction: column;
    margin-top: 60px;
    height: calc(100vh - 120px);
}

header {
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

header h1 {
    font-size: 1.5rem;
}

/* --- User Auth Styles --- */
#user-auth {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
#user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
#logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-color);
    padding: 0.2rem;
}
#logout-btn:hover {
    color: var(--highlight-color);
}

/* --- Login View Styles --- */
#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 1rem;
    background-color: var(--background-color);
    margin-top: 60px;
}

.login-box {
    text-align: center;
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-width: 350px;
}
.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}
.login-box h2 {
    margin-bottom: 0.5rem;
}
.login-box p {
    color: #555;
    margin-bottom: 1.5rem;
}
#google-signin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}
#google-signin-btn:hover {
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
#google-signin-btn img {
    width: 20px;
    height: 20px;
}

main {
    flex-grow: 1;
    position: relative;
    overflow-y: auto;
}

.view {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    padding-bottom: 100px;
    box-sizing: border-box;
}

.view.active {
    display: block;
}

/* Special case for map view to fill space */
#map-view {
    padding: 0;
}
#add-view {
    padding-bottom: 100px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#map-view.active {
    display: flex;
    flex-direction: column;
    padding: 0;
}

#map-display {
    width: 100%;
    height: 100%;
    background-color: #d8e9f1;
}

/* --- New Add-View Form Styles --- */
#add-col-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#add-col-form h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input, .form-group textarea {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
}
.form-group input:focus {
    outline: 2px solid var(--highlight-color);
    border-color: transparent;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 140px;
}

.autocomplete-container {
    position: relative;
}

#col-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

#col-suggestions div {
    padding: 0.8rem;
    cursor: pointer;
}
#col-suggestions div:hover {
    background-color: var(--background-color);
}
#col-suggestions div:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.location-picker h3 {
    margin-bottom: 1rem;
}

.location-tabs {
    display: flex;
    margin-bottom: -1px; /* Overlap border */
}

.tab-btn {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: none;
}
.tab-btn:first-child {
    border-top-left-radius: 8px;
}
.tab-btn:last-child {
    border-top-right-radius: 8px;
}

.tab-btn.active {
    background-color: #fff;
    border-bottom: 1px solid #fff;
    font-weight: 600;
}

.tab-content {
    display: none;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 0 8px 8px 8px;
}
.tab-content.active {
    display: block;
}
#coords-tab {
     border-radius: 8px;
}
#coords-tab.active {
     border-top-left-radius: 0;
}

#map-add {
    width: 100%;
    height: 250px;
    background-color: #d8e9f1;
    border-radius: 8px;
}
.map-instruction {
    font-size: 0.8rem;
    color: #555;
    text-align: center;
    margin-top: 0.5rem;
}

.btn-primary {
    background-color: var(--highlight-color);
    color: var(--light-text);
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary:hover {
    background-color: #d63c54;
}

/* --- End Form Styles --- */

nav {
    display: flex;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -1px 3px rgba(0,0,0,0.02);

    /* Ajouts pour la fixité */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px; /* Hauteur explicite */
    z-index: 1000;
}

nav button {
    flex-grow: 1;
    padding: 0.5rem 0;
    background: none;
    border: none;
    color: #888;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-top: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
nav button i {
    font-size: 1.5rem;
}

nav button:hover {
    color: var(--text-color);
}

nav button.active {
    border-top-color: var(--highlight-color);
    color: var(--highlight-color);
}

/* List Styles */
#cols-list {
    list-style: none;
}

#cols-list li {
    background-color: #fff;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#cols-list li:hover {
    background-color: #f9f9f9;
}

#cols-list li:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
#cols-list li:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.col-main-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.col-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.col-date {
    font-size: 0.8rem;
    color: #777;
}

.col-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #555;
    width: 100%;
}

.col-stats span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.col-stats i {
    font-size: 1rem;
    color: var(--accent-color);
}

/* Expanded details styles */
.col-details {
    display: none; /* Hidden by default */
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-direction: column;
    gap: 0.8rem;
}

#cols-list li.expanded .col-details {
    display: flex; /* Shown when li has .expanded class */
}

.col-details-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #555;
}

.col-details-stats span {
     display: flex;
    align-items: center;
    gap: 0.3rem;
}
.col-details-stats i {
    font-size: 1rem;
    color: var(--accent-color);
}

.col-actions {
    align-self: flex-end;
    display: flex;
    gap: 0.5rem;
}

.edit-col {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}
.edit-col:hover {
    background-color: #2980b9;
}

.delete-col {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

.delete-col:hover {
    background-color: #c0392b;
}

/* Empty State & Instructions */
.empty-state {
    text-align: center;
    margin-top: 3rem;
    color: #7f8c8d;
}

.add-instruction {
    display: none; /* Replaced by form */
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}
.leaflet-popup-tip {
    border-radius: 0;
}

.error-message {
  color: #d9534f;   /* rouge */
  font-size: 0.85em;
  margin-top: 4px;
  display: block;
}
input.error {
  border: 1px solid #d9534f;
  background-color: #ffe6e6;
}

/* --- User Dropdown Menu --- */
.user-menu-container {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.user-dropdown {
    display: none; /* Caché par défaut */
    position: absolute;
    top: 120%; /* Juste en dessous de l'image */
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 2000;
    flex-direction: column;
    overflow: hidden;
}

.user-dropdown.active {
    display: flex;
}

.user-dropdown button {
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-color);
    width: 100%;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--background-color);
}

.user-dropdown button:last-child {
    border-bottom: none;
}

.user-dropdown button:hover {
    background-color: var(--background-color);
}

/* Style spécifique pour le bouton danger */
.user-dropdown button.danger {
    color: #e74c3c;
}
.user-dropdown button.danger:hover {
    background-color: #fcebeb;
}