/* Core Variables */
:root {
    --bg-dark: #121212; 
    --panel-bg: #1e1e1e; 
    --border-color: #333; 
    --text-main: #eee; 
    --text-muted: #aaa;
    --primary: #3498db; 
    --primary-hover: #2980b9; 
    --accent: #2ecc71; 
    --danger: #e74c3c; 
    --warning: #f1c40f; 
    --secondary: #e67e22;
}

/* Light Mode Overrides */
body.light-mode {
    --bg-dark: #e9ecef; 
    --panel-bg: #ffffff; 
    --border-color: #bdc3c7; 
    --text-main: #2c3e50; 
    --text-muted: #7f8c8d;
}

body { 
    margin: 0; 
    padding: 0; 
    font-family: 'Inter', system-ui, sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    overflow: hidden; 
    transition: background 0.3s, color 0.3s; 
}

/* -----------------------------------------
   APP GRID LAYOUT (Split Screen)
----------------------------------------- */
.app-grid { display: grid; grid-template-columns: 350px 1fr; height: 100vh; width: 100vw; }

/* -----------------------------------------
   LEFT PANEL: SIDEBAR & HEADER
----------------------------------------- */
.sidebar { 
    background-color: var(--panel-bg); 
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    overflow-y: auto; 
    transition: background 0.3s, border-color 0.3s; 
}

.app-header-block { 
    padding: 20px; 
    border-bottom: 1px solid var(--border-color); 
    background: var(--panel-bg); 
}

.breadcrumb-link { 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: var(--primary); 
    text-decoration: none; 
    font-weight: bold; 
    display: inline-block; 
    margin-bottom: 5px; 
}

.breadcrumb-link:hover { text-decoration: underline; }

.title-block h2 { margin: 0; font-size: 1.2rem; color: var(--text-main); }
.description { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; margin: 10px 0; }

