/* ============================================
   LAPORAN HARIAN V.1 - STYLE.CSS
   FIXED - No empty pages, photos displayed correctly
   ============================================ */

/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    min-height: 100vh;
    background: #525659;
    overflow: hidden;
}

.input-icon {
    width: 14px;
    height: 14px;
    margin-right: 4px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media screen and (min-width: 1200px) {
    body {
        flex-direction: row;
        height: 100vh;
        overflow: hidden;
    }
    #input-panel {
        width: 380px;
        height: 100vh;
        overflow-y: auto;
        flex-shrink: 0;
    }
    #preview-panel {
        flex: 1;
        height: 100vh;
        overflow-y: auto;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
    }
    .pdf-container {
        transform: scale(0.9);
        transform-origin: center;
    }
}

@media screen and (min-width: 1024px) and (max-width: 1199px) {
    body {
        flex-direction: row;
        height: 100vh;
        overflow: hidden;
    }
    #input-panel {
        width: 360px;
        height: 100vh;
        overflow-y: auto;
        flex-shrink: 0;
    }
    #preview-panel {
        flex: 1;
        height: 100vh;
        overflow-y: auto;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 15px;
    }
    .pdf-container {
        transform: scale(0.8);
        transform-origin: center;
    }
}

@media screen and (max-width: 1023px) {
    body {
        flex-direction: column;
        height: auto;
        overflow: auto;
    }
    #input-panel {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        height: auto;
        max-height: 70vh;
        overflow-y: auto;
    }
    #preview-panel {
        width: 100%;
        padding: 20px;
        height: auto;
        min-height: 50vh;
        overflow-y: visible;
    }
    .pdf-container {
        transform: scale(0.7);
        transform-origin: top center;
    }
}

/* ===== INPUT PANEL ===== */
#input-panel {
    background: white;
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

#input-panel h3 {
    color: #0054a6;
    margin-bottom: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0054a6;
    flex-shrink: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    flex-grow: 1;
}

.form-group {
    margin-bottom: 0;
}

label {
    font-size: 11px;
    font-weight: bold;
    color: #000000;
    display: flex;
    align-items: center;
    margin-bottom: 3px;
}

input,
textarea,
select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #000000;
    border-radius: 4px;
    font-size: 11px;
    color: #000000;
    transition: all 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #0054a6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 84, 166, 0.1);
}

.row-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.upload-note {
    font-size: 9px;
    color: #666;
    margin-top: 2px;
    font-style: italic;
}

