﻿/* ===== ตัวแปรสีหลัก ===== */
:root {
    --primary-color: #F4D793;
    --primary-hover: #F0A04B;
    --primary-light: #fef8e9;
    --primary-dark: #E38B29;
    --text-primary: #333333;
    --text-secondary: #6c757d;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
}

/* ===== ตั้งค่าพื้นฐาน ===== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    color: var(--text-primary);
    background-color: var(--bg-light);
}

/* ===== การ์ด และ Section ===== */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

    .card:hover {
/*        transform: translateY(-5px);*/
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    }

.card-header {
    background-color: var(--primary-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0 !important;
    padding: 0.8rem 1.25rem;
}

    .card-header h5 {
        color: var(--text-primary);
        font-weight: 600;
        margin-bottom: 0;
    }

.section-title {
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ===== ปุ่มและการกดเน้น ===== */
.btn-custom {
    background-color: var(--primary-color);
    color: var(--text-primary);
    border: none;
    font-weight: 500;
}

    .btn-custom:hover, .btn-custom:focus {
        background-color: var(--primary-hover);
        color: white;
    }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--primary-hover);
}

.btn-outline-primary {
    color: var(--primary-dark);
    border-color: var(--primary-color);
}

    .btn-outline-primary:hover {
        background-color: var(--primary-color);
        border-color: var(--primary-hover);
        color: var(--text-primary);
    }

/* ===== การนำทาง ===== */
.breadcrumb-item a {
    color: var(--primary-dark);
    text-decoration: none;
}

    .breadcrumb-item a:hover {
        color: var(--primary-hover);
        text-decoration: underline;
    }

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ===== ตาราง ===== */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.table-hover tbody tr:hover {
    background-color: var(--primary-light);
}

.table thead th {
    border-bottom: 2px solid var(--primary-color);
    background-color: var(--bg-light);
    color: var(--text-primary);
}

.clickable-row {
    cursor: pointer;
}

    .clickable-row:hover {
        background-color: var(--primary-light);
    }

/* ===== แบดจ์และสถานะ ===== */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: var(--text-primary) !important;
}

.text-primary {
    color: var(--primary-dark) !important;
}

.status-badge {
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-shipped {
    background-color: #cce5ff;
    color: #004085;
}

.status-partial-shipped {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-partial-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

.status-default {
    background-color: #e2e3e5;
    color: #383d41;
}

/* ===== แนวตั้ง ===== */
.profile-info i {
    width: 24px;
    text-align: center;
    margin-right: 8px;
    color: var(--primary-dark);
}

.profile-image-placeholder {
    width: 120px;
    height: 120px;
    background-color: var(--primary-light);
    border: 2px solid var(--primary-color);
}

/* ===== แก้ไขสำหรับอุปกรณ์มือถือ ===== */
@media (max-width: 992px) {
/*    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='black' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    }*/
    .navbar-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-header h5 {
        font-size: 1rem;
    }

    .profile-image-placeholder {
        width: 100px;
        height: 100px;
    }
}

/* ===== เพิ่มเติมสำหรับ layout ใหม่ ===== */
.farm-stats {
    border-right: 1px solid var(--border-color);
}

    .farm-stats h2 {
        font-size: 1.8rem;
        font-weight: bold;
        color: var(--primary-dark);
    }

.info-icon-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

    .info-icon-container i {
        color: var(--primary-dark);
        width: 24px;
        margin-right: 10px;
    }

.no-click {
    pointer-events: none;
}

    .no-click a {
        pointer-events: auto;
    }

/* ===== Animation ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* ===== ไอคอนในปุ่ม ===== */
.btn i {
    margin-right: 5px;
}

/* ===== รูปแบบไอคอน ===== */
.icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    margin-right: 10px;
}


/* 
   CSS นี้เป็นส่วนที่แก้ไขเฉพาะ navbar ให้กลับไปใช้สไตล์เดิม 
   โดยยังคงใช้สไตล์อื่นๆ จาก CSS ใหม่
*/

/* ===== แก้ไขสไตล์ Navbar ===== */
/* กำหนดสีพื้นหลังของ navbar กลับไปเป็นแบบเดิม */
.navbar-primary {
    background-color: var(--primary-color) !important;
}

/* แก้ไขลิงก์ใน navbar */
.nav-link {
    color: black !important;
    padding: 0.5rem 1rem !important;
    border-radius: 4px;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--primary-hover) !important;
}

/* เส้นคั่นใน navbar */
.nav-divider {
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    margin: 0 0.5rem;
    height: 24px;
    align-self: center;
}

