/*
    @file        style.css
    @version     v1.7.0
    @date        2026-01-30
    @author      QHSEF Dev Team
    @description Styling untuk Form Neraca Limbah B3 - CLEANED & OPTIMIZED
    @changelog
    - v1.0.0 (2026-01-30): Initial release
    - v1.1.0 (2026-01-30): Fixed layout overflow
    - v1.2.0 (2026-01-30): Added date picker styling
    - v1.3.0 (2026-01-30): Added checkbox styling
    - v1.4.0 (2026-01-30): Added C/D fields styling
    - v1.5.0 (2026-01-30): Fixed calculation layout
    - v1.6.0 (2026-01-30): Integrated calculation logic
    - v1.7.0 (2026-01-30): CLEANED - Removed duplicates, conflicts, and optimized structure
*/

/* ===== VARIABLES ===== */
:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --secondary: #558B2F;
    --info: #2196F3;
    --info-dark: #0b7dda;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --purple: #9C27B0;
    --light-bg: #f9f9f9;
    --card-bg: #ffffff;
    --text: #333;
    --border: #ccc;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 20px;
    line-height: 1.5;
    background-color: var(--light-bg);
    color: var(--text);
}

/* ===== HEADER STYLES ===== */
.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;
}

/* ===== BACK BUTTON (HEADER) ===== */
.btn-back {
    background: var(--info);
    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;
}

/* ===== SECTION STYLES ===== */
.section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.section-sub {
    margin-bottom: 20px;
}

.section-title {
    font-weight: bold;
    margin: 15px 0 10px;
    font-size: 16px;
    color: #2c3e50;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

/* ===== TABLE STYLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    table-layout: fixed;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border);
    padding: 10px 8px;
    vertical-align: top;
    text-align: left;
    box-sizing: border-box;
}

.data-table th {
    background-color: #f0f8ff;
    font-weight: bold;
    text-align: center;
}

/* ===== INPUT STYLES ===== */
.input-full,
.input-numeric,
.input-small,
.input-date {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.input-numeric {
    text-align: right;
}

.input-small {
    text-align: center;
}

.input-date {
    max-width: 150px;
    background: white;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.date-range span {
    font-weight: bold;
    color: #555;
}

/* ===== CHECKBOX STYLES ===== */
.checkbox-container {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked + .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkbox-container input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ===== NOTES STYLES ===== */
.notes-cell {
    vertical-align: top;
    padding: 10px;
}

.notes-textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}

.notes-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    font-size: 13px;
}

/* ===== BUTTON STYLES ===== */
/* Action Buttons (Add/Delete Row) */
.btn-add-row {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    width: 100%;
    text-align: center;
}

.btn-add-row:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-delete-row {
    background: var(--danger);
    color: white;
    border: none;
    padding: 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%;
}

.btn-delete-row:hover {
    background: var(--danger-dark);
    transform: scale(1.1);
}

/* Action Buttons Container (Save/Load/Export) */
.action-buttons-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.btn-save, .btn-load, .btn-export-pdf, .btn-export-excel, .btn-chart {
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 600;
    text-decoration: none;
    color: white;
}

.btn-save { background: var(--info); }
.btn-load { background: var(--purple); }
.btn-export-pdf { background: #f44336; }
.btn-export-excel { background: var(--success); }
.btn-chart { background: var(--warning); }

.btn-save:hover { background: var(--info-dark); transform: translateY(-2px); }
.btn-load:hover { background: #7b1fa2; transform: translateY(-2px); }
.btn-export-pdf:hover { background: #d32f2f; transform: translateY(-2px); }
.btn-export-excel:hover { background: #388e3c; transform: translateY(-2px); }
.btn-chart:hover { background: #e65100; transform: translateY(-2px); }

/* Chart Page Specific Buttons */
.btn-refresh {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-refresh:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-delete-data {
    background: var(--danger);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete-data:hover {
    background: var(--danger-dark);
    transform: scale(1.1);
}

/* ===== TOTAL TABLE STYLES ===== */
.total-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.total-table td {
    border: 1px solid var(--border);
    padding: 12px 10px;
    vertical-align: middle;
}

.total-table td input {
    width: 100%;
    border: none;
    background: transparent;
    text-align: right;
    font-weight: bold;
    font-size: 14px;
}

/* ===== 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;
}

/* ===== CHART PAGE STYLES ===== */
.chart-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    height: 400px;
}

.data-table-container {
    margin-top: 30px;
}

.chart-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    body {
        margin: 10px;
        font-size: 14px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        text-align: center;
    }

    .logo img {
        height: 40px;
    }

    .form-title {
        font-size: 18px;
        margin: 5px 0;
    }

    .section {
        padding: 15px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .btn-back {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }

    .action-buttons-container {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-save, .btn-load, .btn-export-pdf, .btn-export-excel, .btn-chart {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    body {
        margin: 8px;
        font-size: 13px;
    }

    .logo img {
        height: 35px;
    }

    .form-title {
        font-size: 16px;
    }

    .section-title {
        font-size: 15px;
        margin: 10px 0 8px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 5px;
        font-size: 12px;
    }

    .notes-textarea {
        min-height: 80px;
        font-size: 13px;
    }

    .btn-add-row {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn-delete-row {
        padding: 4px 8px;
        font-size: 12px;
    }

    .btn-back {
        font-size: 13px;
        padding: 8px 15px;
    }

    .btn-back i {
        font-size: 14px;
    }

    .date-range {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-date {
        max-width: 100%;
    }

    .chart-container {
        height: 300px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        margin: 0;
        padding: 20px;
        background: white;
    }

    .action-buttons-container,
    .btn-add-row,
    .btn-delete-row,
    .btn-back,
    .footer-info {
        display: none !important;
    }

    .section {
        box-shadow: none;
        padding: 10px 0;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 5px;
    }
}
/* ===== MODAL STYLES ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #2E7D32;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #2E7D32;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #000;
}

.modal-body {
    max-height: 500px;
    overflow-y: auto;
}

.modal-footer {
    padding-top: 20px;
    border-top: 1px solid #ddd;
    text-align: right;
}

.btn-close-modal {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-close-modal:hover {
    background: #5a6268;
}

/* ===== MANAGE DATA STYLES ===== */
.manage-data-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.data-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2E7D32;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.data-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.data-info {
    flex: 1;
    color: #333;
}

.data-info strong {
    color: #2E7D32;
    font-size: 16px;
}

.data-info small {
    display: block;
    color: #6c757d;
    margin-top: 3px;
}

.data-actions {
    display: flex;
    gap: 10px;
}

.btn-edit-data, .btn-delete-data {
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-edit-data {
    background: #2196F3;
    color: white;
}

.btn-edit-data:hover {
    background: #0b7dda;
    transform: translateY(-2px);
}

.btn-delete-data {
    background: #e74c3c;
    color: white;
}

.btn-delete-data:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .data-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .data-actions {
        width: 100%;
        justify-content: flex-end;
    }
}