/**
 * File: css/meteonav_nautical_tools.css
 * Namespace: nautical-tools-*
 * Version: 2.0.1
 * Date: 2025-12-21
 * Time: 16:17 (Europe/Athens)
 * Author: Alex Moustris
 * Purpose: Styles for the Nautical Tools popup and layout
 * Description: Styles for nautical tools popup including minimize/maximize button
 *              (yellow minimize, green maximize) available on mobile and desktop,
 *              minimized state hiding content, and mobile-responsive layout.
 * Status: STABLE
 */

/* Overlay layer for click interception */
.nautical-tools-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1200;
  background: transparent;
  pointer-events: auto;
  cursor: crosshair;
}

/* Popup container */
.nautical-tools-popup {
  position: absolute;
  top: 80px;
  left: 20px;
  width: 400px;
  max-height: 85vh;
  background: rgb(255, 255, 255);
  border: 2px solid rgb(0, 51, 102);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  padding: 12px;
  z-index: 999999;
  font-family: 'Inter', 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  display: none;
  overflow-y: auto;
  flex-direction: column;
  /* Safari touch behavior */
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.nautical-tools-popup-header {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 8px;
  color: rgb(0, 51, 102);
  /* Safari cursor fallback chain */
  cursor: move;
  cursor: -webkit-grab;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* Active/dragging state cursor */
.nautical-tools-popup-header:active {
  cursor: move;
  cursor: -webkit-grabbing;
  cursor: grabbing;
}

.nautical-tools-popup-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: rgb(0, 51, 102);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.2s;
  flex-shrink: 0;
  user-select: none;
}

.nautical-tools-popup-close:hover {
  background: rgba(0, 51, 102, 0.1);
}

.nautical-tools-popup-close:active {
  background: rgba(0, 51, 102, 0.2);
}

.nautical-tools-instructions {
  font-size: 13px;
  margin-bottom: 10px;
  color: rgb(34, 34, 34);
  line-height: 1.4;
}

.nautical-tools-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.nautical-tools-buttons button {
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid rgb(0, 51, 102);
  background: rgb(232, 240, 255);
  cursor: pointer;
  color: rgb(0, 51, 102);
  font-weight: 500;
  transition: background-color 150ms ease-out;
}

.nautical-tools-buttons button:hover {
  background: rgb(212, 228, 255);
}

.nautical-tools-buttons button:active {
  background: rgb(192, 216, 255);
}

.nautical-tools-segments-container {
  overflow-y: auto;
  border-top: 1px solid rgb(221, 221, 221);
  border-bottom: 1px solid rgb(221, 221, 221);
  padding-top: 6px;
  padding-bottom: 6px;
  margin-bottom: 10px;
  max-height: 250px;
  flex-shrink: 1;
}

.nautical-tools-segment-row {
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgb(240, 240, 240);
  white-space: nowrap;
  color: rgb(68, 68, 68);
}

.nautical-tools-segment-row:last-child {
  border-bottom: none;
}

.nautical-tools-total-distance {
  font-size: 13px;
  font-weight: bold;
  text-align: right;
  color: rgb(0, 51, 102);
  margin-bottom: 8px;
  padding-top: 4px;
  border-top: 1px solid rgb(221, 221, 221);
}

/* Best Weather Window section */
.nautical-tools-weather-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgb(221, 221, 221);
}

.nautical-tools-weather-title {
  font-size: 14px;
  font-weight: bold;
  color: rgb(0, 0, 0) !important; /* Black color for visibility on white background */
  margin: 0 0 10px 0;
}

.nautical-tools-input-label {
  display: block;
  font-size: 12px;
  color: rgb(68, 68, 68);
  margin-top: 8px;
  margin-bottom: 4px;
}

.nautical-tools-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid rgb(204, 204, 204);
  border-radius: 3px;
  margin-bottom: 4px;
  box-sizing: border-box;
}

.nautical-tools-input:focus {
  outline: none;
  border-color: rgb(0, 51, 102);
}

.nautical-tools-weather-results {
  font-size: 12px;
  color: rgb(68, 68, 68);
  margin-top: 8px;
  max-height: none;
  overflow-y: auto;
  border-top: 1px solid rgb(204, 204, 204);
  padding-top: 4px;
  padding-bottom: 12px;
}

.nautical-tools-window-item {
  margin-bottom: 12px;
  padding: 8px;
  background: rgb(248, 248, 248);
  border: 1px solid rgb(221, 221, 221);
  border-radius: 4px;
}

