/* 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: #2F547F;
    background: linear-gradient(359deg,rgba(47, 84, 127, 1) 0%, rgba(13, 17, 23, 1) 52%);
    /*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 */
.div1 { grid-area: 2 / 1 / 5 / 4; } /* Visual Feed (Mengecil: 3 baris) */
.div2 { grid-area: 5 / 1 / 9 / 4; } /* Trajectory Map (Membesar: 4 baris) */
.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 (Hidden for now) */


/* Specific Component Styling */
/* Header */
.div11 { flex-direction: row; align-items: center; justify-content: space-between; }
.div11 .logo h1 { font-size: 1.5em; color:var(--accent-color)}
.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: 3px;
    padding: 4px 8px;
    margin: 0;
}

/* --- PERUBAHAN: 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: #b4c00d;
}
button#download-log-btn:active {
    background-color: var(--warning-color);
}
/* --- AKHIR PERUBAHAN --- */

/* --- DIHAPUS: Gaya .system-time --- */


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

/* --- GAYA TRAJECTORY SVG --- */
#trajectory-svg {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    background-color: #020a14;
}
.traj-group {
    display: none; 
}
.traj-grid-line {
    stroke: var(--border-color);
    stroke-width: 0.5;
    opacity: 0.5;
}
.traj-path {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 2;
    stroke-dasharray: 4 4;
}
.traj-path-label {
    font-size: 10px;
    font-weight: bold;
}
.traj-path.active-path {
    stroke: var(--accent-color); 
    opacity: 1;
}
.traj-boat {
    fill: var(--accent-color);
    stroke: #fff;
    stroke-width: 1;
    transition: transform 1.5s ease-in-out; 
}
.traj-start-box {
    fill: var(--success-color);
    opacity: 0.8;
}
.traj-start-text {
    font-size: 8px;
    fill: #fff;
    text-anchor: middle;
}

/* Mission Imaging */
.widget-header-only { padding: 5px; 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: var(--bg-color); 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 (Sama seperti sebelumnya) */
.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; }