:root {
  --giffarine-primary: #005b96;
  --giffarine-secondary: #6497b1;
  --giffarine-light: #b3cde0;
  --giffarine-dark: #03396c;
  --giffarine-accent: #011f4b;
}

body {
  font-family: "Prompt", "Kanit", sans-serif;
  background-color: #f8f9fa;
  color: #333;
}

/* Header Styles */
.giffarine-header {
  background-color: transparent; /* ลบสีพื้นหลังจาก header หลัก */
  color: white;
  box-shadow: none; /* ลบเงา */
  position: sticky;
  top: 20px;
  z-index: 1000;
}

.giffarine-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70%; /* กำหนดความสูงของพื้นหลังเป็น % ของความสูง header */
  background-color: var(--giffarine-primary);
  z-index: -1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 2px 15px; /* ลด padding ด้านบนและล่างเหลือเพียง 2px */
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-back {
  color: white;
  font-size: 1.5rem;
  text-decoration: none;
}

.header-back:hover {
  color: var(--giffarine-light);
}

.header-space {
  width: 24px;
}

/* Order Card Styles */
.order-card {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.order-header {
  background-color: var(--giffarine-light);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-number {
  font-weight: 600;
  color: var(--giffarine-dark);
}

.order-date {
  font-size: 0.9rem;
  color: #666;
}

.order-body {
  padding: 16px;
}

/* Status Styles - ปรับปรุงให้สวยงามขึ้น */
.order-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.order-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 2s infinite;
}

/* สถานะ: รอตรวจสอบ */
.pending-review {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  color: #856404;
  border-color: #ffeaa7;
}

.pending-review::before {
  background-color: #f39c12;
  box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
}

/* สถานะ: กำลังเตรียมสินค้า */
.preparing-item {
  background: linear-gradient(135deg, #d1ecf1 0%, #a8dadc 100%);
  color: #0c5460;
  border-color: #a8dadc;
}

.preparing-item::before {
  background-color: #17a2b8;
  box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.7);
}

/* สถานะ: แพ็คเสร็จรอขนส่งมารับ */
.packed-and-waiting-for-pickup {
  background: linear-gradient(135deg, #cce5ff 0%, #74b9ff 100%);
  color: #004085;
  border-color: #74b9ff;
}

.packed-and-waiting-for-pickup::before {
  background-color: #007bff;
  box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
}

/* สถานะ: ขนส่งรับสินค้าเรียบร้อย */
.picked-up-by-courier {
  background: linear-gradient(135deg, #e2e3ff 0%, #a29bfe 100%);
  color: #5a54a4;
  border-color: #a29bfe;
}

.picked-up-by-courier::before {
  background-color: #6c5ce7;
  box-shadow: 0 0 0 0 rgba(108, 92, 231, 0.7);
}

/* สถานะ: จัดส่งแล้ว */
.status-shipped {
  background: linear-gradient(135deg, #d1e7dd 0%, #00b894 100%);
  color: #0f5132;
  border-color: #00b894;
}

.status-shipped::before {
  background-color: #28a745;
  box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
}

/* สถานะ: ไม่มีสินค้า */
.out-of-stock {
  background: linear-gradient(135deg, #f8d7da 0%, #fd79a8 100%);
  color: #721c24;
  border-color: #fd79a8;
}

.out-of-stock::before {
  background-color: #e84393;
  box-shadow: 0 0 0 0 rgba(232, 67, 147, 0.7);
}

/* สถานะ: ยกเลิกออเดอร์ */
.order-cancelled {
  background: linear-gradient(135deg, #f5f5f5 0%, #636e72 100%);
  color: #2d3436;
  border-color: #636e72;
}

.order-cancelled::before {
  background-color: #636e72;
  box-shadow: 0 0 0 0 rgba(99, 110, 114, 0.7);
}

/* Animation สำหรับ pulse effect */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

/* Tracking Number Styles */
.tracking-info {
  background: linear-gradient(135deg, #e8f4fd 0%, #d4f1f4 100%);
  border-left: 4px solid var(--giffarine-primary);
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tracking-info i {
  color: var(--giffarine-primary);
  font-size: 1.1rem;
}

.tracking-number {
  font-weight: 600;
  color: var(--giffarine-dark);
  font-family: "Courier New", monospace;
  letter-spacing: 1px;
}

.tracking-label {
  color: #666;
  margin-right: 4px;
}

/* เก่า Status Styles - เก็บไว้เป็น backup */
.status-pending {
  background-color: #fff3cd;
  color: #856404;
}

.status-verifying {
  background-color: #d1ecf1;
  color: #0c5460;
}

.status-paid {
  background-color: #d4edda;
  color: #155724;
}

.status-shipping {
  background-color: #cce5ff;
  color: #004085;
}

.status-delivered {
  background-color: #d1e7dd;
  color: #0f5132;
}

.status-cancelled {
  background-color: #f8d7da;
  color: #721c24;
}

.order-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.order-total {
  font-weight: 600;
  color: var(--giffarine-dark);
  font-size: 1.1rem;
}

.order-details-btn {
  background-color: var(--giffarine-primary);
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.order-details-btn:hover {
  background-color: var(--giffarine-dark);
}

/* Product Item Styles */
.product-item {
  display: flex;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.product-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.product-image {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #eee;
  background-color: white;
}

.product-info {
  flex: 1;
  margin-left: 12px;
}

.product-name {
  font-weight: 500;
  margin-bottom: 4px;
  color: #333;
}

.product-price {
  font-size: 0.9rem;
  color: #666;
}

.product-quantity {
  font-size: 0.9rem;
  color: #666;
  margin-left: 8px;
}

/* Modal Styles - ปรับปรุงใหม่เพื่อแก้ปัญหาการเลื่อน */
.modal-header {
  background-color: var(--giffarine-primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-title {
  font-weight: 600;
}

.btn-close {
  color: white;
}

/* Modal Scroll Fix - แก้ปัญหาการเลื่อนใน modal */
.modal-body {
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* สำหรับ iOS */
  padding: 20px;
}

/* ป้องกันการเลื่อนของ body เมื่อ modal เปิด */
.modal-open {
  overflow: hidden;
}

/* ปรับปรุงการแสดงผลของ modal content */
.modal-content {
  border-radius: 10px;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Order Details Modal Styles */
.order-detail-section {
  margin-bottom: 24px;
}

.order-detail-title {
  font-weight: 600;
  color: var(--giffarine-dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--giffarine-light);
}

.detail-row {
  display: flex;
  margin-bottom: 8px;
}

.detail-label {
  width: 140px;
  font-weight: 500;
  color: #666;
}

.detail-value {
  font-weight: 600;
  flex: 1;
}

.detail-value-status {
  font-weight: 600;
  color: #339900;
  flex: 1;
}

.product-list-item {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.product-list-item:last-child {
  border-bottom: none;
}

.product-list-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #eee;
}

.product-list-info {
  flex: 1;
  margin-left: 16px;
}

.product-list-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.product-list-price {
  color: #666;
}

.product-list-quantity {
  color: #666;
}

.product-list-total {
  font-weight: 600;
  color: var(--giffarine-dark);
}

.order-summary-table {
  width: 100%;
  margin-top: 16px;
}

.order-summary-table td {
  padding: 8px 0;
}

.order-summary-table .summary-label {
  text-align: right;
  font-weight: 500;
  color: #666;
}

.order-summary-table .summary-value {
  text-align: right;
  padding-left: 24px;
}

.order-summary-table .grand-total {
  font-weight: 600;
  color: var(--giffarine-dark);
  font-size: 1.1rem;
}

.more-products-link {
  color: var(--giffarine-primary);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.more-products-link:hover {
  text-decoration: underline;
  color: var(--giffarine-dark);
}

/* ปุ่มแสดงรายการเพิ่มเติม */
.show-more-products,
.show-less-products {
  color: var(--giffarine-secondary);
  text-decoration: none;
  cursor: pointer;
}

.show-more-products:hover,
.show-less-products:hover {
  color: var(--giffarine-primary);
  text-decoration: underline;
}

/* รายการสินค้าเพิ่มเติม */
.additional-products {
  border-top: 1px dashed #eee;
  margin-top: 8px;
  padding-top: 8px;
}

/* Responsive Adjustments */
@media (max-width: 576px) {
  .header-title {
    font-size: 1.1rem;
  }

  .order-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-date {
    margin-top: 4px;
  }

  .order-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-total {
    margin-bottom: 12px;
  }

  .detail-row {
    flex-direction: column;
  }

  .detail-label {
    width: 100%;
    margin-bottom: 4px;
  }

  .product-list-item {
    flex-direction: column;
  }

  .product-list-image {
    margin-bottom: 12px;
  }

  .product-list-info {
    margin-left: 0;
  }

  .tracking-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* Modal responsive สำหรับมือถือ */
  .modal-dialog {
    margin: 10px;
    max-width: calc(100% - 20px);
  }

  .modal-body {
    max-height: 70vh;
    padding: 15px;
  }
}
