/* === BATTLE MAP MODAL STYLES === */
.battle-map-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

/* --- CAMBIO APLICADO --- */
/* Se cambió max-width/height por width/height fijos (95vw/95vh) */
/* y se añadió flexbox para que el canvas se expanda. */
.battle-map-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #222;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    width: 95vw;  /* <--- CAMBIADO */
    height: 95vh; /* <--- CAMBIADO */
    overflow: hidden;
    display: flex;          /* <--- AÑADIDO */
    flex-direction: column; /* <--- AÑADIDO */
}
/* --- FIN DEL CAMBIO --- */

.battle-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.battle-map-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.zoom-in-btn, .zoom-out-btn, .center-btn, .measure-btn, .wind-vector-btn {
    background: #444;
    color: #fff;
    border: 1px solid #666;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 40px;
}

.zoom-in-btn:hover, .zoom-out-btn:hover, .center-btn:hover, .measure-btn:hover, .wind-vector-btn:hover {
    background: #555;
    border-color: #777;
}

.measure-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
}

.measure-btn.active {
    background: linear-gradient(135deg, #ff5c5c, #ff2d55);
    border-color: rgba(255, 45, 85, 0.7);
    box-shadow: 0 6px 14px rgba(255, 45, 85, 0.28);
}

.wind-vector-btn {
    font-weight: 600;
}

.wind-vector-btn.active {
    background: linear-gradient(135deg, #1d8cf8, #1a68d1);
    border-color: rgba(29, 140, 248, 0.75);
    box-shadow: 0 6px 14px rgba(29, 140, 248, 0.28);
}

.measurement-info {
    color: #9fb7ff;
    font-size: 12px;
    font-family: "Roboto Mono", monospace;
    padding: 4px 8px;
    background: rgba(28, 40, 56, 0.7);
    border: 1px solid rgba(88, 166, 255, 0.35);
    border-radius: 6px;
    min-width: 110px;
    text-align: center;
}

.zoom-level {
    color: #ccc;
    font-size: 12px;
    min-width: 80px;
    text-align: center;
}

.close-battle-map {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: background 0.2s;
    flex-shrink: 0;
}

.close-battle-map:hover {
    background: #c0392b;
}

/* --- CAMBIO APLICADO --- */
/* Se añadió flex-grow para que el canvas ocupe el espacio disponible, */
/* min-height para flexbox, y width 100% */
.battle-map-canvas {
    display: block;
    cursor: grab;
    background: #000;
    flex-grow: 1;  /* <--- AÑADIDO */
    min-height: 0; /* <--- AÑADIDO */
    width: 100%;   /* <--- AÑADIDO */
}
/* --- FIN DEL CAMBIO --- */

.battle-map-canvas:active {
    cursor: grabbing;
}

.battle-map-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: #333;
    border-top: 1px solid #555;
    font-size: 12px;
    color: #ccc;
}

.battle-map-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* === HEATMAP MODAL STYLES === */
#heatmap-modal.hidden {
    display: none;
}

.heatmap-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95vw;
    height: 95vh;
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 0 22px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(20, 32, 48, 0.85);
    border-bottom: 1px solid rgba(88, 166, 255, 0.18);
}

.heatmap-title-block h3 {
    margin: 0;
    font-size: 20px;
    color: #f0f4ff;
}

.heatmap-subtitle {
    font-size: 13px;
    color: #8aa9ff;
}

.heatmap-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.heatmap-action-btn,
.heatmap-close-btn {
    background: #2d3f5d;
    border: 1px solid #49699a;
    color: #f0f4ff;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.heatmap-action-btn:hover,
.heatmap-close-btn:hover {
    background: #375174;
    border-color: #6b91d4;
}

.heatmap-close-btn {
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: #d9534f;
    border: none;
}

.heatmap-close-btn:hover {
    background: #c0392b;
}

.heatmap-body {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    height: 100%;
}

.heatmap-sidebar {
    padding: 18px 16px;
    background: rgba(18, 26, 40, 0.92);
    border-right: 1px solid rgba(88, 166, 255, 0.1);
    overflow-y: auto;
}

.heatmap-sidebar-right {
    border-right: none;
    border-left: 1px solid rgba(88, 166, 255, 0.1);
}

.heatmap-sidebar h4 {
    margin: 0 0 10px;
    font-size: 15px;
    color: #dbe7ff;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.heatmap-sidebar select {
    width: 100%;
    margin-bottom: 18px;
    padding: 8px 10px;
    background: #25344f;
    color: #fff;
    border: 1px solid #49699a;
    border-radius: 6px;
}

.heatmap-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.heatmap-search {
    position: relative;
    margin-bottom: 20px;
}

.heatmap-search input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid #49699a;
    background: #1d2a41;
    color: #f0f4ff;
    font-size: 14px;
}