/* -----------------------------------------
   UTILITY BELT & TOGGLES
----------------------------------------- */
.global-settings-container { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.utility-belt { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.toggle-container { display: flex; background: var(--bg-dark); border-radius: 6px; padding: 3px; border: 1px solid var(--border-color); transition: background 0.3s, border-color 0.3s; }
.toggle-btn { background: transparent; color: var(--text-muted); border: none; padding: 4px 12px; font-size: 0.8rem; border-radius: 4px; cursor: pointer; font-weight: bold; transition: all 0.2s; }
.toggle-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.support-action { display: flex; }
.kofi-pill { background: #ff5e5b; color: white; border: none; padding: 8px 15px; border-radius: 20px; font-weight: bold; font-size: 0.85rem; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; text-align: center; }
.kofi-pill.full-width { width: 100%; }
.kofi-pill:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(255, 94, 91, 0.4); }

/* -----------------------------------------
   CONTROL PANEL
----------------------------------------- */
.control-panel { padding: 20px; display: flex; flex-direction: column; gap: 20px; flex-grow: 1; }
.step-box { background-color: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; transition: background 0.3s, border-color 0.3s; }
.step-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.step-num { background-color: var(--primary); color: white; font-weight: 800; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.85rem; }
.step-header h2 { margin: 0; font-size: 1rem; color: var(--text-main); }

/* Inputs & Buttons */
.input-group { display: flex; gap: 5px; margin-bottom: 10px; }
.dark-input { flex-grow: 1; background-color: var(--panel-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 12px; border-radius: 6px; font-size: 0.95rem; outline: none; transition: border-color 0.2s, background 0.3s, color 0.3s; }
.dark-input:focus { border-color: var(--primary); }
.btn-icon { background-color: var(--panel-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 0 15px; border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.btn-icon:hover { background-color: var(--border-color); }
.button-row { display: flex; gap: 10px; }
.btn-action { flex: 1; padding: 10px; border-radius: 6px; border: 1px solid var(--border-color); background-color: var(--panel-bg); color: var(--text-main); font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 5px; }
.btn-action:hover { background-color: var(--border-color); }
.btn-primary { background-color: var(--primary); color: white; border: none; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-active-drop { background-color: var(--accent) !important; color: #111 !important; border-color: var(--accent) !important; box-shadow: 0 0 10px rgba(46, 204, 113, 0.4); }

.pill-group { display: flex; background-color: var(--panel-bg); border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); transition: background 0.3s, border-color 0.3s; }
.pill-btn { flex: 1; padding: 10px 0; background: transparent; border: none; color: var(--text-muted); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; border-right: 1px solid var(--border-color); }
.pill-btn:last-child { border-right: none; }
.pill-btn.active { background-color: var(--primary); color: white; }

/* THE SNAP FIX */
.action-footer { display: flex; gap: 10px; margin-top: 15px; }

.btn-ghost { flex: 1; padding: 12px; background: transparent; border: 1px dashed var(--border-color); color: var(--text-main); border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-ghost:hover { background: var(--border-color); }

/* -----------------------------------------
   APP FOOTER
----------------------------------------- */
.app-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border-color); font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }
.app-footer a { color: var(--primary); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.disclaimer, .privacy-badge { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }

/* -----------------------------------------
   RIGHT PANEL: DASHBOARD & MAP
----------------------------------------- */
.main-content { display: flex; flex-direction: column; height: 100vh; position: relative; }
.dashboard-panel { background-color: var(--panel-bg); border-bottom: 1px solid var(--border-color); display: flex; padding: 15px 20px; gap: 30px; z-index: 10; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: background 0.3s, border-color 0.3s; }
.dash-block { display: flex; flex-direction: column; justify-content: center; }
.primary-block { border-right: 1px solid var(--border-color); padding-right: 30px; }
.dash-label { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 5px; }
.dash-value { font-size: 1.2rem; font-weight: 600; color: var(--text-main); font-family: monospace; }
.giant-text { font-size: 3rem; color: var(--accent); line-height: 1; }

#map-wrapper { flex-grow: 1; position: relative; }
#map { height: 100%; width: 100%; background-color: var(--bg-dark); }
.map-crosshair { cursor: crosshair !important; }

.map-header { position: absolute; top: 15px; left: 15px; right: 15px; z-index: 1000; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.map-toggles { display: flex; background: rgba(30,30,30,0.9); border-radius: 6px; padding: 3px; pointer-events: auto; border: 1px solid var(--border-color); backdrop-filter: blur(4px); transition: background 0.3s, border-color 0.3s; }
body.light-mode .map-toggles { background: rgba(255,255,255,0.9); }
.btn-map { background: transparent; color: var(--text-muted); border: none; padding: 6px 12px; font-size: 0.8rem; border-radius: 4px; cursor: pointer; font-weight: bold; pointer-events: auto; transition: all 0.2s; }
.btn-map.active { background: var(--primary); color: #fff; }
#btnFrame { background: rgba(30,30,30,0.9); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); backdrop-filter: blur(4px); transition: background 0.3s, border-color 0.3s; pointer-events: auto; }
body.light-mode #btnFrame { background: rgba(255,255,255,0.9); }
#btnFrame:hover { background: var(--border-color); }

/* -----------------------------------------
   MODALS
----------------------------------------- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 20000; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal-overlay.show { display: flex; }
.modal-content { background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 12px; width: 90%; max-width: 500px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.5); overflow: hidden; transition: background 0.3s, border-color 0.3s; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border-color); background: var(--bg-dark); transition: background 0.3s, border-color 0.3s; }
.modal-header h3 { margin: 0; font-size: 1.1rem; color: var(--text-main); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 0; transition: color 0.2s; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; font-size: 0.9rem; line-height: 1.5; color: var(--text-main); }

/* --- MAP PINS --- */
.custom-pin { background: transparent; border: none; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); position: relative; border: 2px solid #fff; box-shadow: 2px 2px 5px rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; }
.pin-label { transform: rotate(45deg); color: #fff; font-weight: 900; font-size: 14px; position: absolute; z-index: 10; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }

/* --- TOAST NOTIFICATIONS --- */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px); background: #333; color: #fff; padding: 12px 24px; border-radius: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); font-size: 0.9rem; font-weight: bold; opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); z-index: 99999; cursor: pointer; text-align: center; border: 1px solid #444; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-bottom: 3px solid var(--secondary); }
.toast.error { border-bottom: 3px solid var(--danger); }
.toast.info { border-bottom: 3px solid var(--primary); }
.toast.warning { border-bottom: 3px solid var(--warning); }

/* -----------------------------------------
   RESPONSIVE LOGIC (MOBILE)
----------------------------------------- */
@media (max-width: 900px) {
    .app-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100vh; overflow-y: auto; }
    .sidebar { height: auto; border-right: none; border-bottom: 1px solid var(--border-color); overflow: visible; }
    .main-content { height: 60vh; }
    .dashboard-panel { flex-wrap: wrap; gap: 15px; padding: 10px 15px; }
    .primary-block { border-right: none; padding-right: 0; width: 100%; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
    .giant-text { font-size: 2.5rem; }
    .map-header { flex-direction: column; gap: 10px; align-items: flex-end; }
}