/* Cartographer — Dark theme map viewer */

.cartographer-container {
    display: flex;
    height: calc(100vh - 60px);
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Upload Panel ─────────────────────────────────────────────── */

.upload-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 5;
    background: rgba(26, 26, 46, 0.95);
    border: 2px dashed #4a4a6a;
    border-radius: 12px;
    padding: 40px 60px;
}

.upload-panel.hidden { display: none; }

.upload-panel h2 {
    margin: 0 0 10px;
    color: #e0e0e0;
}

.upload-panel p {
    color: #888;
    margin: 0 0 20px;
}

.upload-btn {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #5a5a7a;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.upload-btn:hover { background: #4a4a6a; }

#upload-status {
    margin-top: 12px;
    font-size: 13px;
    color: #888;
}

/* ─── Map Canvas ───────────────────────────────────────────────── */

.map-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

/* ─── Legend Panel ──────────────────────────────────────────────── */

.legend-panel {
    width: 220px;
    background: #16162a;
    border-left: 1px solid #2a2a4a;
    padding: 16px;
    overflow-y: auto;
}

.legend-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a4a;
}

.legend-header:first-child { margin-top: 0; }

.legend-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.legend-ctrl-btn {
    flex: 1;
    background: #2a2a4a;
    color: #ccc;
    border: 1px solid #3a3a5a;
    padding: 5px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.15s;
}

.legend-ctrl-btn:hover {
    background: #3a3a5a;
    color: #fff;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.4;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.legend-item.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.legend-item:hover { background: rgba(255, 255, 255, 0.08); }

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    font-size: 13px;
}

.legend-count {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

/* ─── Tooltip ──────────────────────────────────────────────────── */

#map-tooltip {
    position: fixed;
    display: none;
    background: rgba(10, 10, 30, 0.92);
    border: 1px solid #4a4a6a;
    border-radius: 6px;
    padding: 10px 14px;
    color: #e0e0e0;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
    line-height: 1.6;
    min-width: 160px;
}

.tip-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.cave-badge {
    display: inline-block;
    background: rgba(255, 140, 0, 0.2);
    color: #FF8C00;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ─── Save/Share Bar (#211) ─────────────────────────────────────────────── */

.save-share-bar {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.save-btn {
    background: #2d5a27;
    color: #e0e0e0;
    border: 1px solid #3a7a33;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
.save-btn:hover { background: #3a7a33; }
.save-btn:disabled { opacity: 0.6; cursor: default; }

.login-hint {
    color: #888;
    font-size: 12px;
    font-style: italic;
}

.share-url-box {
    display: flex;
    align-items: center;
    gap: 4px;
}
.share-url-box input {
    background: #1a1a2e;
    color: #9999cc;
    border: 1px solid #3a3a5a;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    width: 260px;
    font-family: monospace;
}
.copy-btn {
    background: #2a2a4a;
    color: #ccc;
    border: 1px solid #3a3a5a;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}
.copy-btn:hover { background: #3a3a6a; }

/* ─── Map header bar (shared maps) ──────────────────────────────────────── */

.map-header-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(10, 10, 30, 0.85);
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid #3a3a5a;
    z-index: 100;
}
.map-title {
    color: #e0e0e0;
    font-weight: bold;
    font-size: 14px;
}
.map-owner {
    color: #888;
    font-size: 12px;
    margin-left: 10px;
}

/* ─── Save modal ────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #1e1e3a;
    border: 1px solid #3a3a5a;
    border-radius: 8px;
    padding: 24px;
    min-width: 320px;
}
.modal-content h3 {
    color: #e0e0e0;
    margin: 0 0 16px;
}
.modal-content input {
    width: 100%;
    background: #12122a;
    color: #e0e0e0;
    border: 1px solid #3a3a5a;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
}
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.modal-btn {
    padding: 6px 16px;
    border-radius: 4px;
    border: 1px solid #3a3a5a;
    background: #2a2a4a;
    color: #ccc;
    cursor: pointer;
    font-size: 13px;
}
.modal-btn.primary {
    background: #2d5a27;
    border-color: #3a7a33;
}
.modal-btn:hover { opacity: 0.85; }

/* ─── Saved Maps on Upload Panel ────────────────────────────────────────── */

.saved-maps-section {
    margin-top: 20px;
    width: 100%;
}
.saved-maps-divider {
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-align: center;
}
.saved-maps-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.saved-map-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}
.saved-map-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.saved-map-terrain {
    color: #888;
    font-size: 11px;
    min-width: 80px;
}
.saved-map-name {
    flex: 1;
}