.heatmap-search input:focus {
    outline: none;
    border-color: #6b91d4;
    box-shadow: 0 0 0 2px rgba(105, 155, 255, 0.25);
}

.heatmap-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: rgba(13, 20, 32, 0.98);
    border: 1px solid rgba(88, 166, 255, 0.28);
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
    z-index: 3;
}

.heatmap-suggestions.hidden {
    display: none;
}

.heatmap-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #dbe7ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.heatmap-suggestion-item span {
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.heatmap-suggestion-item small {
    color: #7ea0ff;
    font-size: 11px;
}

.heatmap-suggestion-item:hover,
.heatmap-suggestion-item.active {
    background: rgba(68, 119, 206, 0.32);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #bdc9ff;
    font-size: 13px;
}

.legend-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.swatch-high { background: linear-gradient(135deg, #ff4d4d, #ff8c42); }
.swatch-medium { background: linear-gradient(135deg, #ffb347, #ffd056); }
.swatch-low { background: linear-gradient(135deg, #4fc3f7, #81d4fa); }

.heatmap-main {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #0f1622;
}

.heatmap-toolbar {
    display: flex;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(12, 20, 32, 0.9);
    border-bottom: 1px solid rgba(88, 166, 255, 0.12);
}

.heatmap-layer-btn {
    padding: 6px 14px;
    border-radius: 5px;
    border: 1px solid #476fa6;
    background: rgba(24, 40, 63, 0.9);
    color: #e2ecff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.heatmap-layer-btn:hover {
    background: rgba(46, 71, 110, 0.95);
    border-color: #6b91d4;
}

.heatmap-layer-btn.active {
    background: linear-gradient(135deg, #4f8cff, #8265ff);
    border-color: rgba(129, 155, 255, 0.7);
    box-shadow: 0 4px 12px rgba(90, 132, 255, 0.25);
}

#heatmap-canvas {
    flex: 1;
    width: 100%;
    background: #09101d;
}

.heatmap-footnote {
    padding: 8px 18px;
    font-size: 12px;
    color: #8aa9ff;
    background: rgba(12, 20, 32, 0.9);
    border-top: 1px solid rgba(88, 166, 255, 0.12);
}

.heatmap-summary {
    margin-top: 12px;
    padding: 12px;
    background: rgba(36, 52, 78, 0.8);
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 8px;
    color: #dbe7ff;
    font-size: 13px;
    line-height: 1.5;
}

/* === ESTILOS DE VENTANAS MODALES Y OVERLAY === */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 800;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30,30,30,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    z-index: 1001;
}

.modal.hidden {
    display: none;
}

.close-button {
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 22px;
    position: absolute;
    top: 10px;
    right: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

#route-finder-input, #recipe-finder-input, #recommender-recipe-input, #product-finder-input {
    width: 100%;
    padding: 10px;
    background: #333;
    border: 1px solid #555;
    color: #eee;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

#route-finder-results .route {
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}

#route-finder-results .route:hover {
    background-color: #333;
}

#route-finder-results .route-details p {
    margin: 4px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

#route-finder-results .port-link {
    text-decoration: underline;
}

#route-finder-results .price-buy {
    color: #e74c3c;
}

#route-finder-results .price-sell {
    color: #2ecc71;
}

#route-finder-results .distance {
    color: #999;
}

#open-product-search,
#open-port-to-port-modal {
    margin-top: 12px;
    padding: 12px 18px;
    width: 100%;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #4f8cff, #8265ff);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    box-shadow: 0 8px 16px rgba(79, 140, 255, 0.25);
}

#open-product-search:hover,
#open-port-to-port-modal:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(79, 140, 255, 0.35);
    filter: brightness(1.05);
}

#open-product-search:active,
#open-port-to-port-modal:active {
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(79, 140, 255, 0.25);
    filter: brightness(0.95);
}

