/* ========================================
   COMMON.CSS — styles globaux mymap
   Structure inspirée de ryzomap,
   couleurs et identité visuelle de mymap
   ======================================== */

:root {
    --color-primary:       #199900;
    --color-primary-light: #4CAF50;
    --color-primary-dark:  #137100;
    --bg-body:    #000;
    --bg-dark:    #111;
    --bg-section: #1a1a1a;
    --bg-hover:   #222;
    --bg-input:   #222;
    --border-dark:   #222;
    --border-medium: #333;
    --border-light:  #444;
    --text-primary:   #e0e0e0;
    --text-secondary: #ccc;
    --text-tertiary:  #aaa;
    --text-disabled:  #666;
    --text-white:     #fff;
    --color-success: #199900;
    --color-error:   #e74c3c;
    --color-warning: #f39c12;
    --color-info:    #199900;
    --shadow-small:  0 2px 4px rgba(0,0,0,0.5);
    --shadow-medium: 0 2px 10px rgba(0,0,0,0.7);
    --shadow-large:  0 4px 20px rgba(0,0,0,0.9);
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 40px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --section-min-width: 600px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                 Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    padding-top: 60px;
}

html, body { max-width: 100vw; overflow-x: auto; }

.page-content {
    min-height: calc(100vh - 60px);
    background: var(--bg-body);
    padding: var(--spacing-md);
}

h2 { border-bottom: 2px solid var(--border-light); padding-bottom: 5px; margin-bottom: 15px; color: var(--text-white); }
h3 { margin-top: 15px; color: var(--text-tertiary); }
h4 { margin-top: 20px; margin-bottom: 12px; color: var(--text-white); font-size: 1em; border-bottom: 1px solid var(--border-medium); padding-bottom: 5px; }
h4:first-child { margin-top: 0; }

.container { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-lg); max-width: 100%; margin: auto; padding: var(--spacing-xl) var(--spacing-md); }
.container.single-column { grid-template-columns: 1fr; max-width: 1200px; }
.container.full-width { grid-template-columns: 1fr; max-width: none; width: 100%; }
.container.full-width.narrow-margins { padding: var(--spacing-xl) var(--spacing-md); }
.no-container { width: 100%; height: 90vh; padding: 0; padding-top: 10px; margin: 0; }
.section { background: var(--bg-section); padding: var(--spacing-md); box-shadow: var(--shadow-medium); border-radius: var(--radius-sm); min-width: var(--section-min-width); }
.section.full-width { min-width: auto; width: 100%; }
.section.compact { padding: var(--spacing-sm); }

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
table, th, td { border: 1px solid var(--border-medium); }
th, td { padding: 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
th { background: var(--bg-hover); color: var(--text-white); }
td { background: var(--bg-section); color: var(--text-primary); position: relative; overflow: visible; }
tr:nth-child(even) td { background: var(--bg-dark); }
tr:nth-child(odd)  td { background: var(--bg-section); }
tr:hover td           { background: var(--bg-hover); }

button { background: transparent; color: var(--text-secondary); border: 2px solid var(--border-light); padding: var(--spacing-sm) var(--spacing-md); margin-top: var(--spacing-xs); border-radius: var(--radius-md); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; }
button:hover  { color: var(--color-primary-light); border-color: var(--color-primary-light); }
button:active, button.active { color: var(--color-primary); border-color: var(--color-primary); }
button:disabled { color: var(--border-dark); border-color: var(--border-dark); cursor: not-allowed; opacity: 0.5; }

.switch { display: flex; align-items: center; margin: 6px 0; cursor: pointer; }
.switch input { display: none; }
.switch-label { margin-left: 10px; font-size: 14px; color: var(--text-secondary); }
.slider { position: relative; width: 40px; height: 20px; background: #444; border-radius: 34px; transition: background-color 0.3s; flex-shrink: 0; }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: transform 0.3s; }
.switch input:checked + .slider          { background: var(--color-primary); }
.switch input:checked + .slider::before  { transform: translateX(20px); }

.segmented-control { display: flex; flex: 1 1 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--border-light); background: var(--bg-hover); }
.segmented-control input { display: none; }
.segmented-control label { flex: 1 1 0; padding: 4px 16px; text-align: center; cursor: pointer; user-select: none; background: var(--bg-hover); color: var(--text-secondary); transition: background 0.2s, color 0.2s; border-left: 1px solid var(--border-light); }
.segmented-control label:first-of-type { border-left: none; border-top-left-radius: 20px; border-bottom-left-radius: 20px; }
.segmented-control label:hover           { background: var(--bg-section); color: var(--text-white); }
.segmented-control input:checked + label { background: var(--color-primary); color: #fff; font-weight: bold; }

.flash { position: relative; min-width: 280px; max-width: 420px; padding: 1rem 1.4rem; margin-bottom: 1rem; border-left: 5px solid; border-radius: var(--radius-md); font-size: 1rem; box-shadow: var(--shadow-medium); background: var(--bg-section); color: var(--text-primary); animation: fadeIn 0.4s ease-in-out; }
.flash-close { position: absolute; top: 8px; right: 12px; font-size: 1.2em; cursor: pointer; background: none; border: none; color: inherit; padding: 0; line-height: 1; }
.flash-success { background: #0d1f0d; border-color: var(--color-primary); color: #a6f3a6; }
.flash-error   { background: #2d1e1e; border-color: var(--color-error);   color: #ffbaba; }
.flash-warning { background: #2f2b1a; border-color: var(--color-warning); color: #f7d58f; }
.flash-info    { background: #0d1f0d; border-color: var(--color-primary); color: #a6f3a6; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); }
.modal:target { display: block; }
.modal-content { background: var(--bg-section); margin: 10% auto; padding: 20px; border: 1px solid var(--border-medium); width: 90%; max-width: 400px; border-radius: var(--radius-md); position: relative; }
.close-button { position: absolute; right: 10px; top: 10px; color: var(--text-secondary); background: transparent; border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 5px 12px; font-size: 24px; line-height: 1; cursor: pointer; text-decoration: none; transition: all 0.3s ease; }
.close-button:hover { color: var(--color-primary-light); border-color: var(--color-primary-light); }

.hidden { display: none !important; }

@media (max-width: 1200px) { .container { grid-template-columns: 1fr; } .section { min-width: auto; } }
@media (max-width: 768px)  { th, td { max-width: none; white-space: normal; } }
