/* ─── Contenedor principal ─────────────────────────────────────── */
#tibia-map-wrap {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ─── Fila mapa + panel lateral ────────────────────────────────── */
#tibia-map-row {
    display: flex;
    width: 100%;
    position: relative;
}

/* ─── Mapa ─────────────────────────────────────────────────────── */
#tibia-map {
    flex: 1 1 auto;
    height: 600px;
    min-width: 0;
    transition: width 0.3s ease;
    border-top: 4px solid #fff;
    border-bottom: 4px solid #fff;
}

.tibia-map-attribution {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    color: #ccc;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 5px;
    pointer-events: auto;
    transition: right 0.3s ease;
}

.tibia-map-attribution a {
    color: #7ec8e3;
    text-decoration: none;
}

.tibia-map-attribution a:hover {
    text-decoration: underline;
}

/* ─── Panel lateral ─────────────────────────────────────────────── */
#tibia-map-side-panel {
    width: 0;
    overflow: hidden;
    background: #f2f2f2;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    flex-shrink: 0;
    height: 100vh;
}

#tibia-map-side-panel.open {
    width: 300px;
    border-left: 4px solid #fff;
}

.tibia-side-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px;
    background: #dddddd;
    flex-shrink: 0;
}

.tibia-side-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tibia-side-panel-img {
    width: 64px;
    height: 64px;
    border-radius: 5px;
    background: #afafaf;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
    margin-bottom: 0 !important;
}

.tibia-side-panel-name {
    font-size: 15px;
    font-weight: bold;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: 0.3px;
    margin: 0 0 5px 0;
}

.tibia-side-panel-meta {
    font-size: 12px;
    color: #888;
}

.tibia-side-panel-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    margin-left: 6px;
}

.tibia-side-panel-close:hover {
    color: #dc3545;
}

.tibia-side-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 0;
}

/* ─── Zonas en el panel ─────────────────────────────────────────── */
.tibia-side-zones-list {
    display: flex;
    flex-direction: column;
}

.tibia-side-zone {
    padding: 10px 12px;
    cursor: pointer;
    margin-bottom: 5px;
    border-bottom: 2px solid #dddddd;
    transition: background 0.15s;
}

.tibia-side-zone:hover {
    background: rgba(49,67,226,0.2);
}

.tibia-side-zone.current-floor {
    border-left: 3px solid #3143e2;
}

.tibia-side-zone-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tibia-side-zone-label {
    font-size: 12px;
    font-weight: bold;
    color: #34495e;
}

.tibia-side-zone-floor {
    font-size: 11px;
    font-weight: bold;
    background: rgba(49,67,226,0.8);
    color: #fff;
    border-radius: 5px;
    padding: 3px 6px;
}

.tibia-side-zone-count {
    font-size: 11px;
    color: #888;
    margin-left: auto;
}

.leaflet-control-zoom {
    display: none !important;
}

/* ─── Botón abrir modal ─────────────────────────────────────────── */
#tibia-map-open-modal {
    width: auto !important;
    padding: 0 10px !important;
    gap: 5px;
    font-size: 14px !important;
}

#tibia-map-open-modal:hover {
    background: #f5ead0;
}

/* ─── Monstruos activos ────────────────────────────────────────── */
#tibia-map-active-monsters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.tibia-active-monster {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(49,67,226,0.4);
    border-radius: 5px;
    padding: 4px 10px 4px 6px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.tibia-active-monster:hover {
    background: rgba(49,67,226,0.8);
    border-color: rgba(49,67,226,0.8);
}

.tibia-active-monster.selected {
    background: #3143e2;
    border-color: #3143e2;
}

.tibia-monster-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tibia-monster-name {
    color: #fff;
}

.tibia-remove-monster {
    background: none !important;
    border: none !important;
    cursor: pointer;
    font-size: 20px !important;
    line-height: 1;
    color: #fff;
    padding: 0;
    margin-left: 2px;
}

.tibia-remove-monster:hover {
    color: #dc3545;
}

/* ─── Toolbar flotante ──────────────────────────────────────────── */
#tibia-map-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 500;
}

