/*
    @file        style.css
    @version     v1.1.1
    @date        2026-01-30
    @author      QHSEF Dev Team
    @description Styling untuk Form Serah Terima Limbah B3 dengan perbaikan layout tabel.
    
    @changelog
    - v1.0.0 (2026-01-28): Initial release - Base styling untuk form.
    - v1.1.0 (2026-01-29): Added signature input styling with editable fields.
    - v1.1.1 (2026-01-30): Fixed table layout with proper row spacing and column constraints.
*/

/* ===== BASE STYLES ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 20px;
    line-height: 1.5;
    background-color: #f9f9f9;
    color: #333;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.logo img {
    height: 50px;
    max-width: 150px;
    object-fit: contain;
}

.form-title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    margin: 10px 0;
    line-height: 1.3;
}

.section-title {
    font-weight: bold;
    margin: 15px 0 10px;
    font-size: 16px;
    color: #2c3e50;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

/* ===== TABLE STYLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

td, th {
    border: 1px solid #ccc;
    padding: 12px 10px; /* DITINGKATKAN dari 8px */
    vertical-align: top;
    box-sizing: border-box;
}

th {
    background-color: #f0f8ff;
    font-weight: bold;
}

/* ===== INPUT STYLES ===== */
.input-small {
    width: 100%;
    max-width: 120px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.input-date {
    width: 100%;
    max-width: 180px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.remarks {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-size: 14px;
    font-family: inherit;
}

/* ===== TABEL DATA EDITABLE ===== */
.table-data {
    font-size: 14px;
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* PENTING: Mengatur lebar kolom secara tetap */
}

.table-data th {
    background-color: #e6f7ff;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    white-space: nowrap; /* Mencegah teks di header memaksa kolom melebar */
}

.table-data td {
    padding: 12px 10px; /* DITINGKATKAN dari 10px 8px */
    border: 1px solid #ddd;
    vertical-align: middle;
    overflow: hidden; /* Mencegah konten keluar dari batas kolom */
    text-overflow: ellipsis; /* Tambahkan titik-titik jika teks terlalu panjang */
    white-space: normal; /* Biarkan teks bisa wrap */
}

/* PENGATURAN LEBAR KOLUM */
.table-data th:nth-child(1),
.table-data td:nth-child(1) {
    width: 5%; /* No. */
}

.table-data th:nth-child(2),
.table-data td:nth-child(2) {
    width: 35%; /* Deskripsi */
}

.table-data th:nth-child(3),
.table-data td:nth-child(3) {
    width: 15%; /* Kuantitas */
}

.table-data th:nth-child(4),
.table-data td:nth-child(4) {
    width: 20%; /* Satuan */
}

.table-data th:nth-child(5),
.table-data td:nth-child(5) {
    width: 25%; /* Aksi */
}

/* Input dalam tabel */
.input-deskripsi,
.input-kuantitas,
.input-satuan {
    width: 100%;
    padding: 10px; /* DITINGKATKAN dari 8px */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s;
    box-sizing: border-box; /* Pastikan padding tidak melebihi lebar kolom */
    line-height: 1.4; /* Tambahkan jarak antar baris teks */
}

.input-deskripsi:focus,
.input-kuantitas:focus,
.input-satuan:focus {
    outline: none;
    border-color: #2E7D32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.row-number {
    font-weight: bold;
    text-align: center;
    background: #f8f9fa;
    width: 40px;
    padding: 12px 0; /* Tambahkan padding vertikal */
}

/* ===== TOMBOL HAPUS BARIS ===== */
.btn-delete-row {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px; /* DITINGKATKAN dari 6px 10px */
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.btn-delete-row:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.btn-delete-row i {
    margin: 0;
}

/* ===== TOMBOL TAMBAH BARIS ===== */
.btn-add-row {
    background: #2E7D32;
    color: white;
    border: none;
    padding: 12px 25px; /* DITINGKATKAN dari 10px 20px */
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px; /* DITINGKATKAN dari 8px */
    transition: all 0.2s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.btn-add-row:hover {
    background: #1B5E20;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}

/* ===== SIGNATURE SECTION ===== */
.signature-section {
    display: flex;
    justify-content: space-around;
    margin-top: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.signature-box {
    flex: 1;
    min-width: 200px;
    text-align: center;
    margin: 10px;
}

.signature-label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

.signature-line {
    border-bottom: 1px solid #000;
    width: 100%;
    height: 30px;
    margin: 15px 0 8px;
}

/* ===== SIGNATURE INPUT ===== */
.signature-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.signature-input {
    border: none;
    outline: none;
    width: 100%;
    text-align: center;
    font-size: 14px;
    padding: 0;
    background: transparent;
    font-family: inherit;
    transition: all 0.2s;
}

.signature-input:focus {
    border-bottom: 1px solid #2E7D32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.signature-input-container span {
    font-size: 16px;
    font-weight: bold;
}

.signature-jabatan {
    margin-top: 5px;
    font-size: 12px;
    color: #6B7280;
}

.signature-jabatan input {
    width: 100%;
    text-align: center;
    border: none;
    outline: none;
    font-size: 12px;
    background: transparent;
    padding: 2px 0;
}

/* ===== FOOTER INFO ===== */
.footer-info {
    margin-top: 40px;
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #6B7280;
}

.revision-info {
    display: inline-block;
    padding: 5px 15px;
    background: #e6f7ff;
    border-radius: 20px;
    font-size: 13px;
}

/* ===== RESPONSIVE TABLE - MOBILE FIX ===== */
@media (max-width: 768px) {
    body {
        margin: 10px;
        font-size: 14px;
    }

    .header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .logo img {
        height: 40px;
    }

    .form-title {
        font-size: 18px;
        margin: 5px 0;
    }

    .section-title {
        font-size: 15px;
        margin: 12px 0 8px;
    }

    td, th {
        padding: 10px 8px;
        font-size: 13px;
    }

    .input-date, .input-small {
        width: 100%;
        max-width: 100%;
        font-size: 14px;
    }

    /* Stack signature boxes vertically on mobile */
    .signature-section {
        flex-direction: column;
        align-items: center;
    }

    .signature-box {
        width: 100%;
        max-width: 300px;
        margin: 10px 0;
    }

    .signature-line {
        height: 35px;
    }

    /* Make tables scrollable */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .signature-input-container,
    .signature-jabatan {
        flex-direction: column;
        align-items: center;
    }
    
    .signature-input-container span {
        font-size: 14px;
    }
    
    .signature-jabatan {
        font-size: 11px;
        margin-top: 3px;
    }
    
    /* Pengaturan khusus untuk tabel di mobile */
    .table-data {
        table-layout: auto; /* Di mobile, biarkan tabel menyesuaikan lebar */
    }
}

@media (max-width: 480px) {
    body {
        margin: 8px;
        font-size: 13px;
    }

    .logo img {
        height: 35px;
    }

    .form-title {
        font-size: 16px;
    }

    td, th {
        padding: 8px 6px;
        font-size: 12px;
    }

    label {
        font-size: 12px;
    }

    .signature-label {
        font-size: 13px;
    }

    .signature-line {
        height: 40px;
    }

    .remarks {
        min-height: 100px;
        font-size: 13px;
    }

    .btn-delete-row {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-add-row {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .signature-input-container {
        gap: 4px;
    }
    
    .signature-input {
        font-size: 13px;
    }
    
    .signature-input-container span {
        font-size: 14px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        margin: 0;
        padding: 10px;
        background: white;
    }

    .btn-add-row,
    .btn-delete-row {
        display: none !important;
    }

    .signature-line {
        border-bottom: 1px solid #000 !important;
    }

    table {
        box-shadow: none;
    }
    
    .footer-info {
        display: none;
    }
}

/* ===== BACK BUTTON ===== */
.btn-back {
    background: #1976D2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
    margin-left: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.btn-back:hover {
    background: #0D47A1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-back i {
    font-size: 16px;
}

/* ===== RESPONSIVE BACK BUTTON ===== */
@media (max-width: 768px) {
    .btn-back {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .btn-back {
        font-size: 13px;
        padding: 8px 15px;
    }
    
    .btn-back i {
        font-size: 14px;
    }
}