/* =========================
   FILE: my-orders.css
   FULL ERP STYLE
========================= */

:root {
  --primary: #108082;
  --primary-dark: #0b6668;
  --secondary: #323232;

  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #2563eb;

  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  font-family: Arial, sans-serif;
  color: var(--text);
}

.main-content {
  padding: 25px;
}

/* TOPBAR */

.topbar {
  background: var(--card);
  padding: 22px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: 26px;
  margin-bottom: 6px;
  color: var(--text);
}

.topbar p {
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* BUTTONS */

.btn {
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition: 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.secondary {
  background: #f3f4f6;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.warning {
  background: var(--warning);
  color: #fff;
}

.btn.delete,
.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.light {
  background: #eef2f7;
  color: var(--text);
}

.btn.danger-light {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* STATS */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--card);
  padding: 22px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-card h3 {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 5px;
}

.stat-card p {
  color: var(--muted);
  font-size: 14px;
}

/* SECTION */

.section-card {
  background: var(--card);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-header h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.section-header p {
  color: var(--muted);
  font-size: 13px;
}

/* FILTERS */

.order-filters {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px;
}

.filter-input,
.filter-select {
  width: 100%;
  height: 42px;
  padding: 10px 13px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: 0.2s;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 128, 130, 0.12);
}

.filter-input::placeholder {
  color: #9ca3af;
}

/* TABLE */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

thead {
  background: #f1f5f9;
}

th {
  padding: 15px 14px;
  text-align: left;
  color: #374151;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover {
  background: #f9fafb;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 35px !important;
  font-size: 14px;
}

/* ACTION BUTTONS */

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* BADGES */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge.info {
  background: #dbeafe;
  color: #1e40af;
}

/* MOBILE ORDERS */

.mobile-orders {
  display: none;
}

.mobile-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.mobile-card h3 {
  font-size: 17px;
  margin-bottom: 12px;
  color: var(--primary);
}

.mobile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.mobile-row span {
  color: var(--muted);
}

.mobile-row b {
  text-align: right;
}

/* MODAL */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.modal-modern {
  width: min(900px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  animation: modalFade 0.25s ease;
}

.large-modal {
  width: min(1200px, 100%);
}

.small-modal {
  width: min(460px, 100%);
}

@keyframes modalFade {
  from {
    transform: translateY(12px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}

.modal-title span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
  color: var(--muted);
}

.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
}

.modal-body {
  padding-top: 4px;
}

.modal-section-title {
  margin: 18px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--primary);
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* MODAL GRID */

.modal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.field {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  transition: 0.2s;
}

.field:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

.field.wide {
  grid-column: span 2;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 7px;
}

.value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

/* PDF */

.field.pdf {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.pdf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pdf-row span {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
}

.btn-view {
  background: var(--info);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-view:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
}

/* ADMIN / DELETE MODAL */

.admin-unlock-body,
.delete-body {
  padding: 10px 2px 2px;
}

.admin-unlock-body .field {
  background: #fff;
}

.admin-unlock-body input {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
}

.admin-unlock-body input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 128, 130, 0.12);
}

.delete-body p {
  color: #374151;
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* FOOTER */

.footer {
  margin-top: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* SCROLLBAR */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 50px;
}

/* RESPONSIVE */

@media (max-width: 1200px) {
  .modal-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .order-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-card {
    padding: 16px;
  }

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

  .order-filters {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    display: none;
  }

  .mobile-orders {
    display: block;
  }

  .modal-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field.wide {
    grid-column: span 2;
  }
}

@media (max-width: 540px) {
  .topbar h1 {
    font-size: 22px;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .topbar-actions .btn,
  .btn {
    width: 100%;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-modern {
    padding: 18px;
    border-radius: 14px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .field.wide {
    grid-column: span 1;
  }

  .pdf-row {
    align-items: flex-start;
  }

  .btn-view {
    width: 100%;
    justify-content: center;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }
}
/* =========================
   EXTRA CSS FOR PAGINATION + NEW FILTERS
   Add this at bottom of my-orders.css
========================= */

/* Better filter layout after extra filters */
.order-filters {
  grid-template-columns: 2fr repeat(4, 1fr) auto;
}

.filter-select.dynamic-filter {
  min-width: 160px;
}

/* Wider table for new columns */
table {
  min-width: 1250px;
}

th:first-child,
td:first-child {
  text-align: center;
  width: 70px;
}

/* Pagination Footer */
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 0 4px;
}

.pagination-info {
  font-size: 14px;
  color: #475569;
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 38px;
  height: 36px;
  border: 1px solid #d7dee8;
  background: #fff;
  border-radius: 10px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 12px;
  transition: 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: #f1f5f9;
}

.read-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eefdf3;
  color: #067a35;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #c8f7d8;
  margin-left: 8px;
}

.orders-mini-note {
  width: 100%;
  font-size: 12px;
  color: #64748b;
  margin-top: 5px;
}

/* Better action button size in wide table */
.action-buttons .btn {
  padding: 9px 12px;
}

/* Mobile pagination */
@media (max-width: 1200px) {
  .order-filters {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .pagination-footer {
    align-items: stretch;
  }

  .pagination-info,
  .pagination-controls {
    width: 100%;
  }

  .pagination-controls {
    justify-content: center;
  }

  .page-btn {
    flex: 1;
    min-width: 42px;
  }

  .read-chip {
    margin-left: 0;
    margin-top: 6px;
  }

  .order-filters {
    grid-template-columns: 1fr;
  }
}

/* =========================
   PROFESSIONAL FILTER PANEL
========================= */

.filters-panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid #dbe4ee;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.filters-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #22c1c3);
}

.filters-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e8edf3;
}

.filters-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filters-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 8px 18px rgba(16, 128, 130, 0.22);
}

.filters-title-wrap h3 {
  margin: 0 0 3px;
  font-size: 16px;
  color: #0f172a;
}

.filters-title-wrap p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.filters-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #ccfbf1;
  border-radius: 999px;
  color: #0f766e;
  background: #f0fdfa;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.filters-panel .order-filters {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.search-field-wrap {
  position: relative;
  grid-column: span 4;
  min-width: 0;
}

/* First row: search + quotation + executive + date + payment. */
.filters-panel .order-filters > :nth-child(2),
.filters-panel .order-filters > :nth-child(3),
.filters-panel .order-filters > :nth-child(4),
.filters-panel .order-filters > :nth-child(5) {
  grid-column: span 2;
}

/* Second row: workflow + customer type + city + reset. */
.filters-panel .order-filters > :nth-child(n + 6) {
  grid-column: span 3;
}

.search-field-wrap > i {
  position: absolute;
  top: 50%;
  left: 15px;
  z-index: 1;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.filters-panel .filter-input,
.filters-panel .filter-select {
  height: 46px;
  border-color: #d7e0ea;
  border-radius: 11px;
  background-color: #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.025);
}

.filters-panel .filter-input:hover,
.filters-panel .filter-select:hover {
  border-color: #a8b7c8;
}

.filters-panel .search-filter-input {
  padding-left: 43px;
}

.filters-panel .filter-select.dynamic-filter {
  min-width: 0;
}

.filter-reset-btn {
  min-height: 46px;
  border: 1px solid #fecaca;
  color: #b91c1c;
  background: #fff7f7;
}

.filter-reset-btn:hover {
  border-color: #fca5a5;
  color: #991b1b;
  background: #fee2e2;
}

.filters-panel input:-webkit-autofill,
.filters-panel input:-webkit-autofill:hover,
.filters-panel input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
  transition: background-color 9999s ease-out;
}

@media (max-width: 1200px) {
  .filters-panel .order-filters {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .search-field-wrap {
    grid-column: span 4;
  }
}

@media (max-width: 900px) {
  .filters-panel .order-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-field-wrap,
  .filters-panel .order-filters > :nth-child(2),
  .filters-panel .order-filters > :nth-child(3),
  .filters-panel .order-filters > :nth-child(4),
  .filters-panel .order-filters > :nth-child(5),
  .filters-panel .order-filters > :nth-child(n + 6) {
    grid-column: span 1;
  }

  .search-field-wrap {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .filters-panel {
    padding: 15px;
  }

  .filters-panel-heading {
    align-items: flex-start;
  }

  .filters-hint {
    display: none;
  }

  .filters-panel .order-filters {
    grid-template-columns: 1fr;
  }

  .search-field-wrap {
    grid-column: span 1;
  }

  .filters-panel .order-filters > :nth-child(2),
  .filters-panel .order-filters > :nth-child(3),
  .filters-panel .order-filters > :nth-child(4),
  .filters-panel .order-filters > :nth-child(5),
  .filters-panel .order-filters > :nth-child(n + 6) {
    grid-column: span 1;
  }
}

@media (max-width: 540px) {
  .filters-title-wrap p {
    display: none;
  }
}
