/* style.css */

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
    font-family: Arial, sans-serif;
    background-color: #111;
    color: #eee;
}

/* Etiqueta para puertos de aguas someras en resultados del buscador */
.port-label-someras {
    font-size: 0.8em;
    color: #7fd3ff; /* azul claro para resaltar */
    margin-left: 6px;
    opacity: 0.95;
}

/* --- ESTILOS DE CABECERA Y BARRA DE HERRAMIENTAS --- */
#main-header { position: fixed; top: 0; left: 0; width: 100%; height: 80px; z-index: 100; display: flex; justify-content: space-between; align-items: center; padding: 0 15px; box-sizing: border-box; background-color: rgba(30, 30, 30, 0.5); backdrop-filter: blur(5px); border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
#header-logo { max-height: 70px; width: auto; pointer-events: none; position: absolute; left: 50%; transform: translateX(-50%); }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; z-index: 101; }
#battle-menu-toggle, #trade-menu-toggle, #stats-toggle, #crafting-menu-toggle, #wind-predictor-toggle, #forum-link-toggle, #recruit-toggle, #heatmap-toggle, #ammo-calc-toggle { 
    background: rgba(0,0,0,0.5); 
    border: 1px solid #555; 
    width: 45px; 
    height: 45px; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.2s; 
    padding: 6px; /* Reducido para mejor control del icono */
    box-sizing: border-box; 
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3); 
    display: flex; /* Añadido para asegurar el centrado del img */
    justify-content: center;
    align-items: center;
}

/* ESTILOS DE ILUMINACIÓN */
#battle-menu-toggle.active, #trade-menu-toggle.active, #stats-toggle.active, #crafting-menu-toggle.active, #wind-predictor-toggle.active, #forum-link-toggle.active, #recruit-toggle.active, #heatmap-toggle.active, #ammo-calc-toggle.active { 
    background: rgba(52, 140, 219, 0.8); /* Fondo ligeramente azul para activo */
    border-color: #2980b9; 
    box-shadow: 0 0 15px #3498db; 
}
#battle-menu-toggle:hover, #trade-menu-toggle:hover, #stats-toggle:hover, #crafting-menu-toggle:hover, #wind-predictor-toggle:hover, #forum-link-toggle:hover, #recruit-toggle:hover, #heatmap-toggle:hover, #ammo-calc-toggle:hover { 
    background: rgba(0,0,0,0.8); 
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6); 
}

#battle-menu-toggle.raid-active {
    border-color: #ff4d4d;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 8px rgba(255, 0, 0, 0.7), 0 0 3px rgba(255, 0, 0, 0.8) inset; }
    50% { box-shadow: 0 0 18px rgba(255, 80, 80, 1), 0 0 6px rgba(255, 80, 80, 1) inset; }
    100% { box-shadow: 0 0 8px rgba(255, 0, 0, 0.7), 0 0 3px rgba(255, 0, 0, 0.8) inset; }
}

/* ESTILOS PARA LOS NUEVOS ICONOS PNG A COLOR */
#main-header button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Aplicar un filtro de sombra para el estado normal (apagado) */
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5)); 
    transition: filter 0.2s;
}

/* EFECTO DE ILUMINACIÓN EN ESTADO ACTIVO */
#main-header button.active img {
    /* Iluminación fuerte y suave para iconos a color */
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.5));
}

#port-search-container { width: 200px; position: relative; }
#port-search-input { width: 100%; padding: 8px; background: #333; border: 1px solid #555; color: #eee; border-radius: 4px; box-sizing: border-box; }
#port-search-results { position: absolute; background: #1e1e1e; border-radius: 4px; box-shadow: 0 5px 10px rgba(0,0,0,0.5); max-height: 200px; overflow-y: auto; margin-top: 5px; width: 200px; z-index: 1001;} 
#port-search-results div { padding: 10px; cursor: pointer; border-radius: 4px; }
#port-search-results div:hover { background-color: #333; }

