/* pkl-form.css */

:root {
    /* Kasikorn Brand Colors */
    --k-primary: #00853E;
    --k-secondary: #59B985;
    --k-light: #E8F5E9;
    --k-dark: #005529;
    --k-gray: #6C757D;
    --k-light-gray: #F8F9FA;
    --k-border: #DEE2E6;
    --k-success: #28A745;
}

/* Container */
.pkl-form-container {
    font-family: 'Prompt', sans-serif;
    max-width: 100%;
    margin: 0;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    padding: 2rem;
}

/* Inline Groups */
.inline-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.inline-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--k-dark);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Input Fields */
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: #495057;
    background-color: #fff;
    border: 1px solid var(--k-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--k-secondary);
    box-shadow: 0 0 0 0.2rem rgba(0, 133, 62, 0.15);
}

/* Product Table */
.product-items-section {
    margin: 2rem 0;
}

.product-items-section h4 {
    color: var(--k-primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.table thead th {
    background-color: var(--k-light);
    color: var(--k-dark);
    padding: 0.75rem;
    border-bottom: 2px solid var(--k-secondary);
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

/* Adjust column widths */
.table th:nth-child(1) { width: 12%; } /* รหัสสินค้า */
.table th:nth-child(2) { width: 20%; } /* รายการ */
.table th:nth-child(3) { width: 12%; } /* การชุบ */
.table th:nth-child(4) { width: 12%; } /* จำนวน/บรรจุภัณฑ์ */
.table th:nth-child(5) { width: 10%; } /* จำนวนชุด */
.table th:nth-child(6) { width: 10%; } /* ลัก No. */
.table th:nth-child(7) { width: 10%; } /* พาเลท No. */
.table th:nth-child(8) { width: 10%; } /* น้ำหนักรวม */
.table th:nth-child(9) { width: 4%; }  /* ปุ่มลบ */

.table td {
    padding: 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--k-border);
}

.table .form-control {
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Total Weight Section */
.total-weight-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 2rem 0;
    gap: 1rem;
}

.total-weight-display {
    text-align: right;
}

.total-weight-display label {
    display: block;
    color: var(--k-gray);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.total-weight-value {
    color: var(--k-primary);
    font-size: 1.8rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Created By Section */
.created-by-section {
    text-align: right;
    margin: 1rem 0;
    color: var(--k-gray);
    font-size: 0.9rem;
}

.created-by-section span {
    font-weight: 500;
    color: var(--k-dark);
}

/* Submit Button */
.submit-section {
    margin-top: 2rem;
    text-align: center;
}

.btn-submit {
    background-color: var(--k-primary);
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-submit:hover {
    background-color: var(--k-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 133, 62, 0.2);
}

.btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 133, 62, 0.2);
}

/* Add/Remove Product Buttons */
.btn-add-product {
    background-color: var(--k-light);
    color: var(--k-primary);
    border: 1px solid var(--k-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-product:hover {
    background-color: var(--k-primary);
    color: white;
}

.btn-remove {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Adjust column widths */
.table th:nth-child(1) { width: 8%; }     /* รหัสสินค้า */
.table th:nth-child(2) { width: 40%; }    /* รายการ */
.table th:nth-child(3) { width: 7%; }     /* การชุบ */
.table th:nth-child(4) { width: 8%; }     /* จำนวน/บรรจุภัณฑ์ */
.table th:nth-child(5) { width: 8%; }     /* จำนวนชุด */
.table th:nth-child(6) { width: 9%; }     /* ประเภทชุด */
.table th:nth-child(7) { width: 6%; }     /* ลัง No. */
.table th:nth-child(8) { width: 6%; }     /* พาเลท No. */
.table th:nth-child(9) { width: 6%; }     /* น้ำหนักรวม */
.table th:nth-child(10) { width: 2%; }    /* ปุ่มลบ */

/* Style for select input */
.form-control.product-set-type {
    padding: 0.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M3 5h6L6 9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2rem;
}

/* Responsive Design */
@media (max-width: 992px) {
	
	.pkl-form-container {
		font-family: 'Prompt', sans-serif;
		max-width: 100%;
		margin: 0;
		background: #fff;
		border-radius: 0;
		box-shadow: none;
		padding: 2rem;
	}
    
    .table-responsive {
		overflow-x: auto;
		margin: 0 -2rem;
		padding: 0 2rem;
	}
	
    .inline-group {
        flex-direction: column;
        gap: 1rem;
    }

    
    .table {
		width: 100%;
		margin-bottom: 1rem;
		font-size: 0.9rem;
	}


    .total-weight-section {
        flex-direction: column;
        align-items: flex-end;
    }
}

@media (max-width: 576px) {
    .pkl-form-container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .table {
		width: 100%;
		margin-bottom: 1rem;
		font-size: 0.9rem;
	}
}

/* Additional styles for number inputs */
input[type="number"].form-control {
    text-align: right;
    padding-right: 0.5rem;
}

@media (max-width: 992px) {
    .pkl-form-container {
        padding: 1rem;
    }
    
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
}



/* เพิ่มในไฟล์ pkl-form.css หรือเพิ่มแบบ inline CSS */

/* สไตล์สำหรับรายการที่เลือก */
.selected-items-container div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    margin-bottom: 4px;
    border-radius: 4px;
    border-left: 3px solid var(--k-primary);
    transition: all 0.2s ease;
}

/* สไตล์สำหรับปุ่ม X */
.selected-items-container button,
.selected-items-container .x,
.selected-items-container [class*="x"] {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 8px;
}

/* เอฟเฟกต์ hover สำหรับปุ่ม X */
.selected-items-container button:hover,
.selected-items-container .x:hover,
.selected-items-container [class*="x"]:hover {
    background-color: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

/* สไตล์สำหรับ Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: var(--k-primary);
}

.btn-modal-close {
    background: none;
    border: none;
    color: var(--k-gray);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--k-primary);
}