#show-battle-map-button {
    margin-top: 12px;
    padding: 12px 18px;
    width: 100%;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #ff5c5c, #ff2d55);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    box-shadow: 0 8px 16px rgba(255, 45, 85, 0.25);
}

#show-battle-map-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(255, 45, 85, 0.35);
    filter: brightness(1.05);
}

#show-battle-map-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(255, 45, 85, 0.25);
    filter: brightness(0.95);
}

#product-search-modal .modal-content,
#port-to-port-modal {
    width: 520px;
    max-width: 90vw;
    padding: 24px;
    background: #1f1f1f;
    border-radius: 8px;
    border: 1px solid #58a6ff;
    position: relative;
}

#product-search-modal h4,
#port-to-port-modal h4 {
    margin: 0 0 15px;
    color: #58a6ff;
    text-align: center;
}

#product-search-modal .modal-field,
#port-to-port-modal .modal-field {
    margin-bottom: 18px;
    position: relative;
}

#product-search-modal .modal-field label,
#port-to-port-modal .modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #bbb;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#product-search-query {
    width: 100%;
    padding: 10px 14px;
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    margin-bottom: 15px;
}

#product-search-query:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 6px rgba(88, 166, 255, 0.4);
}

#product-origin-input {
    width: 100%;
    padding: 10px 14px;
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
}

#product-origin-input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 6px rgba(88, 166, 255, 0.4);
}

#product-sort-select {
    width: 100%;
    padding: 10px 14px;
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
}

#product-sort-select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 6px rgba(88, 166, 255, 0.4);
}

.sort-hint {
    display: block;
    margin-top: 6px;
    color: #808fb3;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.product-result .sort-warning {
    margin: 8px 0 4px;
    padding: 8px 10px;
    background: rgba(255, 180, 0, 0.12);
    border: 1px solid rgba(255, 180, 0, 0.25);
    border-radius: 6px;
    color: #ffbd4a;
    font-size: 12px;
}

.suggestions-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: #232323;
    border: 1px solid #3d3d3d;
    border-radius: 6px;
    margin-top: 6px;
    z-index: 3;
    display: none;
}

.suggestions-list.active {
    display: block;
}

.suggestions-list div {
    padding: 8px 12px;
    cursor: pointer;
    color: #ddd;
}

.suggestions-list div:hover,
.suggestions-list div.active-option {
    background: #2f2f2f;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-description {
    margin: 0;
    font-size: 14px;
    color: #9fb7ff;
    line-height: 1.5;
}

.modal-results {
    max-height: 60vh;
    overflow-y: auto;
}

.modal-results .product-result {
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #262626;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-results .product-result:hover {
    background: #303030;
}

.modal-results .product-result h5 {
    margin: 0 0 6px;
    color: #58a6ff;
}

/* === RECRUIT MODAL === */
.recruit-modal {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 12, 24, 0.92);
}

.recruit-modal:not(.hidden) {
    display: flex;
}

.recruit-modal-content {
    width: min(720px, 90vw);
    max-height: 90vh;
    overflow-y: auto;
    background: radial-gradient(circle at top, rgba(24, 38, 68, 0.95), rgba(10, 18, 32, 0.95));
    border: 2px solid rgba(88, 166, 255, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    border-radius: 14px;
    padding: 28px;
    position: relative;
    color: #f0f6ff;
    backdrop-filter: blur(6px);
}

.recruit-modal .close-button {
    top: 18px;
    right: 22px;
    background: rgba(15, 25, 45, 0.9);
    border: 1px solid rgba(143, 192, 255, 0.45);
    color: #9fc5ff;
}

.recruit-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.recruit-hero-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.45));
}

.recruit-hero-text h2 {
    margin: 6px 0 0;
    font-size: 28px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffe08a;
    text-shadow: 0 0 8px rgba(255, 224, 138, 0.35);
}

