/* ==========================================================================
   STYLE.CSS V8.0 (SYMMETRY FIX & AESTHETIC CLEANUP)
   ========================================================================== */

:root {
    --primary: #fec107;
    --bg-dark: #000;
    --bg-panel: #1c1c1e;
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
    --header-h: 70px;
    --footer-h: 130px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; user-select: none; outline: none; }
body { background: var(--bg-dark); color: white; font-family: 'Inter', sans-serif; height: 100dvh; width: 100%; overflow: hidden; position: fixed; }

/* LAYOUT STRUCTURE */
.app-screen { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; background: #000; }

/* TOP BAR */
.top-bar {
    flex: 0 0 auto; height: var(--header-h); padding: 10px 20px; padding-top: max(10px, var(--safe-top));
    display: flex; justify-content: space-between; align-items: center; background: #000; z-index: 20;
}
.icon-btn {
    width: 42px; height: 42px; border-radius: 50%; background: #222; border: 1px solid #333;
    color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-right: 8px;
}
.icon-btn:active { transform: scale(0.95); background: #333; }
.icon-btn.active { color: var(--primary); border-color: var(--primary); background: rgba(254, 193, 7, 0.15); }
.top-left, .top-right { display: flex; align-items: center; }
.zoom-indicator { background: #222; padding: 5px 12px; border-radius: 15px; font-size: 12px; font-weight: 700; color: var(--primary); border: 1px solid #333; }

/* VIEWPORT AREA */
.viewport-area {
    flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
    background: #111; overflow: hidden;
}
.video-container {
    position: relative; width: 100%; height: 100%; overflow: hidden; background: #000;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* OVERLAYS */
#flash-effect { position:absolute; top:0; left:0; width:100%; height:100%; background:#fff; opacity:0; pointer-events:none; z-index:10; transition:0.1s; }
.grid-overlay { position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:3; opacity:0; transition:0.3s; }
.grid-overlay.show { opacity:1; }
.grid-line-h { position:absolute; width:100%; height:1px; background:rgba(255,255,255,0.5); box-shadow:0 1px 2px rgba(0,0,0,0.5); }
.grid-line-v { position:absolute; height:100%; width:1px; background:rgba(255,255,255,0.5); box-shadow:1px 0 2px rgba(0,0,0,0.5); }
#overlay-frame { position:absolute; top:0; left:0; width:100%; height:100%; z-index:2; pointer-events:none; object-fit: cover; }

/* LIVE TEXT */
.live-info-wrapper { position: absolute; bottom: 8%; left: 0; width: 100%; padding: 0 20px; z-index: 5; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 5px; }
.live-info { width: 100%; display: flex; flex-direction: column; text-shadow: 0 2px 4px rgba(0,0,0,0.9); }
[contenteditable="true"] { cursor: text; border-bottom: 1px dashed transparent; transition: all 0.2s; user-select: text; pointer-events: auto; }
[contenteditable="true"]:focus { border-bottom: 1px dashed var(--primary); background: rgba(0,0,0,0.3); padding: 2px 5px; border-radius: 4px; }
[contenteditable="true"]:empty:before { content: attr(data-placeholder); color: rgba(255,255,255,0.6); font-style: italic; }
.text-title { font-size: 18px; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 4px; line-height: 1.3; }
.text-desc { font-size: 13px; color: #fff; line-height: 1.4; margin-bottom: 2px; }
.meta-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 12px; background: rgba(0,0,0,0.45); backdrop-filter: blur(8px); border-radius: 20px; align-self: flex-start; pointer-events: none; }
.text-meta { font-size: 11px; color: #ddd; display: flex; align-items: center; gap: 4px; font-weight: 500; }

/* CONTROLS OVERLAY (ZOOM & RESOLUTION PILL) */
.controls-overlay {
    position: absolute; bottom: calc(var(--footer-h) + 15px); left: 0; width: 100%; 
    z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none;
}

/* NEW ESTETIK RESOLUTION PILL */
.resolution-pill {
    background: rgba(30, 30, 30, 0.7); backdrop-filter: blur(5px);
    color: var(--primary); font-size: 11px; font-weight: 700;
    padding: 6px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.15);
    letter-spacing: 1px; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    pointer-events: auto; /* Bisa diklik jika mau dikembangin jadi tombol */
}

.zoom-slider-container { 
    pointer-events: auto; display: flex; align-items: center; gap: 12px; 
    background: rgba(0,0,0,0.6); padding: 8px 18px; border-radius: 30px; backdrop-filter: blur(10px);
}
input[type=range] { -webkit-appearance: none; width: 140px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 5px rgba(254,193,7,0.5); }

/* === BOTTOM BAR SYMMETRY FIX === */
.bottom-bar {
    flex: 0 0 auto; height: var(--footer-h); padding-bottom: var(--safe-bottom);
    background: #000; z-index: 20;
    display: grid;
    /* Grid 3 Kolom: Kiri (sisa) | Tengah (Fix 100px) | Kanan (sisa) */
    grid-template-columns: 1fr 100px 1fr;
    align-items: center;
    justify-items: center; /* Memastikan item di tengah cell */
}

/* Items di dalam grid */
.bottom-grid-item {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
}

.gallery-preview { 
    width: 50px; height: 50px; border-radius: 12px; background: #222; 
    border: 2px solid rgba(255,255,255,0.2); overflow: hidden; cursor: pointer; transition: 0.2s;
}
.gallery-preview:active { transform: scale(0.9); border-color: var(--primary); }
.gallery-preview img { width: 100%; height: 100%; object-fit: cover; }

.shutter-outer { 
    width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; 
    padding: 3px; display: flex; justify-content: center; align-items: center; 
    cursor: pointer; transition: 0.15s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.shutter-inner { width: 100%; height: 100%; background: #fff; border-radius: 50%; transition: 0.2s; }
.shutter-outer:active { transform: scale(0.95); }
.shutter-outer:active .shutter-inner { background: var(--primary); transform: scale(0.9); }

/* EDITOR OVERLAY */
#editor-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 300; display: none; flex-direction: column; }
.editor-header { height: 60px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; background: var(--bg-panel); border-bottom: 1px solid #333; }
.editor-canvas-wrapper { flex: 1; background: #000; display: flex; justify-content: center; align-items: center; position: relative; overflow: hidden; }
#editorCanvas { background: #111; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.editor-controls { height: 90px; background: var(--bg-panel); display: flex; align-items: center; justify-content: center; gap: 15px; padding-bottom: var(--safe-bottom); }
.editor-text-overlay { position: absolute; bottom: 10%; left: 0; width: 100%; padding: 0 5%; pointer-events: none; display: flex; flex-direction: column-reverse; }

/* MODAL & SETTINGS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 100; display: none; align-items: flex-end; backdrop-filter: blur(5px); }
.modal-overlay.show { display: flex; }
.modal-drawer { width: 100%; max-height: 85vh; background: #161618; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.modal-overlay.show .modal-drawer { transform: translateY(0); }
.modal-handle-bar { width: 40px; height: 5px; background: rgba(255,255,255,0.15); margin: 12px auto 8px; border-radius: 3px; }
.modal-header { display: flex; justify-content: space-between; padding: 10px 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); align-items: center; }
.modal-title { font-size: 17px; font-weight: 600; color: white; }
.close-btn-text { color: var(--primary); background: none; border: none; font-size: 16px; font-weight: 600; }
.modal-content-scroll { overflow-y: auto; padding: 20px 24px 60px; }

/* FORM ELEMENTS */
.form-section { margin-bottom: 25px; }
.section-header { font-size: 12px; color: #8e8e93; margin-bottom: 10px; font-weight: 600; text-transform: uppercase; padding-left: 5px; }
.input-group { position: relative; margin-bottom: 12px; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #8e8e93; font-size: 20px; }
.input-group textarea + .input-icon { top: 20px; transform: none; }
.clear-input-btn { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #666; font-size: 18px; cursor: pointer; transition: 0.2s; }
.clear-input-btn:active { color: #fff; }
.input-group textarea + .clear-input-btn { top: 20px; transform: none; }
input[type=text], textarea { width: 100%; background: #252527; border: 1.5px solid transparent; border-radius: 12px; padding: 12px 40px 12px 44px; color: white; font-size: 15px; }
input[type=text]:focus, textarea:focus { background: #2c2c2e; border-color: var(--primary); }

.setting-group-box { background: #252527; border-radius: 12px; overflow: hidden; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.setting-row:last-child { border-bottom: none; }
.setting-label { display: flex; align-items: center; gap: 12px; font-size: 15px; color: #eee; }
.setting-label .material-icons-round { color: var(--primary); font-size: 20px; opacity: 0.9; }
.switch { position: relative; width: 48px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; top:0; left:0; right:0; bottom:0; background: #3a3a3c; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 24px; width: 24px; left: 2px; bottom: 2px; background: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background: #34C759; }
input:checked + .slider:before { transform: translateX(20px); }

.resolution-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.res-card { background: #252527; border-radius: 12px; padding: 14px 4px; display: flex; flex-direction: column; align-items: center; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.res-card:active { transform: scale(0.95); }
.res-card.active { border-color: var(--primary); background: rgba(254, 193, 7, 0.1); }
.res-shape { border: 2px solid #666; margin-bottom: 6px; border-radius: 3px; background: rgba(255,255,255,0.05); }
.res-card.active .res-shape { border-color: var(--primary); background: var(--primary); }
.res-card span { font-size: 11px; font-weight: 500; color: #aaa; }
.res-card.active span { color: var(--primary); font-weight: 700; }

.btn-block-upload { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: rgba(254, 193, 7, 0.1); color: var(--primary); padding: 16px; border-radius: 12px; border: 1px dashed rgba(254, 193, 7, 0.5); font-weight: 600; font-size: 14px; margin-bottom: 16px; cursor: pointer; }
.frame-scroller { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.frame-thumb { min-width: 70px; height: 95px; background: #000; border-radius: 10px; border: 2px solid #333; overflow: hidden; position: relative; cursor: pointer; }
.frame-thumb img { width: 100%; height: 100%; object-fit: cover; }
.frame-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(254,193,7,0.3); }
.frame-delete-btn { position: absolute; top: 3px; right: 3px; background: #ff3b30; width: 22px; height: 22px; border-radius: 50%; font-size: 14px; display:flex; align-items:center; justify-content:center; color: white; z-index: 5; }

.gps-status-box { background: rgba(52, 199, 89, 0.08); border: 1px solid rgba(52, 199, 89, 0.2); border-radius: 12px; padding: 14px; display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.gps-value { font-size: 14px; font-weight: 600; color: #34C759; }
#loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 999; display: none; flex-direction: column; align-items: center; justify-content: center; }
.spinner-ring { width: 50px; height: 50px; border: 4px solid #333; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 20px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.loading-text { font-weight: 600; letter-spacing: 1px; }
.show-element { display: block !important; }
.hide-element { display: none !important; }