.preview-container {
    display: flex;
    gap: 5px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.preview-image {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border: 1px solid #000000;
    border-radius: 4px;
    padding: 2px;
    background: #f9f9f9;
}

.ttd-preview {
    width: 55px;
    height: 38px;
    object-fit: contain;
    border: 1px solid #000000;
    border-radius: 4px;
    padding: 2px;
    background: #f9f9f9;
}

/* ===== FOTO UPLOAD ===== */
.foto-upload-container {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    background: #fafafa;
    margin-top: 3px;
}

.foto-grid-review {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.foto-slot-review {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    position: relative;
    aspect-ratio: 1 / 1;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.foto-slot-review:hover {
    border-color: #0054a6;
    background: #f0f7ff;
    transform: translateY(-1px);
}

.foto-slot-review.filled {
    border: 2px solid #0054a6;
    background: #f0f7ff;
}

.foto-slot-review .camera-icon-small {
    width: 22px;
    height: 22px;
    opacity: 0.7;
    margin-bottom: 3px;
}

.foto-slot-review .slot-number {
    font-size: 9px;
    font-weight: bold;
    color: #000000;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 10px;
    margin-top: 2px;
}

.foto-slot-review.filled .slot-number {
    background: #0054a6;
    color: white;
}

.foto-slot-review .foto-preview-small {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #0054a6;
    display: none;
}

.foto-slot-review .foto-preview-small.active {
    display: block;
}

.foto-slot-review.filled .camera-icon-small {
    display: none;
}

.foto-remove-small {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    border: 2px solid white;
    display: none;
    z-index: 20;
    font-weight: bold;
}

.foto-remove-small:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.foto-slot-review.filled .foto-remove-small {
    display: flex;
}

.hidden-file-input {
    display: none;
}

.foto-info {
    font-size: 9px;
    color: #666;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 4px;
}

/* ===== TOMBOL DOWNLOAD ===== */
.download-section {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-top: 15px;
    border: 1px solid #000000;
    flex-shrink: 0;
}

.btn-download {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #0054a6 0%, #004080 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-download:hover {
    background: linear-gradient(135deg, #004080 0%, #003366 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 84, 166, 0.3);
}

.btn-download img {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    filter: brightness(0) invert(1);
}

.btn-info {
    font-size: 10px;
    color: #000000;
    text-align: center;
    margin-top: 5px;
}

/* ===== PREVIEW PANEL ===== */
#preview-panel {
    background: #525659;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.pdf-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    align-items: center;
    justify-content: center;
}

/* ===== PDF PAGE - LANDSCAPE ===== */
.pdf-page {
    background: white;
    width: 297mm;
    min-height: 210mm;
    padding: 15mm 20mm;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
    position: relative;
    border-radius: 3px;
    display: block;
    margin: 0 auto;
    page-break-after: always;
    page-break-inside: avoid;
}

/* ===== HEADER ===== */
.page-header {
    text-align: center;
    margin-bottom: 15px;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.logo-img {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
}

.page-header h2 {
    font-size: 16pt;
    margin: 2px 0;
    font-weight: bold;
    color: #000000;
}

/* ===== HALAMAN 2 ===== */
.page2-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: none;
}

.page2-header h3 {
    font-size: 15pt;
    color: #000000;
    font-weight: bold;
}

/* ===== INFO TABLE ===== */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.info-table td {
    border: 1px solid #000000;
    padding: 8px 10px;
    font-size: 12pt;
    vertical-align: top;
    color: #000000;
}

.label-cell {
    width: 140px;
    font-weight: bold;
    background: #f2f2f2;
    color: #000000;
}

/* ===== CONTENT AREA ===== */
.section-title {
    font-size: 12pt;
    font-weight: bold;
    margin: 10px 0 4px 0;
    color: #000000;
}

.content-area {
    font-size: 12pt;
    line-height: 1.5;
    text-align: justify;
    padding: 0;
    color: #000000;
    margin-bottom: 5px;
}

.list-item {
    display: flex;
    margin-bottom: 3px;
}

.list-number {
    width: 22px;
    flex-shrink: 0;
    font-weight: bold;
    color: #000000;
}

/* ===== PHOTO SECTION ===== */
.photo-section-title {
    font-size: 12pt;
    font-weight: bold;
    color: #000000;
    margin: 15px 0 10px 0;
    text-align: center;
    border-bottom: none;
    padding-bottom: 0;
}

.photo-grid {
    display: grid;
    gap: 20px;
    margin-top: 10px;
    justify-content: center;
    align-items: center;
}

/* ===== HALAMAN 1 - 2 FOTO ===== */
.photo-grid.page1 {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 20px;
    width: 100%;
}

.photo-grid.page1 .photo-box {
    border: 1px solid #000000;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 90mm;
    margin: 0 auto;
}

.photo-grid.page1 .photo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

/* ===== HALAMAN 2 - GRID 4 KOLOM CENTER ===== */
.photo-grid.page2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
    width: 100%;
}

.photo-grid.page2 .photo-box {
    border: 1px solid #000000;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    aspect-ratio: 1 / 1;
    width: 100%;
}

.photo-grid.page2 .photo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

/* ===== PHOTO SECTION CONTAINER ===== */
#photo-section-page1 {
    display: none;
    width: 100%;
}

#photo-section-page1.active {
    display: block;
    margin-bottom: 20px;
}

/* ===== SIGNATURE SECTION - TETAP DI HALAMAN 1 ===== */
.signature-section {
    margin-top: 30px;
    margin-bottom: 0;
    margin-left: auto;
    margin-right: 0;
    width: 260px;
    text-align: center;
    background: white;
    padding: 12px 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    float: right;
    clear: both;
}

.signature-section p {
    margin: 6px 0;
    color: #000000;
    line-height: 1.5;
    font-size: 12pt;
}

.signature-image {
    max-width: 150px;
    max-height: 55px;
    object-fit: contain;
    margin: 10px auto;
    border-bottom: none;
    padding-bottom: 0;
    display: block;
}

.ttd-location-date {
    margin-bottom: 12px;
    font-weight: bold;
    color: #000000;
    font-size: 12pt;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

/* ===== HALAMAN 2 TOGGLE ===== */
#pdf-page2 {
    display: none;
}

#pdf-page2.active {
    display: block;
}

/* ===== DOWNLOAD STATUS ===== */
.download-status {
    display: none;
    margin-top: 8px;
    padding: 6px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    text-align: center;
    font-size: 10px;
}

/* ===== REQUIRED FIELD ===== */
.required:after {
    content: " *";
    color: red;
    font-size: 11px;
}

/* ===== TEXTAREA ===== */
textarea {
    resize: vertical;
    min-height: 50px;
    max-height: 80px;
}

/* ===== CUSTOM SCROLLBAR ===== */
#input-panel::-webkit-scrollbar {
    width: 5px;
}

#input-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#input-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#preview-panel::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#preview-panel::-webkit-scrollbar-track {
    background: #3a3a3a;
    border-radius: 4px;
}

#preview-panel::-webkit-scrollbar-thumb {
    background: #777;
    border-radius: 4px;
}

/* ===== PRINT OPTIMIZATION ===== */
@media print {
    .photo-box {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .signature-section {
        border: 1px solid #ccc;
        box-shadow: none;
    }
    .pdf-page {
        box-shadow: none;
    }
}

/* ===== AKHIR DARI STYLE.CSS ===== */