.recruit-callout {
    display: inline-block;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #9bc9ff;
    background: rgba(21, 34, 58, 0.85);
    border: 1px solid rgba(88, 166, 255, 0.35);
    padding: 6px 12px;
    border-radius: 999px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.recruit-body {
    font-size: 15px;
    line-height: 1.7;
    color: #dfe9ff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid rgba(88, 166, 255, 0.25);
    border-bottom: 1px solid rgba(88, 166, 255, 0.25);
    padding: 20px 0;
}

.recruit-body p {
    margin: 0;
    text-align: justify;
}

.recruit-divider {
    text-align: center;
    letter-spacing: 8px;
    font-size: 18px;
    color: rgba(255, 224, 138, 0.8);
    margin: 8px 0;
}

.recruit-serious {
    background: rgba(12, 24, 46, 0.8);
    border-left: 3px solid rgba(88, 166, 255, 0.6);
    padding: 12px 16px;
    border-radius: 6px;
}

.recruit-footer {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.recruit-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2f80ed, #56ccf2);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 16px 40px rgba(47, 128, 237, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.recruit-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(47, 128, 237, 0.45);
}

.recruit-cta .cta-icon {
    font-size: 22px;
}

.modal-results .product-result p {
    margin: 2px 0;
    color: #ddd;
    font-size: 14px;
}

.modal-results .product-meta {
    color: #aaa;
    font-size: 12px;
}

.product-port-list {
    margin-top: 10px;
    border-top: 1px solid #333;
    padding-top: 10px;
}

.product-port-list .port-entry {
    padding: 10px 0;
    border-bottom: 1px solid #2a2a2a;
}

.product-port-list .port-entry:last-child {
    border-bottom: none;
}

.port-entry-header {
    display: flex;
    justify-content: space-between;
    color: #58a6ff;
    font-weight: 600;
}

.port-entry-details {
    margin-top: 6px;
    font-size: 13px;
    color: #ddd;
    line-height: 1.5;
}

.port-entry-details span {
    display: block;
}

.modal-results .empty-results {
    text-align: center;
    padding: 20px;
    color: #888;
    font-style: italic;
}

.primary-action {
    margin-top: 10px;
    padding: 12px 18px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #ff8177, #ffb199);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    box-shadow: 0 8px 16px rgba(255, 129, 119, 0.25);
}

.primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(255, 129, 119, 0.35);
    filter: brightness(1.05);
}

.primary-action:active {
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(255, 129, 119, 0.25);
    filter: brightness(0.95);
}

/* ... */

#product-finder {
    border-bottom: 1px solid #444;
}
#port-to-port-container {
    border-bottom: 1px solid #444;
    padding-top: 15px;
}
#product-finder-results .product-location {
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    border-radius: 4px;
}
#product-finder-results .product-location:hover {
    background-color: #333;
}
#product-finder-results .product-location:last-child {
    border-bottom: none;
}
.location-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 5px;
}
.location-details {
    font-size: 0.9em;
    color: #bbb;
}

