* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;

    font-family: Arial, sans-serif;

    background: #111827;
    color: #e5e7eb;
}


header {
    margin-bottom: 20px;
}

header h1 {
    margin: 0;

    font-size: 24px;
    font-weight: 600;
}


/* =========================================
   MAIN LAYOUT
   ========================================= */

main {
    width: 100%;
}


/* =========================================
   PANELS
   ========================================= */

.panel {
    background: #1f2937;

    border: 1px solid #374151;
    border-radius: 10px;

    padding: 16px;

    min-width: 0;
}


.panel-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-bottom: 14px;
}


.panel-header h2 {
    margin: 0;

    font-size: 18px;
    font-weight: 600;
}


.count {
    color: #9ca3af;
    font-size: 13px;
}


/* =========================================
   MOVING PANEL
   ========================================= */

#moving-panel {
    grid-column: 1;
}


/* =========================================
   MOORED PANEL
   ========================================= */

#moored-panel {
    grid-column: 2;
}


/* =========================================
   BUOYS
   ========================================= */

#buoy-panel {
    grid-column: 1 / -1;
}


/* =========================================
   VESSEL GRID
   ========================================= */

.vessel-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 12px;
}
/* Medium screens / smaller desktop windows */
@media (max-width: 1100px) {

    .vessel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}
/* Phones */

@media (max-width: 600px) {

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

}


/* =========================================
   PORT GROUP
   ========================================= */

.port-group {
    margin-bottom: 10px;
    border: 1px solid #374151;

    border-radius: 8px;

    overflow: hidden;

    background: #172033;
}


.port-title {
    margin: 0 0 10px 0;

    padding-bottom: 6px;

    border-bottom: 1px solid #374151;

    color: #93c5fd;

    font-size: 16px;
}



.port-header {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 10px 12px;

    cursor: pointer;

    user-select: none;

    background: #1f2937;

    transition:
        background 0.15s;
}


.port-header:hover {

    background: #263449;
}


/* =========================================
   ARROW
   ========================================= */

.port-arrow {

    width: 14px;

    color: #60a5fa;

    font-size: 12px;

    text-align: center;
}


/* =========================================
   PORT NAME
   ========================================= */

.port-title {

    flex: 1;

    color: #93c5fd;

    font-size: 15px;

    font-weight: 600;
}


/* =========================================
   NUMBER OF VESSELS
   ========================================= */

.port-count {

    padding: 2px 7px;

    border-radius: 10px;

    background: #374151;

    color: #9ca3af;

    font-size: 11px;
}


/* =========================================
   PORT CONTENT
   ========================================= */

.port-content {

    display: none;

    padding: 12px;
}


.port-content.open {

    display: block;
}

/* =========================================
   VESSEL TYPE GROUP
   ========================================= */

.type-group {
    margin-bottom: 16px;
}


.type-title {
    margin: 0 0 8px 0;

    color: #9ca3af;

    font-size: 13px;
    font-weight: 600;

    text-transform: uppercase;
}


/* =========================================
   CARD
   ========================================= */

.vessel-card {
    display: flex;
    flex-direction: row;
    displayOLD: grid;
    grid-template-columns: 1fr 220px;
    gap: 15px;

    text-decoration: none;
    color: inherit;

    align-items: stretch;

    gap: 14px;

    width: 100%;
    min-width: 0;

    padding: 12px;

    box-sizing: border-box;

    background: #252a2e;

    border: 1px solid #3b4247;
    border-radius: 8px;

    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}


.vessel-card-text {
    flex: 1 1 50% ;
    min-width: 0;
}




.vessel-photo {
    flex: 0 0 50%;

    width: 150px;
    min-width: 0;
}


.vessel-photo img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    border-radius: 6px;

    transition: opacity 0.15s ease,
                transform 0.15s ease;
}


.vessel-photo img:hover {
    opacity: 0.85;
    cursor: pointer;
}


.vessel-photo img:active {
    opacity: 0.7;
    transform: scale(0.99);
}


.vessel-photo a {
    display: block;
    width: 100%;
    height: 100%;
}



.vessel-card:hover {
    background: #172033;

    border-color: #60a5fa;
}



.vessel-name {
    display: block;

    font-size: 1.15rem;
    font-weight: 600;

    margin-bottom: 3px;

    color: #72b7e6;
    text-decoration: none;
}


.vessel-name:hover {
    color: #9bd0f0;
    text-decoration: underline;
}


.vessel-type {
    font-size: 0.9rem;

    color: #aeb7bd;

    margin-bottom: 8px;
}


.vessel-info {
    display: grid;

    grid-template-columns: 70px 1fr;

    column-gap: 8px;
    row-gap: 3px;

    font-size: 0.88rem;
}


.vessel-info > div:nth-child(odd) {
    color: #89939a;
}


.vessel-info .value {
    color: #d8dde0;
}

/* =========================================
   CARD CONTENT
   ========================================= */