/* สไตล์สำหรับ navbar บนอุปกรณ์มือถือ */
@media (max-width: 992px) {
    .navbar-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
/* ===== ปรับแต่ง Modal ให้ตรงกับธีมของ Card ===== */
.modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.modal-header {
    background-color: var(--primary-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0 !important;
    padding: 1rem 1.25rem;
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
    border-radius: 0 0 8px 8px;
    padding: 1rem;
}

/* ปุ่มปิด (X) ในส่วนหัวของ Modal */
.modal-header .btn-close {
    color: var(--text-primary);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

    .modal-header .btn-close:hover {
        opacity: 1;
    }

/* Animation สำหรับ Modal */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

/* Card ภายใน Modal */
.modal-body .card {
    animation: none;
    transform: none;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.03);
    margin-bottom: 1.5rem;
}

    .modal-body .card:hover {
        transform: none;
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.03);
    }

.modal-body .card-header {
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 1.25rem;
}

    .modal-body .card-header h5 {
        color: var(--text-primary);
        font-size: 1rem;
    }

/* ขนาด Modal */
@media (min-width: 992px) {
    .modal-xl {
        max-width: 1140px;
    }

    .modal-lg {
        max-width: 800px;
    }
}

/* ปรับแต่งสำหรับมือถือ */
@media (max-width: 768px) {
    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem;
    }
}

/* สไตล์สำหรับ validation feedback */
.modal-body .invalid-feedback {
    display: none;
    font-size: 0.85rem;
}

.modal-body .is-invalid ~ .invalid-feedback {
    display: block;
}

.modal-body .form-control.is-invalid,
.modal-body .form-select.is-invalid {
    border-color: var(--danger-color);
}

/* สไตล์สำหรับแผนที่ใน Modal */
#modalMap {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}



/* ข้อความ coordinate display */
#coordinateDisplay {
    color: var(--text-secondary);
    font-size: 0.875rem;
}



.expandable-table .field-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.expandable-table .field-row:hover {
    background-color: var(--primary-light);
}

.field-details-row td {
    background-color: var(--bg-light);
    border-top: none;
}

.field-details-container {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    animation: slideDown 0.3s forwards;
}

.field-details-inner {
    background-color: var(--bg-light);
    border-radius: 0 0 8px 8px;
    box-shadow: inset 0 3px 6px -3px rgba(0, 0, 0, 0.1);
    margin: 0;
    padding: 20px;
}

.expand-button {
    transition: transform 0.2s;
}

    .expand-button i.fa-chevron-up {
        transform: rotate(180deg);
    }

/* Animation */
@keyframes slideDown {
    from {
        max-height: 0;
    }

    to {
        max-height: 1000px;
    }
}

/* สไตล์สำหรับรายละเอียด */
.field-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.field-summary-item {
    flex: 1;
    min-width: 200px;
    background-color: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

    .field-summary-item .label {
        font-size: 0.85rem;
        color: var(--text-secondary);
        margin-bottom: 5px;
    }

    .field-summary-item .value {
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--text-primary);
    }

    .field-summary-item i {
        color: var(--primary-dark);
        margin-right: 5px;
    }


.delivery-steps-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0;
    min-height: 70px;
    -webkit-overflow-scrolling: touch; /* สำหรับ iOS smooth scrolling */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ccc transparent; /* Firefox */
}

    /* Custom scrollbar สำหรับ WebKit browsers */
    .delivery-steps-container::-webkit-scrollbar {
        height: 6px;
    }

    .delivery-steps-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .delivery-steps-container::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 10px;
    }

        .delivery-steps-container::-webkit-scrollbar-thumb:hover {
            background: #999;
        }

.step-button {
    flex-shrink: 0; /* ป้องกันไม่ให้ปุ่มถูกบีบ */
}

.step-wrapper {
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px; /* กำหนดความกว้างขั้นต่ำ */
}

.step-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    line-height: 50px;
    color: white;
    text-align: center;
    font-weight: bold;
    margin: auto;
    flex-shrink: 0;
}

.arrow-right {
    font-size: 24px;
    color: #ccc;
    align-self: center;
    flex-shrink: 0; /* ป้องกันไม่ให้ลูกศรถูกบีบ */
    min-width: 30px;
    text-align: center;
}

/* สำหรับ Desktop - จัดกึ่งกลาง */
@media (min-width: 768px) {
    .delivery-steps-container {
        justify-content: center;
        overflow-x: visible;
    }
}

/* สำหรับ Mobile - แสดง scroll hint */
@media (max-width: 767px) {
    .delivery-steps-container {
        position: relative;
    }

        .delivery-steps-container::after {
            content: "";
            position: absolute;
            right: 0;
            top: 0;
            width: 20px;
            height: 100%;
            background: linear-gradient(to right, transparent, rgba(255,255,255,0.8));
            pointer-events: none;
            z-index: 1;
        }
}
/* แผนที่ */
.detail-map-container {
    height: 250px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 20px;
}
footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: #f8f9fa; /* ปรับสีพื้นหลังให้เข้ากับเว็บ */
    padding: 10px 0;
    
}