.side-panel { position: fixed; top: 80px; width: 300px; height: calc(100% - 80px); background: #1e1e1e; z-index: 1000; box-shadow: 5px 0 15px rgba(0,0,0,0.5); box-sizing: border-box; transition: transform 0.3s ease-in-out; display: flex; flex-direction: column; }
#battle-menu, #trade-menu, #crafting-menu { left: 0; }
#stats-menu { right: 0; } 
#battle-menu.hidden, #trade-menu.hidden, #crafting-menu.hidden { transform: translateX(-100%); }
#stats-menu.hidden { transform: translateX(100%); }

.side-panel > div, #stats-menu h3 { padding: 15px; }
.side-panel > div { flex: 1; overflow-y: auto; }

#stats-menu h3 { padding-top: 15px; text-align: center; margin: 0; }
#battle-intelligence h4, #route-finder h4, #recipe-finder h4, #special-ports h4, .stats-section h4, #top-profit-container h4, #product-finder h4, #port-to-port-container h4 { margin: 0 0 10px 0; color: #999; border-bottom: 1px solid #444; padding-bottom: 10px;}

.battle-section { padding-top: 10px; border-top: 1px solid #444; }
.battle-section h5 { margin: 0 0 10px; color: #bbb; font-size: 16px; }
.battle-section ul { list-style: none; padding: 0; margin: 0; }
.battle-section li { padding: 8px 4px; border-radius: 4px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; }
.battle-section li:hover { background-color: #333; }
.battle-section .port-name { font-weight: bold; }
.battle-section .port-info { font-size: 12px; color: #999; }
.battle-section .port-date { font-weight: bold; color: #e67e22; }
.battle-section .port-date.defense { color: #2ecc71; }
.battle-section .empty-list { color: #777; font-style: italic; padding: 10px 4px; }

/* --- ESTILOS/* === 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, #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 {
    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 { padding: 10px; cursor: pointer; border-radius: 4px; }
#recipe-finder-results .recipe-result:hover { background-color: #333; }
#recipe-finder-results .recipe-details h5 { margin: 10px 0 5px; color: #bbb; border-bottom: 1px solid #444; padding-bottom: 5px; }
#recipe-finder-results .recipe-details ul { list-style: none; padding-left: 10px; margin: 0; }
#recipe-finder-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; }

/* Nuevo Compás Interactivo */
#compass-selector-container {
    width: 200px;
    height: 200px;
    position: relative;
    margin: 20px auto;
    cursor: crosshair;
}

.compass-image {
    width: 100%;
    height: 100%;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.wind-compass-pair {
    display: flex;
    gap: 28px;
    align-items: center;
    justify-content: space-between;
    background: rgba(21, 32, 43, 0.55);
    border: 1px solid rgba(88, 166, 255, 0.25);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.compass-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 1 1 50%;
}

.compass-block-prediction {
    padding-top: 26px;
}

.compass-block label {
    font-weight: 600;
    color: #9fb7ff;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}


#wind-result-compass,
#compass-selector-container {
    width: 240px;
    height: 240px;
    position: relative;
    margin: 0 auto;
}

#wind-result-arrow {
    position: absolute;
    width: 30px;
    height: 120px;
    left: 50%;
    top: 50%;
    margin: -60px 0 0 -15px;
    transform-origin: 15px 60px;
    transition: transform 0.5s ease-out;
    z-index: 2;
    pointer-events: none;
}

#wind-result-arrow::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid #2ecc71;
    bottom: 10px;
    left: 0;
}

#wind-result-arrow::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 100px;
    background-color: #2ecc71;
    left: 12px;
    top: 10px;
}

#wind-result-arrow span {
    position: absolute;
    display: block;
    width: 30px;
    height: 10px;
    background-color: #2ecc71;
    left: 0;
    top: 0;
    border-radius: 2px;
}

#wind-result-display {
    font-weight: 600;
    color: #2ecc71;
    text-align: center;
    min-height: 20px;
    font-size: 15px;
    letter-spacing: 0.4px;
    margin-top: -6px;
}

.wind-result-body {
    display: flex;
    align-items: center;
    gap: 36px;
    justify-content: center;
    padding: 26px;
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 16px;
    background: rgba(18, 26, 38, 0.55);
}

.wind-result-body .compass-container {
    width: 240px;
    height: 240px;
    position: relative;
}

.wind-result-metadata {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    text-align: center;
}

.wind-main {
    font-size: 22px;
    font-weight: 600;
    color: #58a6ff;
    margin: 0;
}

.wind-secondary {
    font-size: 18px;
    color: #a5b4d8;
    margin: 0;
}

.wind-label {
    font-size: 13px;
    letter-spacing: 1px;
    color: #9fb7ff;
    margin: 0;
}

.wind-label-inverse {
    color: #cfd9ff;
}

/* Contenedor del compás */
#compass-selector-container {
    cursor: crosshair;
}

/* Imagen del compás */
.compass-image {
    width: 100%;
    height: 100%;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

/* Contenedor de la flecha */
#compass-arrow {
    position: absolute;
    width: 30px;
    height: 120px; /* Altura fija para la flecha */
    left: 50%;
    top: 50%;
    margin: -60px 0 0 -15px; /* Centrado vertical y horizontal */
    transform-origin: 15px 60px; /* Punto de pivote en el centro de la flecha */
    transition: transform 0.5s ease-out;
    z-index: 2;
    pointer-events: none;
}

/* Triángulo inferior (cola) */
#compass-arrow::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid #e74c3c;
    bottom: 10px; /* Ajuste para posicionar la cola */
    left: 0;
}

/* Cuerpo de la flecha */
#compass-arrow::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 100px;
    background-color: #e74c3c;
    left: 12px;
    top: 10px; /* Ajuste para posicionar el cuerpo */
}

