/* public/css/styles.css */
:root {
    --primary-color: #1a73e8;
    --secondary-color: #f1f3f4;
    --accent-color: #5f6368;
    --border-color: #dadce0;
    --success-color: #0f9d58;
    --warning-color: #f4b400;
    --error-color: #d93025;
    --background-color: #f5f5f5;
    --text-color: #202124;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Sarabun', 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 20px;
}

.container {
    max-width: 90%;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.form-header {
    background-color: var(--primary-color);
    color: white;
    padding: 24px;
    text-align: center;
}

.form-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.form-header p {
    font-size: 16px;
    opacity: 0.9;
}

.form-content {
    padding: 24px;
}

.form-section {
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.checkbox-group, .radio-group {
    margin-bottom: 8px;
}

.checkbox-group label, .radio-group label {
    display: inline-flex;
    align-items: center;
    margin-right: 16px;
    cursor: pointer;
}

.checkbox-group input, .radio-group input {
    margin-right: 8px;
}

.grid-2, .grid-3 {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.grid-3 {
    grid-template-columns: 140px 1fr;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

table th, table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

table th {
    background-color: var(--secondary-color);
    font-weight: 600;
    text-align: center;
}

table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.add-row-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    transition: background-color 0.2s;
}

.add-row-btn:hover {
    background-color: #0d63cb;
}

.add-row-btn:before {
    content: "+";
    margin-right: 6px;
    font-size: 16px;
}

.submit-container {
    text-align: center;
    margin-top: 32px;
}

.submit-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 12px 32px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-btn:hover {
    background-color: #0b8043;
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .form-header h1 {
        font-size: 20px;
    }

    .form-content {
        padding: 16px;
    }
}

.tab-indent {
    padding-left: 40px;
}

.checkbox-group {
    padding-left: 40px;
}

/* Popup Auto-complete */
.ui-autocomplete {
    position: absolute;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 5px 0;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    margin-left: 100px;
}

.ui-menu-item {
    padding: 5px 15px;
    cursor: pointer;
}

.ui-menu-item:hover {
    background-color: #f5f5f5;
}

.ui-state-focus {
    background-color: #e9e9e9;
    border: none;
    margin: 0;
}

/* เพิ่มสไตล์สำหรับปุ่มสไลด์ยืนยัน ห้ามลบ */
.confirmation-toggle {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

.toggle-container, .toggle-message {
    width: 70%;
}


.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-weight: 500;
    color: #495057;
}

/* ปุ่ม submit ที่ถูกปิดใช้งาน */
.submit-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

p.note {
    color: gray;
    font-size: 0.8em;
}

/* สไตล์สำหรับการแจ้งเตือนข้อผิดพลาด */
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.alert-danger div {
    margin-bottom: 5px;
}

.alert-danger div:last-child {
    margin-bottom: 0;
}

/* ปรับปรุงสไตล์ toggle container */
.confirmation-toggle {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.toggle-message {
    margin-top: 10px;
    font-weight: bold;
}

/* Validation error styles */
.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

#error-list {
    margin-bottom: 0;
    padding-left: 20px;
}

#error-list li {
    margin-bottom: 5px;
}
#training-search-results {
    max-height: 300px;
    overflow-y: auto;
}

#training-search-results .list-group-item {
    cursor: pointer;
    transition: background-color 0.2s;
}

#training-search-results .list-group-item:hover {
    background-color: #f8f9fa;
}

#training-search-modal .modal-dialog {
    max-width: 600px;
}