/* สไตล์สำหรับ Modal */
.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: auto;
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    width: 80%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: modalSlideDown 0.3s ease-out;
}

@keyframes modalSlideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 22px;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal:hover {
    color: #333;
}

.loading-spinner {
    text-align: center;
    padding: 30px;
    color: #777;
}

.loading-spinner i {
    font-size: 40px;
    margin-bottom: 15px;
    color: #FF8C00;
}

/* สไตล์สำหรับข้อมูลในโมดอล */
.error-message {
    text-align: center;
    padding: 30px;
    color: #d9534f;
}

.error-message i {
    font-size: 40px;
    margin-bottom: 15px;
}

.order-product-list {
    margin-top: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.order-product-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
}

.order-product-item:last-child {
    border-bottom: none;
}

.product-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 15px;
}

.product-details {
    flex: 1;
}

.product-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 14px;
}

.order-summary {
    margin-top: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.summary-total {
    font-weight: bold;
    font-size: 18px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.shipping-address {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

/* สำหรับมือถือ */
@media screen and (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .product-meta {
        flex-direction: column;
        gap: 5px;
    }
}
 /* สไตล์เฉพาะสำหรับหน้าประวัติการสั่งซื้อ */
 .page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.page-header h1 {
    font-size: 1.8rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h1 i {
    color: #FF8C00;
}

.order-history-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.filters {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 600;
    color: #555;
    margin-right: 0.5rem;
}

.filter-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    min-width: 250px;
}

.search-box input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-box button {
    background-color: #FF8C00;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background-color: #e67e00;
}

.no-orders {
    text-align: center;
    padding: 3rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    color: #777;
    font-size: 1.1rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #555;
}

/* ปรับแต่งการ์ดคำสั่งซื้อ */
.order-card {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.order-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.order-header {
    background-color: #f9f9f9;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.order-body {
    padding: 1.5rem;
}

.order-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-group {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 0.5rem;
}

.detail-value {
    font-weight: 600;
    color: #333;
}

.detail-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-items {
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.item-count {
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #333;
}

.item-list {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.more-items {
    font-size: 0.9rem;
    color: #777;
    font-style: italic;
}

.order-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.action-btn {
    padding: 0.8rem 1.2rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    border: none;
}

.primary-btn {
    background-color: #FF8C00;
    color: white;
}

.primary-btn:hover {
    background-color: #e67e00;
}

.outline-btn {
    background-color: transparent;
    color: #555;
    border: 1px solid #ddd;
}

.outline-btn:hover {
    background-color: #f5f5f5;
}

/* แสดงสถานะคำสั่งซื้อ */
.order-status {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-pending {
    background-color: #FFF3CD;
    color: #856404;
}

.status-paid {
    background-color: #D1E7DD;
    color: #0F5132;
}

.status-processing {
    background-color: #CCE5FF;
    color: #0C63E4;
}

.status-shipped {
    background-color: #D7F5FC;
    color: #117A8B;
}

.status-delivered {
    background-color: #D4EDDA;
    color: #155724;
}

.status-cancelled {
    background-color: #F8D7DA;
    color: #721C24;
}

/* การแบ่งหน้า (Pagination) */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.pagination-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background-color: white;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-button.active {
    background-color: #FF8C00;
    color: white;
    border-color: #FF8C00;
}

.pagination-button:hover:not(.active) {
    background-color: #f5f5f5;
}

/* สำหรับการแสดงผลบนมือถือ */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-box {
        width: 100%;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .order-details {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .order-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
}
/* สไตล์สำหรับ Modal - ใช้ !important เพื่อให้มีความสำคัญสูงสุด */
/* บังคับให้ Modal อยู่ตรงกลางอย่างเข้มงวด */
.modal {
    display: none;
    position: fixed !important;
    z-index: 1000;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
}

.modal-content {
    background-color: #fff;
    margin: 10% auto !important;
    width: 80% !important;
    max-width: 800px !important;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: modalSlideDown 0.3s ease-out;
    position: relative !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: inline-block !important;
    text-align: left;
}

/* เพิ่ม CSS hack เพื่อจัดให้อยู่ตรงกลาง */
.modal::before {
    content: '';
    display: inline-block;
    height: 100%;
    vertical-align: middle;
    margin-right: -0.25em;
}
/* ปรับปรุง Modal ให้แสดงข้อมูลในหน้าเดียว */
.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: modalSlideDown 0.3s ease-out;
    overflow: visible; /* เปลี่ยนจาก auto เป็น visible */
    position: relative;
    max-height: none; /* ลบข้อจำกัดความสูง */
}

/* ลบการแบ่งหน้าและอนิเมชัน */
@keyframes modalSlideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* กำหนดให้เนื้อหาทั้งหมดอยู่ในหน้าเดียว */
.modal-body {
    padding: 20px;
    max-height: none; /* ลบข้อจำกัดความสูง */
    overflow-y: visible; /* เปลี่ยนจาก auto เป็น visible */
}

/* ลบการแบ่งส่วนที่ไม่จำเป็น */
.order-details-section {
    margin-bottom: 15px;
    border-bottom: none; /* ลบเส้นขั้น */
}

/* รวมข้อมูลทั้งหมดให้อยู่ในส่วนเดียว */
.section-title, .order-info, .order-product-list, .order-summary, .shipping-address {
    margin-bottom: 10px;
}
/* ปรับปรุงขนาดรูปภาพสินค้าให้เล็กลง */
.product-image {
    width: 40px;  /* ลดจาก 60px */
    height: 40px; /* ลดจาก 60px */
    border-radius: 4px; /* ลดเล็กน้อยให้สอดคล้องกับขนาดที่เล็กลง */
    object-fit: cover;
    margin-right: 10px; /* ลดจาก 15px */
}

/* ปรับปรุงพื้นที่สำหรับข้อมูลสินค้า */
.order-product-item {
    display: flex;
    padding: 8px; /* ลดจาก 15px */
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
    align-items: center;
}

/* ปรับลดขนาดตัวอักษรของรายละเอียดสินค้า */
.product-name {
    font-weight: bold;
    margin-bottom: 3px; /* ลดจาก 5px */
    font-size: 14px; /* ลดขนาดตัวอักษร */
}

.product-meta {
    display: flex;
    flex-direction: column; /* แสดงเป็นแนวตั้ง */
    font-size: 12px; /* ลดขนาดตัวอักษรของข้อมูลเมตา */
    line-height: 1.2; /* เพิ่มระยะห่างระหว่างบรรทัด */
    color: #666;
}

/* ปรับขนาดและระยะห่างของรายการสินค้าทั้งหมด */
.order-product-list {
    margin-top: 10px; /* ลดจาก 20px */
    border: 1px solid #eee;
    border-radius: 6px; /* ลดจาก 8px */
}

/* ทำให้ Modal แสดงข้อมูลได้มากขึ้น */
.modal-body {
    padding: 15px; /* ลดจาก 20px */
    max-height: 75vh; /* เพิ่มความสูงสูงสุด */
    overflow-y: auto;
}

.track-button {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 8px;
    transition: background-color 0.3s ease;
}

.track-button:hover {
    background-color: #2980b9;
}

.track-button i {
    margin-right: 5px;
}
/* สไตล์สำหรับกล่องข้อมูลคำสั่งซื้อที่ปรับปรุง */
.order-info-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.order-info-card .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    background-color: transparent;
    padding: 0 0 10px 0;
    border-radius: 0;
}

.order-info-card .order-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-badge.status-pending {
    background-color: #FFF3CD;
    color: #856404;
}

.status-badge.status-paid {
    background-color: #D1E7DD;
    color: #0F5132;
}

.status-badge.status-processing {
    background-color: #CCE5FF;
    color: #0C63E4;
}

.status-badge.status-shipped {
    background-color: #D7F5FC;
    color: #117A8B;
}

.status-badge.status-delivered {
    background-color: #D4EDDA;
    color: #155724;
}

.status-badge.status-cancelled {
    background-color: #F8D7DA;
    color: #721C24;
}

.order-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.info-value {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.payment-status-pending {
    color: #856404;
}

.payment-status-completed {
    color: #0F5132;
}

.payment-status-failed {
    color: #721C24;
}

.payment-status-refunded {
    color: #0C63E4;
}

.tracking-number {
    display: flex;
    align-items: center;
    gap: 10px;
}

.track-button-small {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background-color 0.3s ease;
}

.track-button-small:hover {
    background-color: #2980b9;
}

@media (max-width: 576px) {
    .order-details-grid {
        grid-template-columns: 1fr;
    }
    
    .info-row {
        margin-bottom: 8px;
    }
}