#tibia-map-overlay > * {
    pointer-events: all;
}

#tibia-map-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #dddddd;
    border-radius: 5px;
    padding: 5px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-wrap: wrap;

}

#tibia-map-toolbar button {
    width: 32px;
    height: 32px;
    background: #f2f2f2;
    border: 1px solid #dddddd;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border-color 0.2s ease;
    animation: mapFadeIn 0.3s ease-in-out;
}

#tibia-map-toolbar button:hover {
    background: rgba(49,67,226,0.05);
    border-color: #3143e2;
}

#tibia-floor-display {
    min-width: 28px;
    height: 32px;
    background: rgba(49,67,226,0.8);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 6px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* ─── Floor dropdown ────────────────────────────────────────────── */
#tibia-floor-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

#tibia-floor-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #dddddd;
    border-radius: 5px;
    overflow: hidden;
    z-index: 2000;
    min-width: 52px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

#tibia-floor-dropdown.hidden {
    display: none;
}

#tibia-floor-dropdown .tibia-floor-option {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    color: #2c3e50;
    border: none;
    border-bottom: 1px solid #dddddd;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    transition: background 0.15s;
    border-radius: 0;
    box-sizing: border-box;
}

.tibia-floor-option:last-child {
    border-bottom: none;
}

#tibia-floor-dropdown .tibia-floor-option:hover {
    background: rgba(49, 67, 226, 0.8);
    color: #fff;
}

.tibia-floor-option.active {
    background: rgba(49, 67, 226, 0.8);
    color: #fff;
}

/* ─── Iconos de monstruos en el mapa ───────────────────────────── */
.tibia-monster-icon {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    overflow: visible !important;
}

.tibia-monster-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 0 !important;
}

.tibia-monster-icon div {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    /*outline: 2px solid #3143e2;*/
}

/*.tibia-monster-icon div.selected {
    outline: 3px solid #f39c12 !important;
}

.tibia-monster-icon div.spot-selected {
    outline: 3px solid #fff !important;
    box-shadow: 0 0 10px #fff, 0 0 4px #000;
}*/

/* ─── Modal ─────────────────────────────────────────────────────── */
#tibia-map-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

#tibia-map-modal.active {
    display: flex;
}

.tibia-modal-search-row {
    padding: 10px;
}

.tibia-modal-search-row input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #0f0f1a;
    color: #fff;
    font-size: 15px;
}

.tibia-modal-box {
    background: #fff;
    border-radius: 5px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.tibia-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 3px solid rgba(49,67,226,0.8);
    flex-shrink: 0;
}

.tibia-modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    flex: 1;
}

#tibia-map-modal-search {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid #dddddd;
    border-radius: 5px;
    background: #fff;
    color: #34495e;
    font-size: 14px;
    outline: none;
}

#tibia-map-modal-search:focus {
    border-color: #3143e2;
}

#tibia-map-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.tibia-modal-search-row {
    position: relative;
}

#tibia-map-modal-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: none;
}

#tibia-map-modal-clear:hover {
    color: #dc3545;
}

#tibia-modal-search-hint {
    padding: 4px 14px 8px;
    font-size: 12px;
    color: #888;
}

#tibia-map-modal-close:hover {
    color: #dc3545;
}

#tibia-map-modal-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 150px;
}

.tibia-modal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: #f2f2f2;
    border: 1px solid #dddddd;
    border-radius: 5px;
    margin-bottom:0 !important;
    padding: 10px 6px 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border-color 0.2s ease;
    animation: mapFadeIn 0.3s ease-in-out;
    text-align: center;
    justify-content: space-between;
    align-self: stretch;
}

.tibia-modal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(49, 67, 226, 0.15);
    border-color: #3143e2;
    background: rgba(49,67,226,0.1);
}

.tibia-modal-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 10px !important;
}

.tibia-modal-card-name {
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    word-break: break-word;
}

.tibia-modal-card-count {
    font-size: 11px;
    color: #888;
}

/* ====
   ANIMACIONES
   ==== */
