/* =========================================================
   ADMIN - ORDERS PAGE STYLES
   ========================================================= */

.orders-wrapper {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.orders-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.orders-main {
  flex: 1;
  min-width: 0;
}

/* --- HEADER --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: #111827;
}

.actions {
  display: flex;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-primary { background-color: #10B981; color: #ffffff; }
.btn-primary:hover { background-color: #059669; }
.btn-outline { background-color: #ffffff; color: #222222; border-color: #E8E8E8; }
.btn-outline:hover { background-color: #F5F5F5; }
.btn-outline-success { background-color: #ffffff; color: #26AA99; border-color: #26AA99; }
.btn-outline-success:hover { background-color: #E9F6F5; }

/* --- FILTER BAR --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background-color: #ffffff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 24px;
  align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 12px; font-weight: 600; color: #111827; }
.filter-group input, .filter-group select {
  padding: 8px 12px; border: 1px solid #E8E8E8; border-radius: 2px;
  font-size: 14px; outline: none; background-color: #ffffff; color: #222222;
}
.filter-group input:focus, .filter-group select:focus { border-color: #10B981; }
.search-group { flex: 1; min-width: 250px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box input { width: 100%; padding-left: 36px; box-sizing: border-box; }
.search-box i { position: absolute; left: 12px; color: #6b7280; }
.date-inputs { display: flex; align-items: center; gap: 8px; }
.date-input-wrap { position: relative; }
.date-input-wrap input { padding-right: 30px; width: 120px; }
.date-input-wrap i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #6b7280; }
.date-inputs span { color: #6b7280; }

/* --- TABLE --- */
.table-responsive {
  background-color: #ffffff; border-radius: 8px; border: 1px solid #e5e7eb;
  overflow-x: auto; margin-bottom: 24px;
}
.orders-table { width: 100%; border-collapse: collapse; text-align: left; }
.orders-table th, .orders-table td { padding: 16px; border-bottom: 1px solid #e5e7eb; font-size: 14px; }
.orders-table th { font-weight: 600; color: #6b7280; background-color: #f9fafb; }
.orders-table tbody tr:hover { background-color: #f9fafb; }
.product-name-col { display: flex; flex-direction: column; gap: 4px; }
.product-name-col strong { color: #111827; font-weight: 500; }
.product-name-col span { font-size: 12px; color: #6b7280; }
.action-btns { display: flex; gap: 8px; }
.btn-icon {
  width: 32px; height: 32px; border-radius: 2px; border: 1px solid #E8E8E8;
  background-color: #ffffff; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: #757575; transition: all 0.2s;
}
.btn-icon:hover { background-color: #F5F5F5; }
.btn-icon.view { color: #10B981; }
.btn-icon.edit { color: #FFB400; }
.btn-icon.delete { color: #10B981; }

/* --- PAGINATION --- */
.pagination-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.display-info { font-size: 14px; color: #6b7280; display: flex; align-items: center; gap: 8px; }
.display-info select { padding: 4px 8px; border: 1px solid #e5e7eb; border-radius: 4px; }
.pagination-controls { display: flex; gap: 4px; }
.btn-page {
  min-width: 32px; height: 32px; border-radius: 2px; border: 1px solid #E8E8E8;
  background-color: #ffffff; color: #222222; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.btn-page:hover { background-color: #F5F5F5; }
.btn-page.active { background-color: #10B981; color: #ffffff; border-color: #10B981; }

/* --- SUMMARY CARDS --- */
.summary-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.summary-card { background-color: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; display: flex; align-items: flex-start; gap: 16px; }
.summary-card .icon { width: 48px; height: 48px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.icon.blue { background-color: #ECFDF5; color: #10B981; }
.icon.green { background-color: #dcfce7; color: #26AA99; }
.icon.red { background-color: #fee2e2; color: #10B981; }
.icon.yellow { background-color: #fef9c3; color: #FFB400; }
.icon.light-blue { background-color: #ECFDF5; color: #10B981; }
.summary-card .info { display: flex; flex-direction: column; }
.summary-card .info span { font-size: 13px; color: #6b7280; font-weight: 500; margin-bottom: 4px; }
.summary-card .info strong { font-size: 24px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.summary-card .info p { font-size: 12px; color: #6b7280; margin: 0; }

/* =========================================================
   DETAILS PANEL (RIGHT SIDEBAR)
   ========================================================= */
.details-panel {
  width: 360px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: none;
  flex-direction: column;
}

.details-panel.active {
  display: flex;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-header h2 { margin: 0; font-size: 16px; font-weight: 600; color: #111827; }
.btn-close { background: none; border: none; font-size: 18px; color: #6b7280; cursor: pointer; padding: 4px; }
.btn-close:hover { color: #111827; }

.panel-body { padding: 20px; flex: 1; }
.panel-footer { padding: 16px 20px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 12px; background-color: #f9fafb; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

.order-top-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-top-info h3 { margin: 0; font-size: 16px; font-weight: 600; color: #111827; }
.order-date-text { font-size: 12px; color: #6b7280; margin: 0 0 20px 0; }
.section-title { font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.info-list { display: flex; flex-direction: column; gap: 10px; background-color: #f9fafb; padding: 14px; border-radius: 6px; }
.info-row { display: flex; gap: 16px; font-size: 13px; }
.info-label { width: 70px; color: #6b7280; font-weight: 500; }
.info-row strong, .info-row span { flex: 1; color: #111827; }
.address-text { line-height: 1.5; }

.order-summary-box { background-color: #f9fafb; padding: 14px; border-radius: 6px; margin-top: 20px; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13px; color: #374151; }
.summary-row:last-child { margin-bottom: 0; }
.summary-row.total { border-top: 1px dashed #e5e7eb; padding-top: 10px; font-size: 15px; font-weight: 700; color: #111827; }
.text-blue { color: #10B981 !important; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: #374151; }
.form-group select, .form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #E8E8E8; border-radius: 2px; font-family: inherit; font-size: 13px; box-sizing: border-box; }
.form-group select:focus, .form-group textarea:focus { border-color: #10B981; outline: none; }


/* =========================================================
   RESPONSIVE — ORDERS PAGE
   ========================================================= */

/* --- Laptop (992px - 1199px) --- */
@media (max-width: 1199px) {
  .orders-wrapper { padding: 20px; }

  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Tablet (768px - 991px) --- */
@media (max-width: 991px) {
  .orders-wrapper { padding: 70px 16px 16px; } /* top: offset menu-toggle */

  /* Summary cards: 3→2 cột */
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Layout: bỏ side-by-side, stack dọc */
  .orders-layout {
    flex-direction: column;
  }

  /* Details panel: full-width khi active */
  .details-panel {
    width: 100%;
    max-width: 100%;
  }

  /* Filter bar */
  .filter-bar {
    padding: 12px;
    gap: 10px;
  }

  .search-group { min-width: 100%; }
  .date-group { width: 100%; }

  /* Table scroll */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .orders-table {
    min-width: 650px;
  }

  /* Page header */
  .page-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .page-title h1 { font-size: 20px; }
}

/* --- Mobile (< 768px) --- */
@media (max-width: 767px) {
  .orders-wrapper { padding: 60px 12px 12px; } /* top: offset menu-toggle */

  /* Summary cards: 2→2 cột (tốt hơn 1 cột cho loại này) */
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .summary-card {
    padding: 12px;
    gap: 10px;
  }

  .summary-card .icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .summary-card .info strong {
    font-size: 18px;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .page-title h1 { font-size: 18px; }
  .actions { width: 100%; justify-content: flex-end; }

  /* Filter */
  .filter-bar { padding: 10px; gap: 8px; margin-bottom: 16px; }
  .filter-group { width: 100%; }
  .filter-group input,
  .filter-group select { width: 100%; box-sizing: border-box; }
  .date-inputs { flex-wrap: wrap; }
  .date-input-wrap input { width: 100%; }

  /* Table */
  .orders-table {
    min-width: 580px;
  }
  .orders-table th,
  .orders-table td {
    padding: 10px 8px;
    font-size: 12px;
  }

  /* Details panel: chiếm full width */
  .details-panel {
    width: 100%;
    border-radius: 8px;
    margin-top: 0;
  }

  /* Pagination */
  .pagination-bar {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
  }

  .pagination-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  .btn-page {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .display-info { font-size: 12px; }
}

/* --- Mobile nhỏ (< 480px) --- */
@media (max-width: 479px) {
  .orders-wrapper { padding: 10px; }

  /* Summary: 1 cột */
  .summary-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .summary-card {
    flex-direction: row;
    align-items: center;
  }

  .page-title h1 { font-size: 16px; }

  .orders-table {
    min-width: 500px;
  }

  .orders-table th,
  .orders-table td {
    padding: 8px 6px;
    font-size: 11px;
  }
}
