/* CSS Variables */
:root {
    --bg-color: #0d1117;
    --panel-bg-color: rgba(22, 27, 34, 0.8);
    --border-color: rgba(48, 54, 61, 0.8);
    --accent-color: #58a6ff;
    --text-color: #c9d1d9;
    --font-family: 'Orbitron', sans-serif;
    --success-color: #238636;
    --warning-color: #f0ad4e;
    --danger-color: #d9534f;
}

/* Basic Setup */
* { margin: 0; padding: 0; box-sizing: border-box; }
body, html {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
}

/* Your Custom Grid Layout */
.parent {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 10px;
    padding: 10px;
    height: 100vh;
}

/* General Widget Styling */
.widget {
    background-color: var(--panel-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    backdrop-filter: blur(5px);
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.widget-header {
    width: 100%;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-color);
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 1px;
    flex-shrink: 0;
}
.widget-header h3, .widget-header h4 { display: flex; align-items: center; gap: 8px; }

/* --- GRID AREA ASSIGNMENTS (TATA LETAK) --- */
/* Ini memastikan Peta Trajectory UKURANNYA BESAR (Seperti Animasi) */

/* Visual Feed: Mengecil (Hanya 3 baris grid) */
.div1 { grid-area: 2 / 1 / 5 / 4; } 

/* Trajectory Map: Membesar (4 baris grid) */
.div2 { grid-area: 5 / 1 / 9 / 4; } 

/* Sisa grid tetap sama */
.div3 { grid-area: 2 / 4 / 3 / 8; } /* Mission Imaging Header */
.div5 { grid-area: 3 / 4 / 5 / 6; } /* Surface Image */
.div6 { grid-area: 5 / 4 / 7 / 6; } /* Surface Info */
.div7 { grid-area: 3 / 6 / 5 / 8; } /* Underwater Image */
.div8 { grid-area: 7 / 4 / 9 / 6; } /* SOG/COG */
.div9 { grid-area: 7 / 6 / 9 / 8; } /* Position Log */
.div10 { grid-area: 5 / 6 / 7 / 8; } /* Underwater Info */
.div11 { grid-area: 1 / 1 / 2 / 8; } /* Header */
.div13 { grid-area: 8 / 6 / 9 / 8; display: none; } /* Battery */


/* Specific Component Styling */
/* Header */
.div11 { flex-direction: row; align-items: center; justify-content: space-between; }
.div11 .logo h1 { font-size: 1.5em; }
.div11 .team-info { display: flex; gap: 20px; align-items: center; }

.div11 .track-selection {
    display: flex;
    align-items: center;
    gap: 8px;
}
.div11 .track-selection p#track-value {
    background-color: var(--bg-color);
    color: var(--accent-color);
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    margin: 0;
}

/* Gaya Tombol Download */
.download-button-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
button#download-log-btn {
    background-color: var(--success-color);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: var(--font-family);
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}
button#download-log-btn:hover {
    background-color: #2a9a42;
}
button#download-log-btn:active {
    background-color: #238636;
}

/* Video & Map */
#video-stream { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    border-radius: 4px; 
    background-color: #000; 
}

/* GAYA PETA LEAFLET (Memastikan Peta Penuh) */
#map { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    border-radius: 4px; 
    background-color: #222; /* Latar belakang saat loading */
}

/* Leaflet Dark Theme */
.leaflet-container { background: var(--bg-color) !important; }
.leaflet-tile-pane { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }

/* Mission Imaging */
.widget-header-only { padding: 10px; border-bottom: 1px solid var(--border-color); }
.imaging-widget { padding: 5px; position: relative; }
.imaging-widget img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain;
    border-radius: 4px; 
}
.imaging-label { position: absolute; top: 10px; left: 10px; background-color: rgba(0,0,0,0.7); padding: 3px 8px; border-radius: 4px; font-size: 0.8em; }

/* Info Box & Geo Tag Styling */
.info-box-widget {
    padding: 5px;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-in-out;
}
#geotag-infobox, #underwater-geotag-infobox {
    opacity: 0;
}
.geotag-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    width: 100%;
    padding: 5px;
    font-size: 0.8em;
}
.geotag-label {
    font-weight: bold;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 5px;
}
.geotag-value {
    text-align: right;
    white-space: normal;
    word-break: break-all;
}

/* Status Widgets */
.status-widget { align-items: center; justify-content: center; gap: 8px; }

/* SOG/COG GABUNGAN */
.sog-cog-widget {
    display: flex;
    justify-content: space-around;
    width: 100%;
    text-align: center;
    padding-top: 10px;
}
.status-item .status-label {
    font-size: 0.8em;
    color: var(--accent-color);
    text-transform: uppercase;
}
.status-item p {
    font-size: 1.5em;
    font-weight: 500;
}

/* POSITION LOG (DENGAN SCROLL) */
.position-log-list {
    list-style: none;
    width: 100%;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Mengisi dari atas */
    gap: 4px; /* Jarak antar item */
    padding: 0 10px;
    font-size: 0.8em; /* Mengecilkan font agar muat */
    overflow-y: auto; /* Mengaktifkan scroll vertikal */
}
.position-log-list::-webkit-scrollbar {
    width: 6px;
}
.position-log-list::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 3px;
}
.position-log-list::-webkit-scrollbar-track {
    background-color: var(--border-color);
    border-radius: 3px;
}
.position-log-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.3s ease;
    flex-shrink: 0; 
}
.position-log-list .log-icon {
    width: 20px;
    text-align: center;
}
.position-log-list .log-pending {
    color: var(--text-color);
}
.position-log-list .log-done {
    color: var(--success-color);
    text-decoration: line-through;
    opacity: 0.8;
}

/* Battery */
.battery-icon { width: 60px; height: 30px; border: 2px solid var(--border-color); border-radius: 6px; position: relative; padding: 2px; }
.battery-icon::after { content: ''; position: absolute; right: -8px; top: 50%; transform: translateY(-50%); width: 4px; height: 12px; background-color: var(--border-color); border-radius: 0 2px 2px 0; }
.battery-level { height: 100%; width: 100%; border-radius: 3px; background-color: #238636; transition: width 0.5s ease-out; }