.nautical-tools-window-title {
  font-size: 13px;
  font-weight: bold;
  color: rgb(0, 51, 102);
  margin-bottom: 6px;
}

.nautical-tools-window-row {
  font-size: 12px;
  margin-bottom: 4px;
  color: rgb(68, 68, 68);
}

.nautical-tools-window-summary {
  font-size: 12px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgb(221, 221, 221);
  color: rgb(68, 68, 68);
  font-style: italic;
}

.nautical-tools-no-results {
  padding: 8px;
  color: rgb(136, 136, 136);
  font-style: italic;
  text-align: center;
}

.nautical-tools-error {
  padding: 8px;
  color: rgb(204, 0, 0);
  background: rgb(255, 240, 240);
  border: 1px solid rgb(255, 200, 200);
  border-radius: 4px;
}

/* Label markers (A, B, C, D, etc.) - same style as S/D markers */
.nautical-tools-label-marker-container {
  background: transparent;
  border: none;
  text-align: center;
}

.nautical-tools-label-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgb(255, 200, 0);
  border: 2px solid rgb(255, 255, 255);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  color: rgb(0, 0, 0);
  font-family: 'Inter', 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* NAUTICAL TOOLS: Best Weather Window ----------------------------------- */

.nt-section {
    margin-top: 14px;
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.nt-section h3 {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

/* Override for weather title - must be black on white background */
.nt-section h3.nautical-tools-weather-title {
    color: rgb(0, 0, 0) !important;
}

.nt-section .nautical-tools-input-label {
    display: block;
    font-size: 12px;
    margin-bottom: 2px; /* Reduced to bring value label closer to title */
    margin-top: 0;
    opacity: 0.85;
    height: 18px;
    line-height: 18px;
}

.nt-section input,
.nt-section .nautical-tools-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 5px;
    border: 1px solid #444;
    background: #1a1a1a;
    color: #fff;
}

.nt-section input:focus,
.nt-section .nautical-tools-input:focus {
    outline: none;
    border-color: #55a8ff;
}

/* Button */
#btnWeatherWindow {
    margin-top: 10px;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    background: #165b9e;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

#btnWeatherWindow:hover {
    background: #1c6fbe;
}

/* Earliest Safe mode (default): deep navy blue */
#btnWeatherWindow.nt-btn-earliest {
    background: #165b9e;
}
#btnWeatherWindow.nt-btn-earliest:hover {
    background: #1c6fbe;
}

/* Best Comfort mode: teal/cyan accent */
#btnWeatherWindow.nt-btn-comfort {
    background: #0e7c7b;
}
#btnWeatherWindow.nt-btn-comfort:hover {
    background: #119e9d;
}

/* Smooth color transition between modes */
#btnWeatherWindow {
    transition: background-color 0.3s ease;
}

/* Results container */
#bestWindowResults {
    margin-top: 12px;
    max-height: none;
    overflow-y: auto;
    padding-right: 4px;
    padding-bottom: 12px;
}

/* No results */
.nt-no-results {
    padding: 10px;
    text-align: center;
    font-size: 13px;
    opacity: 0.7;
}

/* Window item */
.nt-window-item,
.nautical-tools-window-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
}

/* Window background colors */
.nautical-tools-window-item.window-1 {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

.nautical-tools-window-item.window-2 {
    background: rgba(255, 235, 59, 0.15);
    border-color: rgba(255, 235, 59, 0.3);
}

.nautical-tools-window-item.window-3 {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.3);
}

.nt-window-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.nt-window-row,
.nautical-tools-window-row {
    font-size: 13px;
    padding: 2px 0;
}

.nt-window-summary,
.nautical-tools-window-summary {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    font-style: italic;
    opacity: 0.85;
}

/* Hide/show section */
.nt-hidden {
    display: none !important;
}

/* Wider Nautical Tools panel */
.nautical-tools-panel,
#nauticalToolsPopup {
    width: 400px;
}

/* Input rows (two columns) */
.nt-input-row {
    display: flex;
    gap: 30px; /* Increased gap for better separation between sliders */
    margin-bottom: 12px;
}

.nt-input-row:last-of-type {
    margin-bottom: 0;
}

