/* cetak.css - Versi 8.0 (Arsitektur Terpadu) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --font-sans: "Inter", -apple-system, sans-serif;
    --primary-color: #0d6efd;
    --text-color: #212529;
    --border-color: #dee2e6;
    --paper-bg: #ffffff;
    --app-bg: #f5f7fa;
    --window-bg: rgba(255, 255, 255, 0.95);
}

body {
    font-family: var(--font-sans);
    margin: 0;
    background-color: var(--app-bg);
    color: var(--text-color);
    font-size: 14px;
    height: 100vh;
    width: 100vw;
}

.main-container {
    display: flex;
    height: 100%;
}

#app {
    overflow: scroll;
}

/* --- Panel Kontrol Kiri --- */
.left-control-panel {
    width: 240px;
    flex-shrink: 0;
    background: #FFF;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    /* z-index tinggi */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.left-control-panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.mode-switcher {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.left-control-panel button {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--primary-color);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-align: center;
}

.left-control-panel button.secondary {
    background-color: #6C757D;
}

.left-control-panel button:hover {
    opacity: 0.8;
}

.left-control-panel button i {
    margin-right: 8px;
}

/* --- KANVAS AREA KERJA --- */
.workspace {
    flex-grow: 1;
    overflow: auto;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#printable-container {
    width: 210mm;
    height: 297mm;
    background: var(--paper-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    overflow: scroll;
}

.is-editor-mode .editable-element {
    cursor: move;
    border: 1px dashed transparent;
    transition: border-color 0.2s;
}

.is-editor-mode .editable-element:hover {
    border-color: var(--primary-color);
}

.is-editor-mode .editable-element.selected {
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 0 12px rgba(13, 110, 253, 0.5);
    z-index: 1000;
}

.is-editor-mode .placeholder-area {
    background-color: var(--placeholder-bg);
    border: 2px dashed #ADB5BD !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    min-height: 100px;
}

/* BARU: Gaya untuk elemen bersarang di mode edit */
.is-editor-mode .nested-container {
    padding: 15px;
    border-left: 2px dashed #A2D2FF !important;
    background-color: rgba(13, 110, 253, 0.03);
}

.real-items-table {
    width: 100%;
    border-collapse: collapse;
}

.real-items-table th,
.real-items-table td {
    border: 1px solid var(--border-color);
    text-align: left;
    padding-top: 1px;
    padding-left: 14px;
    padding-bottom: 0;
    padding-right: 6px;
}

.real-items-table th {
    background-color: #F8F9FA;
    font-weight: 600;
}

/* --- JENDELA EDITOR (Toolbox & Properties) --- */
.ve-floating-window {
    position: fixed;
    background: var(--window-bg);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 2001;
    /* z-index lebih tinggi dari panel kiri */
    display: flex;
    flex-direction: column;
}

.ve-window-header {
    padding: 8px 12px;
    font-weight: 600;
    cursor: grab;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.03);
    /*+placement: ;*/
    position: relative;
    left: 0;
    top: 0;
}

.ve-window-header:active {
    cursor: grabbing;
}

.ve-window-content {
    padding: 10px;
    overflow-y: auto;
}

.ve-window-content .toolbox-actions {
}

#toolbox {
    width: 78px;
    top: 32px;
    left: 31px;
}

body .toolbox-divider {
    padding-left: 0;
}

#toolbox button {
    background: #FFF;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
}

#toolbox button:hover {
    background-color: #F0F0F0;
    border-color: var(--primary-color);
}

#toolbox button i {
    font-size: 16px;
    margin-bottom: 4px;
}

#properties-panel {
    width: 300px;
    top: 20px;
    right: 20px;
    max-height: calc(100vh - 40px);
}

#selected-info {
    padding: 5px 10px;
    font-size: 12px;
    background: #E9ECEF;
    word-break: break-all;
}

#selected-info span {
    font-family: monospace;
}

.ve-panel-actions {
    display: flex;
    gap: 5px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.ve-panel-actions button {
    flex-grow: 1;
    background: #FFF;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
}

.ve-panel-actions button:hover {
    background-color: #F0F0F0;
}

#delete-button {
    color: #DC3545;
}

.ve-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    padding: 5px 5px 0 5px;
}

.ve-tab-button {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    margin-bottom: -1px;
    font-size: 12px;
}

.ve-tab-button.ve-active {
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.ve-tab-pane {
    display: none;
}

.ve-tab-pane.ve-active {
    display: block;
}

#properties-panel fieldset {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

#properties-panel legend {
    font-weight: 500;
    font-size: 12px;
    padding: 0 5px;
}

#properties-panel label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
}

#properties-panel input[type="text"],
#properties-panel input[type="number"],
#properties-panel select,
#properties-panel textarea {
    width: 100%;
    padding: 5px;
    border: 1px solid #CCC;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 12px;
}

#properties-panel input[type="color"] {
    width: 100%;
    height: 25px;
    padding: 2px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CCC;
    -webkit-transition: .4s;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: 0.4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Aturan Cetak --- */
@media print {
    @page {
        margin: 15mm;
    }
    
    body {
        background: none;
        margin: 0;
    }
    
    .ve-floating-window,
    .left-control-panel,
    .no-print {
        display: none !important;
    }
    
    .workspace {
        padding: 0;
        overflow: visible;
    }
    
    #printable-container {
        width: 100%;
        height: auto;
        box-shadow: none;
        border: none;
    }
    
    .editable-element {
        border: none !important;
        box-shadow: none !important;
    }
}