#top-profit-container { border-bottom: 1px solid #444; }
#top-profit-list { list-style: none; padding: 0; margin: 0; }
#top-profit-list li { display: flex; justify-content: space-between; padding: 8px 4px; border-radius: 4px; cursor: pointer; font-size: 14px; }
#top-profit-list li:hover { background-color: #333; }
.top-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.top-item-profit { color: #2ecc71; font-weight: bold; flex-shrink: 0; }

#recipe-finder-results .recipe-result, #recommender-recipe-results .recipe-result { padding: 10px; cursor: pointer; border-radius: 4px; }
#recipe-finder-results .recipe-result:hover, #recommender-recipe-results .recipe-result:hover { background-color: #333; }
#recipe-finder-results .recipe-details h5, #recommender-recipe-results .recipe-details h5 { margin: 10px 0 5px; color: #bbb; border-bottom: 1px solid #444; padding-bottom: 5px; }
#recipe-finder-results .recipe-details ul, #recommender-recipe-results .recipe-details ul { list-style: none; padding-left: 10px; margin: 0; }
#recipe-finder-results .recipe-details li, #recommender-recipe-results .recipe-details li { padding: 4px 0; }
#special-ports { border-top: 1px solid #444; }
#special-ports-list { list-style: none; padding: 0; margin: 0; }
#special-ports-list li { padding: 10px; cursor: pointer; border-radius: 4px; display: flex; justify-content: space-between; align-items: center;}
#special-ports-list li:hover { background-color: #333; }
.bonus-tag { font-size: 10px; padding: 2px 5px; border-radius: 8px; color: #fff; font-weight: bold; margin-left: 5px; }
.craft-chance { background-color: #27ae60; }
.convert-res { background-color: #f39c12; }

#raid-alerts { margin-bottom: 15px; }
#raid-alerts .alert { background-color: #c0392b; padding: 10px; border-radius: 4px; font-size: 14px; text-align: center; cursor: pointer; margin-bottom: 5px; }

#stats-content-wrapper { flex: 1; overflow-y: auto; }
.stats-section { border-top: 1px solid #444; }
.stats-section:first-child { border-top: none; }

#nation-dominance-list, #trade-hubs-list, #clan-power-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.stats-section li { display: flex; align-items: center; padding: 8px; border-radius: 4px; }
.stats-section li:hover { background-color: #333; cursor: pointer; }
.stats-section .rank-badge { font-weight: bold; color: #888; margin-right: 10px; }
.stats-section .nation-icon { width: 20px; height: 20px; margin-right: 8px; }
.stats-section .stat-value { margin-left: auto; color: #bbb; }

#map-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
canvas { display: block; width: 100%; height: 100%; background-color: #000; }

/* MODIFICADO: Panel de puerto base para soportar scroll en el contenido */
.port-panel { 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: #1e1e1e; 
    color: white; 
    border: 2px solid #444; 
    border-radius: 8px; 
    padding: 10px; 
    z-index: 900; 
    width: 300px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.5); 
    
    /* Configuración Flex para manejar el scroll del contenido */
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Limitar altura para escritorio */
}

.close-button { position: absolute; top: 5px; right: 8px; background: #444; color: white; border: none; font-size: 16px; cursor: pointer; border-radius: 4px; padding: 2px 6px; }
.close-button:hover { background: #666; }
.tabs { display: flex; justify-content: space-around; margin-bottom: 10px; }
.tab-button { background: #333; color: white; border: none; padding: 8px; cursor: pointer; border-radius: 4px; flex: 1; margin: 0 2px; }
.tab-button.active { background: #555; }
.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* === CORRECCIÓN APLICADA AQUÍ === */
.hidden { display: none !important; }
/* ================================= */

#tradeItems { list-style-type: none; padding: 0; margin: 0; max-height: 250px; overflow-y: auto; }
#tradeItems li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid #333; font-size: 14px; }
#tradeItems li:last-child { border-bottom: none; }
#tradeItems .item-name { flex-basis: 50%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tradeItems .item-details { flex-basis: 50%; text-align: right; color: #bbb; }
#tradeItems .price-buy { color: #e74c3c; }
#tradeItems .price-sell { color: #2ecc71; }

#material-list-container { max-height: 400px; overflow-y: auto; padding-right: 10px; }
.material-item { margin-bottom: 15px; border-bottom: 1px solid #444; padding-bottom: 10px; }
.material-item:last-child { border-bottom: none; }
.material-item h4 { margin: 0 0 8px 0; color: #bbb; }
.material-item ul { list-style: none; padding-left: 10px; margin: 0; }
.material-item li { font-size: 14px; padding: 3px 0; }

#tooltip { position: fixed; display: none; background-color: rgba(34, 34, 34, 0.9); color: #eee; padding: 8px 12px; border-radius: 6px; font-size: 14px; z-index: 2100; pointer-events: none; border: 1px solid #444; box-shadow: 0 2px 5px rgba(0,0,0,0.5); white-space: nowrap; }
#tooltip strong { color: #58a6ff; }
#battleCountdown { font-size: 1.2em; font-weight: bold; color: #e74c3c; font-family: 'Courier New', Courier, monospace; }
#trade-summary { margin-top: 15px; padding-top: 10px; border-top: 1px solid #444; font-size: 14px; color: #ccc; }
#trade-summary p { margin: 5px 0; display: flex; justify-content: space-between; }
#trade-summary span { font-weight: bold; color: #fff; }
#port-defenses { list-style-type: none; padding: 5px 0 0 10px; margin: 5px 0; font-size: 14px; }
#port-defenses li { padding: 2px 0; color: #aeb8c5; }
hr { border: none; border-top: 1px solid #444; margin: 10px 0; }
#copyright-footer { position: fixed; bottom: 10px; left: 10px; z-index: 10; font-size: 12px; color: #aaa; opacity: 0.6; pointer-events: none; }
.depth-shallow { color: #3498db; }
.depth-deep { color: #e67e22; }
