/* BASE VARIABLES FOR NAV & BUTTONS (Imported from main site) */
:root {
  --bg-page: #0f172a;
  --bg-panel: #1e293b;
  --bg-input: #334155;
  --bg-input-hover: #475569;
  --border-light: #475569;
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  /* Button Colors */
  --color-green: #10b981;
  --color-green-hover: #059669;
  --color-grey: #475569;
  --color-grey-hover: #334155;
  --color-slate: #64748b;
  --color-slate-hover: #475569;
  --color-blue: #3b82f6;
  --color-blue-hover: #2563eb;
  --color-red: #ef4444;
  --color-red-hover: #dc2626;
  --radius: 6px;
}

/* ORIGINAL MAP MAKER BASE */
body {
  font-family: sans-serif;
  background-color: var(--bg-page);
  margin: 0;
  padding: 0; /* Changed to 0 so the new navbar is flush with the top */
  color: var(--text-main);
}

/* --- NEW TOP NAV STYLES --- */
.top-nav {
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-light);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo {
  max-height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 12px;
}

.nav-btn {
  padding: 6px 16px;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.nav-btn:hover {
  background-color: var(--bg-input-hover);
  border-color: var(--border-focus);
}

.builder-btn:hover {
  background-color: var(--color-blue) !important;
  border-color: var(--color-blue) !important;
  color: white;
}

.donate-btn {
  background-color: #ffdd00 !important;
  color: #000 !important;
  border-color: #ffdd00 !important;
}

.donate-btn:hover {
  background-color: #ffea00 !important;
}

/* --- ORIGINAL LAYOUT CONTAINERS --- */
.container {
  display: flex;
  gap: 20px;
  max-width: 1500px;
  margin: 20px auto;
  padding: 0 20px;
}
.panel {
  background: var(--bg-panel);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
.left-panel {
  flex: 1;
}
.right-panel {
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* --- ORIGINAL TOOLBAR & INPUTS --- */
.toolbar-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.divider {
  width: 2px;
  height: 30px;
  background: var(--border-light);
  margin: 0 5px;
}

button,
select,
input,
textarea {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text-main);
}
button {
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(--bg-input-hover);
}

/* --- ADAPTED THEME BUTTONS --- */
.btn-green {
  background: var(--color-green);
  color: white;
  border: none;
  font-weight: bold;
  border-radius: var(--radius);
}
.btn-green:hover {
  background: var(--color-green-hover);
}

.btn-grey {
  background: var(--color-grey);
  color: white;
  border: none;
  font-weight: bold;
  border-radius: var(--radius);
}
.btn-grey:hover {
  background: var(--color-grey-hover);
}

.btn-blue {
  background: var(--color-blue);
  color: white;
  border: none;
  font-weight: bold;
  border-radius: var(--radius);
}
.btn-blue:hover {
  background: var(--color-blue-hover);
}

.btn-red {
  background: var(--color-red);
  color: white;
  border: none;
  font-weight: bold;
  border-radius: var(--radius);
}
.btn-red:hover {
  background: var(--color-red-hover);
}

.btn-slate {
  background: var(--color-slate);
  color: white;
  border: none;
  font-weight: bold;
  border-radius: var(--radius);
}
.btn-slate:hover {
  background: var(--color-slate-hover);
}

/* --- MAP MAKER SPECIFIC TOOLS --- */
.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
  color: var(--text-main);
  background: transparent;
  border-color: transparent;
}
.tool-btn:hover {
  background: var(--bg-input-hover);
}
.tool-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--border-focus);
  color: var(--border-focus);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.bg-blue {
  background: #5c7cfa;
}
.bg-red {
  background: #ff6b6b;
}
.bg-white {
  background: #fff;
  border: 1px solid #ccc;
}

canvas {
  border: 2px solid var(--border-light);
  background: #fff; /* Maintained explicitly per request */
  cursor: crosshair;
  display: block;
  max-width: 100%;
  height: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}
.form-group label {
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
}
textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

/* --- MODALS --- */
#export-modal,
#library-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--bg-panel);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  width: 600px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.modal-content h3 {
  color: var(--text-main);
}
.modal-content textarea {
  height: 300px;
  font-family: monospace;
  font-size: 13px;
  color: #4ade80; /* Terminal green */
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- OVERRIDES FOR HARDCODED INLINE STYLES --- */

/* Overrides inline HTML styles on the clear and reset buttons */
#btn-clear,
#btn-reset {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border-color: var(--color-red) !important;
}
#btn-clear:hover,
#btn-reset:hover {
  background: rgba(239, 68, 68, 0.3) !important;
}

/* Overrides JS-generated styles on the Library modal list */
#library-list {
  background: var(--bg-input) !important;
  border-color: var(--border-light) !important;
}
#library-list > div {
  border-bottom-color: var(--border-light) !important;
  color: var(--text-main) !important;
}
#library-list > div > div:nth-child(2) {
  color: var(--text-muted) !important;
}
#library-list > div:hover {
  background: var(--bg-input-hover) !important;
}
#library-list > div[style*="background: rgb(232, 240, 254)"],
#library-list > div[style*="background: #e8f0fe"] {
  background: rgba(59, 130, 246, 0.3) !important; /* Proper dark mode selected state */
}
