/* Map Module Styles */

.map-module-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-tertiary);
}

.map-main-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.map-toolbar {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-soft);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.map-toolbar .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    height: 40px;
    white-space: nowrap;
}


.map-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    box-shadow: 0 10px 30px var(--shadow-heavy);
    border-radius: 8px;
    overflow: hidden;
}

.world-map-image {
    max-width: 100%;
    height: auto;
    display: block;
    cursor: crosshair;
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease;
}

.map-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--accent-gold);
    color: white;
    border: 2px solid white;
    border-radius: 50% 50% 50% 0;
    transform: translate(-50%, -100%) rotate(-45deg);
    cursor: grab;
    box-shadow: 0 4px 8px var(--shadow);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s;
}

.map-marker:active {
    cursor: grabbing;
    transform: translate(-50%, -100%) rotate(-45deg) scale(1.1);
}

.map-marker:hover {
    transform: translate(-50%, -110%) rotate(-45deg) scale(1.2);
    z-index: 100;
}

.map-placeholder {
    padding: 4rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    width: 100%;
    max-width: 600px;
}


.map-marker i {
    transform: rotate(45deg);
    font-size: 10px;
}

/* Color coding by type */
.map-marker[data-type="crime-scene"],
.map-marker[data-type="hazard"] {
    background: #e74c3c;
}

/* Red */

.map-marker[data-type="clue"],
.map-marker[data-type="hideout"] {
    background: #f1c40f;
}

/* Yellow/Gold */

.map-marker[data-type="police"],
.map-marker[data-type="marker"] {
    background: #3498db;
}

/* Blue */

.map-marker[data-type="forest"],
.map-marker[data-type="water"],
.map-marker[data-type="mountain"] {
    background: #27ae60;
}

/* Nature Green */

.map-marker[data-type="temple"],
.map-marker[data-type="castle"] {
    background: #9b59b6;
}

/* Fantasy Purple */


.map-marker-label {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-accent);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

.map-marker:hover .map-marker-label {
    opacity: 1;
    top: -45px;
}

/* Sidebar styles */
.map-sidebar-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.map-sidebar-item:hover {
    background: var(--bg-hover);
}

.map-sidebar-item.active {
    background: var(--bg-accent-soft);
    border-left: 3px solid var(--accent-gold);
}

/* Icon Selector Grid */
.icon-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
}

.icon-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-option:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: scale(1.1);
}

.icon-option.selected {
    background: rgba(52, 152, 219, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}


.map-sidebar-item-icon {
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-sidebar-item-info {
    flex: 1;
    overflow: hidden;
}

.map-sidebar-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-sidebar-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Empty view */
.map-empty-state {
    padding: 6rem 2rem;
    text-align: center;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    max-width: 600px;
    margin: 4rem auto;
}

.map-empty-icon {
    font-size: 3rem;
    color: var(--accent-gold);
    margin-bottom: 2rem;
    opacity: 0.5;
}

/* Modal specific */
.location-modal-preview {
    width: 100%;
    height: 150px;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tabs logic */
.map-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.map-tabs::-webkit-scrollbar {
    display: none;
}

.map-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    top: 1px;
}

.map-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.map-tab.active {
    background: var(--bg-primary);
    color: var(--accent-gold);
    border-color: var(--border-color);
    border-bottom: 2px solid var(--bg-primary);
    font-weight: 600;
}

.map-sidebar-group {
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.map-sidebar-group.active {
    color: var(--accent-gold);
}

.map-sidebar-item {
    font-size: 0.8rem;
    padding-left: 32px;
}

.btn-delete-location {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: auto;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    /* Hidden by default for cleaner look */
    transition: all 0.2s;
}

.map-sidebar-item:hover .btn-delete-location {
    opacity: 1;
    /* Show on hover */
}

.btn-delete-location:hover {
    color: var(--accent-red);
    background: rgba(196, 69, 54, 0.1);
}