@keyframes mapFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Stats del monstruo ────────────────────────────────────────── */
.tibia-side-section {
    padding: 8px 12px;
    margin: 5px;
    border-bottom: 1px solid #dddddd;
}

.tibia-side-section-title {
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.tibia-side-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
}

.tibia-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
}

.tibia-stat-label {
    color: #2c3e50;
}

.tibia-stat-label img {
    width: 13px;
    height: 10px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-right: 4px;
    vertical-align: middle;
    margin-bottom: 0 !important;
}

.tibia-stat-value {
    color: #888;
    font-weight: bold;
}

/* ─── Resistencias ──────────────────────────────────────────────── */
.tibia-res-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tibia-res-badge {
    font-size: 10px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 5px;
    white-space: nowrap;
}

.tibia-res-badge img {
    width: 10px;
    height: 10px;
    object-fit: contain;
    image-rendering: pixelated;
    vertical-align: middle;
    margin-bottom: 0 !important;
}

.res-neutral   { color: #34495e; }
.res-weak      { background: #004D00; color: #2ecc71; }
.res-resistant { background: #5C4F00; color: #CFB000; }
.res-immune    { background: #750101; color: #e74c3c; }

/* ─── Tasks ─────────────────────────────────────────────────────── */
.tibia-task-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tibia-task-badge {
    font-size: 10px;
    background: #0f3460;
    color: #c0a060;
    border: 1px solid #c0a060;
    border-radius: 3px;
    padding: 2px 6px;
}

/* ─── Loot ──────────────────────────────────────────────────────── */
.tibia-loot-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tibia-loot-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.tibia-loot-item img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.tibia-loot-name {
    flex: 1;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tibia-loot-amount {
    color: #888;
    flex-shrink: 0;
}

.tibia-loot-rate {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    text-transform: uppercase;
    font-weight: bold;
}

.tibia-loot-rate--always    { background: #1a4a1a; color: #2ecc71; }
.tibia-loot-rate--common    { background: #1a3a1a; color: #27ae60; }
.tibia-loot-rate--uncommon  { background: #3a3a1a; color: #f39c12; }
.tibia-loot-rate--rare      { background: #3a1a1a; color: #e74c3c; }
.tibia-loot-rate--very\ rare { background: #2a1a3a; color: #9b59b6; }

/* ─── Spots / Zonas ─────────────────────────────── */
.tibia-side-zone-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.tibia-spot-premium {
    font-size: 10px;
    font-weight: bold;
    color: #dd9933;
    margin-left: auto;
}

.tibia-spot-premium img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    image-rendering: pixelated;
    vertical-align: middle;
    margin-bottom: 0 !important;
    margin-right: 3px;
}

.tibia-spot-exp {
    font-size: 10px;
    color: #2ecc71;
}

.tibia-floor-buttons {
    display: none;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.tibia-side-zone.expanded .tibia-floor-buttons {
    display: flex;
}

.tibia-floor-btn {
    background: rgba(49,67,226,0.4);
    border: none;
    color: #fff;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}

.tibia-floor-btn:hover {
    background: rgba(49,67,226,0.8);
}

.tibia-floor-btn.active {
    background: #3143e2;
    color: #fff;
    font-weight: bold;
}

.tibia-no-locations {
    color: #888;
    font-size: 12px;
    padding: 8px 0;
    margin: 0;
}

/* ─── Cluster de monstruos ─────────────────────────────────── */
.tibia-cluster-icon {
    background: none !important;
    border: none !important;
}

.tibia-cluster-inner {
    position: relative;
    width: 60px;
    height: 60px;
}
/*.tibia-cluster-icon .tibia-cluster-inner {
    outline: 3px solid #f39c12 !important;;
    border-radius: 5px;
}

.tibia-cluster-icon .tibia-cluster-inner.spot-selected {
    outline: 3px solid #fff !important;
}*/

.tibia-cluster-inner img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    image-rendering: pixelated;
    margin-bottom: 0 !important;
}

.tibia-cluster-count {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #3143e2;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
    padding: 2px 5px;
    border:1px solid #fff;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    pointer-events: none;
}