.nt-input-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Slider value display label */
.nt-slider-value {
    font-size: 14px;
    font-weight: 500;
    color: rgb(0, 0, 0); /* Black color for visibility on white background */
    margin: 2px 0 10px 0; /* Reduced top margin to bring value closer to title */
    min-height: 20px;
    display: block;
    line-height: 1.4;
}

/* Slider input (range) */
.nt-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.nt-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgb(255, 255, 255);
    cursor: pointer;
    border: 2px solid rgba(30, 58, 95, 0.8);
}

.nt-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgb(255, 255, 255);
    cursor: pointer;
    border: 2px solid rgba(30, 58, 95, 0.8);
}

.nt-slider:focus {
    outline: none;
}

.nt-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.nt-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}


/* Button disabled state */
#btnWeatherWindow:disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* Vertical spacing between inputs */
.nt-section label {
    margin-bottom: 4px;
}

/* Minimize button (yellow background for visibility, especially on mobile) */
.nautical-tools-popup-minimize {
    background: rgb(255, 200, 0);
    border: none;
    font-size: 13px;
    color: rgb(0, 51, 102);
    cursor: pointer;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.2s;
    flex-shrink: 0;
    user-select: none;
    margin-right: 6px;
    -webkit-appearance: none;
    appearance: none;
}

.nautical-tools-popup-minimize:hover {
    background: rgb(255, 215, 60);
}

.nautical-tools-popup-minimize:active {
    background: rgb(230, 180, 0);
}

/* Minimized state — not used with new full-collapse behavior but kept for backward compat */
.nautical-tools-popup--minimized {
    max-height: none;
}

.nautical-tools-popup--minimized .nautical-tools-instructions,
.nautical-tools-popup--minimized .nautical-tools-buttons,
.nautical-tools-popup--minimized .nautical-tools-segments-container,
.nautical-tools-popup--minimized .nautical-tools-total-distance,
.nautical-tools-popup--minimized #bestWeatherSection {
    display: none !important;
}

/* Mobile-only styles for Nautical Tools panel */
@media (max-width: 768px) {
    .nautical-tools-popup {
        width: 85vw;
        left: 50%;
        transform: translateX(-50%);
        top: calc(16px + env(safe-area-inset-top, 0px));
        max-width: 85vw;
    }
}

/* Mobile Help Modal for Route Planner */
.nt-help-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nt-help-modal-content {
    background: #ffffff;
    width: 90vw;
    max-width: 400px;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    font-family: 'Inter', 'Noto Sans', system-ui, -apple-system, sans-serif;
}

.nt-help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.nt-help-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #1a1a1a;
}

.nt-help-modal-title-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nt-help-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #444;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    border-radius: 4px;
}

.nt-help-modal-video-container {
    width: 100%;
    margin-bottom: 0px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.nt-help-modal-video {
    width: 100%;
    max-height: 70vh;
    object-fit: contain; /* Natively display the portrait video */
    display: block;
}

.nt-help-modal-checkbox-label {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: #555;
    cursor: pointer;
}

.nt-help-modal-checkbox-label input {
    margin-right: 6px;
    width: 14px;
    height: 14px;
}

/* Sort Mode radio buttons row */
.nt-sort-mode-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 4px;
    padding: 6px 8px;
    background: rgba(0, 51, 102, 0.06);
    border-radius: 5px;
    border: 1px solid rgba(0, 51, 102, 0.12);
}

.nt-sort-mode-label {
    font-size: 12px;
    font-weight: 600;
    color: rgb(0, 51, 102);
    margin-right: 4px;
    white-space: nowrap;
}

.nt-sort-mode-row input[type="radio"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: rgb(0, 51, 102);
    cursor: pointer;
    flex-shrink: 0;
}

.nt-sort-mode-option {
    font-size: 12px;
    font-weight: 500;
    color: rgb(51, 51, 51);
    cursor: pointer;
    margin-right: 8px;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

/* Comfort badge */
.nt-comfort-badge {
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
    white-space: nowrap;
}

/* Time from now label */
.nt-time-from-now {
    font-size: 11px;
    font-weight: 600;
    color: rgb(0, 100, 180);
    margin-left: 4px;
    white-space: nowrap;
}

/* Help icon for sort mode selection */
.nt-sort-mode-help {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto; /* Push to the right */
    color: rgb(0, 100, 180);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.2s;
    padding: 2px;
}

.nt-sort-mode-help:hover {
    opacity: 1;
    transform: scale(1.1);
    color: rgb(0, 80, 150);
}