.vessel-name {
    display: block;

    margin-bottom: 5px;

    color: #60a5fa;

    font-size: 15px;
    font-weight: 600;

    text-decoration: none;
}


.vessel-name:hover {
    text-decoration: underline;
}


.vessel-type {
    margin-bottom: 8px;

    color: #d1d5db;

    font-size: 12px;
}


.vessel-type.buoy {
    color: #fbbf24;
}


.vessel-info {
    display: grid;

    grid-template-columns: auto 1fr;

    gap: 3px 8px;

    font-size: 12px;

    color: #9ca3af;
}


.vessel-info .value {
    color: #d1d5db;
}


.vessel-position {
    margin-top: 8px;

    font-size: 11px;
}


.vessel-position a {
    color: #60a5fa;

    text-decoration: none;
}


.vessel-position a:hover {
    text-decoration: underline;
}


* =========================================
   MAP
   ========================================= */

#map-panel {
    width: 100%;
    margin-bottom: 20px;
}


#map-container {
    position: relative;

    width: 100%;

    overflow: hidden;

    border-radius: 8px;

    background: #000;
}


#map-image {
    display: block;

    width: 100%;
    height: auto;
}


/*
   This layer sits exactly on top of
   the map image.
*/

#vessel-layer {
    position: absolute;

    inset: 0;

    pointer-events: none;
}


/*
   Individual vessel labels
*/

.vessel-label {
    position: absolute;

    transform: translate(-50%, -50%);

    padding: 3px 7px;

    background: rgba(17, 24, 39, 0.90);

    border: 1px solid #60a5fa;

    border-radius: 4px;

    color: #ffffff;

    font-size: 11px;

    white-space: nowrap;

    cursor: move;

    pointer-events: auto;

    user-select: none;

    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.4);
}


.vessel-label:hover {
    background: #1d4ed8;

    border-color: #93c5fd;

    z-index: 100;
}


/* =========================================
   VESSEL PANELS
   ========================================= */

.vessel-panels {

    display: grid;

    grid-template-columns: 1fr 2fr;

    gap: 20px;

    align-items: start;

    margin-bottom: 20px;
}


/* =========================================
   RESPONSIVE
   ========================================= */

/* ============================================================
   MOBILE VESSEL CARDS
   ============================================================ */

@media (max-width: 600px) {
        .vessel-card {
        flex-direction: column;
        width: 100%;
        max-width: none;

        padding: 10px;

        background: #252a2e;
    }

    
    .vessel-card-text {
        width: 100%;
    }


    .vessel-name {
        font-size: 1.15rem;
        margin-bottom: 3px;
    }


    .vessel-type {
        margin-bottom: 7px;
    }


    .vessel-info {
        grid-template-columns: 65px 1fr;

        font-size: 0.88rem;

        row-gap: 3px;
    }


    .vessel-photo {
        width: 100%;
        height: auto;

        Fflex: none;
    }


    .vessel-photo a {
        display: block;

        width: 100%;
        height: auto;
    }


    .vessel-photo img {
        display: block;

        width: 100%;
        height: auto;

        min-height: 0;

        aspect-ratio: 16 / 10;

        object-fit: cover;

        border-radius: 6px;
    }


}


/* Very narrow phones */
@media (max-width: 380px) {
    .vessel-card {
        padding: 8px;
    }

    .vessel-info {
        font-size: 0.84rem;
    }
}

/* =========================================
   YESTERDAY'S MAP
   ========================================= */

#yesterday-panel {
    width: 100%;
    margin-bottom: 20px;
}


#yesterday-map-container {
    width: 100%;

    overflow: hidden;

    border-radius: 8px;

    background: #000;
}


#yesterday-map {
    display: block;

    width: 100%;
    height: auto;
}




/* =========================================
   LOADING Indicator
   ========================================= */
.vessel-photo {
    position: relative;
    overflow: hidden;
    background: #202020;
}

.photo-loading {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #999;
    font-size: 0.85rem;
}

.vessel-thumbnail {
    position: relative;
    z-index: 1;

    width: 100%;
    height: 220px;

    object-fit: cover;

    opacity: 0;
    transition: opacity 0.25s ease;
}

.photo-loaded .vessel-thumbnail {
    opacity: 1;
}

.photo-loaded .photo-loading {
    display: none;
}

/* --------------------------------------------------
   PHOTO CREDIT
-------------------------------------------------- */

.vessel-photo {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.vessel-photo .photo-credit {
    margin-top: 5px;
    padding: 0 2px 4px 2px;

    color: #8f9aa2;
    font-size: 11px;
    line-height: 1.3;

    flex-shrink: 0;
}

.vessel-photo .photo-credit a {
    color: #8eb9d8;
    text-decoration: none;
}

.vessel-photo .photo-credit a:hover {
    color: #b9d8eb;
    text-decoration: underline;
}




/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 900px) {

    main {
        grid-template-columns: 1fr;
    }

    #moving-panel,
    #moored-panel,
    #buoy-panel {
        grid-column: 1;
    }
}
