/* Dashboard — StitchCraftOS */

/* Nav */
.dash-body {
  background: var(--bg);
  min-height: 100vh;
}

.dash-nav {
  background: var(--bg-deep);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--fg-light);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand em {
  font-style: italic;
  color: var(--accent-soft);
}

.nav-label {
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(250,247,242,0.4);
}

/* Layout */
.dash-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Summary cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.2s ease;
}

.summary-card:hover {
  box-shadow: 0 4px 20px rgba(44,36,32,0.06);
}

.summary-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.summary-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.summary-title {
  font-size: 0.78rem;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

/* Sections */
.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}

/* Forms */
.add-order-section {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
}

.order-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}

.form-group-wide {
  flex: 2;
  min-width: 240px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group input,
.form-group select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196,112,75,0.12);
}

.form-group input::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: var(--fg-light);
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

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

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-ghost:hover {
  background: var(--bg-warm);
}

/* Orders section */
.orders-section {
  display: flex;
  flex-direction: column;
}

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

.orders-header .section-title {
  margin-bottom: 0;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fg-light);
}

/* Table */
.orders-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.orders-table thead th {
  background: var(--bg-warm);
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.orders-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

.orders-table tbody tr:last-child {
  border-bottom: none;
}

.orders-table tbody tr:hover {
  background: var(--bg-warm);
}

.orders-table tbody td {
  padding: 14px;
  color: var(--fg);
  vertical-align: middle;
}

.order-id {
  color: var(--fg-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.order-customer {
  font-weight: 600;
}

.order-product {
  color: var(--fg-muted);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-price {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.order-date {
  color: var(--fg-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.order-notes {
  color: var(--fg-muted);
  font-size: 0.85rem;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status badge */
.status-select {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 100px;
  padding: 4px 10px;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237A6E64'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}

.status-pending    { background: #FEF3E2; color: #B45309; border-color: #FDE68A; }
.status-in-progress { background: #EDE9FE; color: #6D28D9; border-color: #DDD6FE; }
.status-shipped    { background: #E0F2FE; color: #0369A1; border-color: #BAE6FD; }
.status-delivered  { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }

/* Row actions */
.row-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.orders-table tbody tr:hover .row-actions {
  opacity: 1;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.88rem;
  transition: background 0.15s ease;
  color: var(--fg-muted);
}

.action-btn:hover {
  background: var(--border);
  color: var(--fg);
}

.action-btn.delete:hover {
  background: #FEE2E2;
  color: #DC2626;
}

/* Empty state */
.orders-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-warm);
}

.empty-icon {
  font-size: 2.4rem;
}

.orders-empty p {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,36,32,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 24px 80px rgba(44,36,32,0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--fg-muted);
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-warm);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg);
  color: var(--fg-light);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 300;
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { background: #166534; }
.toast.error   { background: #DC2626; }

/* Utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 640px) {
  .dash-wrap {
    padding: 20px 16px 60px;
    gap: 24px;
  }

  .summary-cards {
    grid-template-columns: 1fr 1fr;
  }

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

  .add-order-section {
    padding: 20px 16px;
  }

  .orders-table thead th:nth-child(7),
  .orders-table tbody td:nth-child(7) {
    /* hide notes on small screens */
    display: none;
  }

  .row-actions {
    opacity: 1;
  }
}

@media (max-width: 400px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }
}
