/* ===================================
   SHIP TRACKING STYLES
   Matching website design aesthetic
   System fonts only (no external)
   =================================== */

/* Hide Leaflet attribution flag */
.leaflet-attribution-flag {
    display: none !important;
}

.ship-tracking-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.ship-header {
    margin-bottom: 2rem;
    text-align: center;
}

.ship-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-family: var(--font-sans);
    letter-spacing: -0.02em;
}

.ship-subtitle {
    font-size: 0.9rem;
    color: var(--accent-gold);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
}

/* Ship Search */
.ship-search {
    margin: 1.5rem auto;
    max-width: 500px;
}

#ship-search-input {
    width: 100%;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    background: transparent;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

#ship-search-input:focus {
    outline: none;
    border-bottom-color: var(--accent-gold);
    background: transparent;
    box-shadow: none;
}

#ship-search-input::placeholder {
    color: var(--text-dimmed);
    font-style: italic;
}

.ship-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 2rem;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    transition: background 0.3s ease;
}

.stat-item:last-child {
    border-right: none;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.stat-label {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Specific styling for connectivity status */
#connection-status {
    font-size: 1rem;
    font-family: var(--font-sans);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .ship-stats {
        grid-template-columns: 1fr 1fr;
        gap: 1px;
        /* Gap for borders if checking bg */
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
    }

    .stat-item {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        /* Re-add borders for cards */
        border-radius: 8px;
        margin-bottom: 0.5rem;
    }

    .stat-item:nth-child(even) {
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        /* Reset border-right */
    }
}

/* Map Container */
.ship-map {
    width: 100%;
    height: 600px;
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ship Markers */
.ship-marker {
    background: transparent;
}

.ship-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-gold);
    font-size: 20px;
    text-align: center;
    line-height: 20px;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.8));
    transition: all 0.3s ease;
}

.ship-marker:hover .ship-icon {
    transform: scale(1.3) !important;
    filter: drop-shadow(0 0 8px rgba(212, 165, 116, 1));
}

/* Ship Info Panel */
.ship-info {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    min-height: 150px;
}

.info-text {
    color: var(--text-dimmed);
    text-align: center;
    font-style: italic;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.ship-detail h3 {
    color: var(--accent-gold);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: -0.02em;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    color: var(--text-main);
    font-size: 0.95rem;
}

.detail-grid .label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-main);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 0;
    min-width: 320px;
}

.leaflet-popup-tip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.ship-popup {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 1rem;
}

.ship-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.ship-popup-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    align-items: baseline;
}

.ship-popup strong {
    color: var(--accent-gold);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.ship-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 1rem 0;
}

.ship-data-label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ship-data-value {
    color: var(--text-main);
    font-weight: 500;
}

.ship-destination {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--accent-gold);
}

.ship-destination::before {
    content: '📍';
    font-size: 1rem;
}

.ship-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

.ship-type-cargo {
    background: #3b82f6;
    color: white;
}

.ship-type-tanker {
    background: #ef4444;
    color: white;
}

.ship-type-passenger {
    background: #10b981;
    color: white;
}

.ship-type-fishing {
    background: #f59e0b;
    color: white;
}

.ship-type-high-speed {
    background: #8b5cf6;
    color: white;
}

.ship-type-pilot {
    background: #14b8a6;
    color: white;
}

.ship-type-tug {
    background: #ec4899;
    color: white;
}

.ship-type-unknown {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ship-callsign {
    font-family: var(--font-mono);
    color: var(--accent-gold);
    font-weight: 600;
    letter-spacing: 0.1em;
}

.ship-dimensions {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-top: 0.75rem;
    border: 1px solid var(--border-color);
}

.ship-dimension-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.ship-dimension-icon {
    font-size: 1.2rem;
}

/* Leaflet Control Styling */
.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--accent-gold) !important;
    color: var(--accent-gold) !important;
}

/* Tab-specific override */
#tab-ships:checked~.tab-content #panel-ships {
    display: block;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ship-tracking-container {
        padding: 1.5rem;
    }

    .ship-title {
        font-size: 1.5rem;
    }

    .ship-stats {
        gap: 1.5rem;
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .ship-map {
        height: 400px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .leaflet-popup-content-wrapper {
        min-width: 280px;
    }

    .ship-popup-body {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .ship-data-label {
        margin-bottom: 0.25rem;
    }
}

/* Animations matching website */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.stat-value {
    animation: pulse 2s ease-in-out infinite;
}

/* Ship marker animations */
@keyframes ship-ping {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.ship-marker-active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    background: rgba(212, 165, 116, 0.4);
    animation: ship-ping 1.5s ease-out infinite;
}

/* Custom Marker Cluster Styling */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: linear-gradient(135deg, var(--accent-gold) 0%, rgba(212, 165, 116, 0.8) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 50%;
}

.marker-cluster:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Cluster size variations */
.marker-cluster-small {
    width: 30px;
    height: 30px;
}

.marker-cluster-small div {
    width: 24px;
    height: 24px;
    line-height: 24px;
    margin: 3px;
}

.marker-cluster-medium {
    width: 40px;
    height: 40px;
}

.marker-cluster-medium div {
    width: 34px;
    height: 34px;
    line-height: 34px;
    margin: 3px;
}

.marker-cluster-large {
    width: 50px;
    height: 50px;
}

.marker-cluster-large div {
    width: 44px;
    height: 44px;
    line-height: 44px;
    margin: 3px;
}