/* Punta de la flecha */
#compass-arrow span {
    position: absolute;
    display: block;
    width: 30px;
    height: 10px;
    background-color: #e74c3c;
    left: 0;
    top: 0;
    border-radius: 2px;
}

#current-wind-display {
    text-align: center;
    margin-top: -6px;
    font-weight: 600;
    color: #58a6ff;
    font-size: 15px;
    letter-spacing: 0.4px;
}

.wind-predictor-content {
    flex-direction: column; 
}

.time-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.time-inputs .input-group {
    width: 100%;
}

.time-inputs label {
    font-weight: 600;
    color: #cfd9ff;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.wind-compass-pair {
    display: flex;
    gap: 28px;
    align-items: center;
    justify-content: space-between;
    background: rgba(21, 32, 43, 0.55);
    border: 1px solid rgba(88, 166, 255, 0.25);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.wind-result-body {
    flex-direction: column;
    padding: 18px;
    gap: 20px;
}

.wind-result-body .compass-container {
    width: 180px;
    height: 180px;
}

#calculate-wind-button {
    padding: 10px;
    font-size: 1em;
}

/* ========================================================================= */
/* --- ESTILOS RESPONSIVE PARA DISPOSITIVOS MÓVILES (Max 768px) --- */
/* ========================================================================= */
@media (max-width: 768px) {
    
    /* CABECERA Y BARRA DE HERRAMIENTAS */
    #main-header {
        height: 60px; 
        padding: 0 5px;
    }

    #header-logo {
        max-height: 50px;
    }

    .toolbar-left, .toolbar-right {
        gap: 5px; 
    }

    /* Botones de menú */
    #battle-menu-toggle, 
    #trade-menu-toggle, 
    #stats-toggle, 
    #crafting-menu-toggle, 
    #wind-predictor-toggle,
    #forum-link-toggle {
        width: 35px; 
        height: 35px;
        padding: 5px;
        border-radius: 6px;
        box-shadow: 0 0 5px rgba(255,255,255,0.2);
    }
    
    /* Barra de búsqueda de puerto */
    #port-search-container {
        width: 140px; 
    }

    #port-search-input {
        padding: 6px;
        font-size: 0.9em;
    }
    
    #port-search-results {
        width: 140px; 
        max-height: 150px;
    }
    
    /* PANELES LATERALES (Menús de Inteligencia) */
    .side-panel {
        width: 90%; 
        top: 60px; 
        height: calc(100% - 60px); 
        box-shadow: 0 0 15px rgba(0,0,0,0.8); 
    }

    /* Corregido: Mover el panel de stats a la izquierda en móvil */
    #stats-menu {
        right: auto; 
        left: 0;
    } 
    #stats-menu.hidden {
        transform: translateX(-100%); 
    }

    /* Ajustes internos de los paneles */
    .side-panel > div, #stats-menu h3 {
        padding: 10px; 
    }
    
    /* Títulos dentro de los paneles */
    #battle-intelligence h4, #route-finder h4, #recipe-finder h4, #special-ports h4, 
    .stats-section h4, #top-profit-container h4, #product-finder h4, #port-to-port-container h4 { 
        font-size: 1.1em;
        padding-bottom: 5px;
        margin-bottom: 5px;
    }

    /* Detalles de batalla para mayor claridad */
    .battle-section li {
        flex-direction: column; 
        align-items: flex-start;
        padding: 6px 4px;
    }
    .battle-section .port-date {
        font-size: 12px;
        margin-top: 2px;
    }

    /* VENTANA MODAL (Predictor de Viento) */
    #wind-predictor-modal {
        width: 95%; 
        max-width: 400px; 
        padding: 15px;
    }
    
    .wind-predictor-content {
        flex-direction: column; 
    }
    
    .wind-controls, #wind-prediction-result {
        flex-basis: 100%;
        width: 100%;
    }
    
    #wind-predictor-modal h4 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
    
    .wind-compass-pair {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .compass-block-prediction {
        padding-top: 0;
    }

    #compass-selector-container,
    #wind-result-compass {
        width: 180px;
        height: 180px;
    }
    
    #calculate-wind-button {
        padding: 10px;
        font-size: 1em;
    }

    /* Nuevo Modal Bidireccional - Responsivo */
    #port-to-port-modal {
        max-width: 95%;
        width: 95%;
    }
    #port-to-port-modal .input-group {
        margin-bottom: 10px;
    }
    #bidirectional-results p {
        flex-direction: column;
        align-items: flex-start;
    }
    #bidirectional-results p span {
        margin-top: 2px;
    }
    
    /* MODIFICADO: PANEL DE PUERTO A PANTALLA CASI COMPLETA */
    .port-panel {
        width: 95%; 
        height: 90%; 
        max-width: none; 
        top: 50%; 
        left: 50%;
        transform: translate(-50%, -50%);
        padding: 10px;
    }

    /* IMPORTANTE: Hacer que el contenido de las pestañas sea deslizable */
    #battle, #trade, #material-list-container {
        flex-grow: 1;
        overflow-y: auto;
    }
    #tradeItems {
        max-height: none; 
    }


    .tabs {
        margin-bottom: 5px;
    }

    .tab-button {
        padding: 6px;
        font-size: 0.9em;
    }

    /* Ajustar la lista de comercio */
    #tradeItems li {
        flex-direction: column; 
        align-items: flex-start;
        padding: 6px 4px;
    }
    #tradeItems .item-name {
        flex-basis: 100%;
        margin-bottom: 2px;
        font-weight: bold;
    }
    #tradeItems .item-details {
        flex-basis: 100%;
        text-align: left;
    }
    
    /* Footer */
    #copyright-footer {
        font-size: 10px;
    }
}