/* Modern sipariş yönetimi CSS — 22.05.2026 */

/* === Filter bar === */
.op-filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 12px; align-items: center;
}
.op-filter-bar input[type="text"], .op-filter-bar #op-q {
  flex: 1; min-width: 200px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit;
}
.op-filter-bar #op-q { padding-left: 12px; }
.op-filter-bar select, .op-filter-bar input[type="date"] {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; background: white; cursor: pointer; min-width: 110px;
}

/* === Quick chips === */
.op-quick-chips {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 0 2px;
}
.op-chip {
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-hover); color: var(--text-secondary);
  cursor: pointer; user-select: none; border: 1px solid var(--border);
  transition: all 150ms;
}
.op-chip:hover { border-color: var(--primary); color: var(--primary); }
.op-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* === Table === */
.op-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: auto; margin-bottom: 14px;
  max-height: calc(100vh - 380px); min-height: 400px;
}
.op-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.op-table thead {
  position: sticky; top: 0; background: var(--bg); z-index: 5;
  box-shadow: 0 1px 0 var(--border);
}
.op-table th {
  padding: 11px 14px; text-align: left; font-weight: 600;
  font-size: 11.5px; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
.op-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.op-table .op-row { cursor: pointer; transition: background 100ms; }
.op-table .op-row:hover { background: var(--surface-hover); }

.op-id { font-family: ui-monospace, monospace; font-weight: 700; color: var(--primary); }
.op-date { font-size: 12.5px; color: var(--text-secondary); }
.op-city { font-size: 12px; color: var(--text-secondary); max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.op-cust { max-width: 240px; }
.op-cust-name { font-weight: 600; font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; }
.op-cust-sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.op-cust-tel { color: var(--text-secondary); text-decoration: none; }
.op-cust-tel:hover { color: var(--primary); text-decoration: underline; }
.op-items { font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.op-total { font-size: 13.5px; text-align: right; }

/* === Badges === */
.op-status, .op-store {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.op-pay { font-size: 12px; font-weight: 600; }
.op-trk { font-size: 14px; }
.op-trk.late { color: #dc2626; font-weight: 700; }
.op-trk.pending { color: #f59e0b; }
.op-trk.ok { color: #16a34a; font-weight: 600; }

/* === Pagination === */
.op-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 14px 0;
}

/* === Buttons === */
.op-btn {
  padding: 7px 14px; border: 1px solid var(--border);
  background: white; color: var(--text); cursor: pointer;
  border-radius: 8px; font-size: 12.5px; font-weight: 600;
  font-family: inherit; transition: all 150ms; text-decoration: none;
  display: inline-block;
}
.op-btn:hover { border-color: var(--primary); color: var(--primary); }
.op-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.op-btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.op-btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: white; }
.op-btn-ghost { background: transparent; }
.op-btn-sm { padding: 5px 11px; font-size: 11.5px; }

/* === Drawer === */
.op-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity 200ms;
  z-index: 1000;
}
.op-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.op-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 100%; max-width: 540px; background: var(--surface);
  box-shadow: -8px 0 32px rgba(0,0,0,0.15);
  transform: translateX(100%); transition: transform 250ms ease;
  z-index: 1001; overflow: hidden; display: flex; flex-direction: column;
}
.op-drawer.open { transform: translateX(0); }

.op-drawer-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-shrink: 0;
}
.op-drawer-header h2 { margin: 0; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-drawer-close {
  width: 32px; height: 32px; border: none; background: var(--surface-hover);
  border-radius: 50%; cursor: pointer; font-size: 22px; line-height: 1;
  color: var(--text-secondary); flex-shrink: 0;
}
.op-drawer-close:hover { background: #fee2e2; color: #dc2626; }

.op-drawer-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
}

/* === Drawer sections === */
.op-section h3 {
  margin: 0 0 8px; font-size: 11px; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px;
}

.op-customer-card, .op-payment-card, .op-tracking-card, .op-tracking-empty {
  background: var(--bg); padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border);
}
.op-customer-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.op-customer-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.5; }
.op-customer-meta a { color: var(--primary); text-decoration: none; }
.op-customer-meta a:hover { text-decoration: underline; }
.op-customer-addr { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

.op-items-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.op-item-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg); border-radius: 8px;
}
.op-item-img {
  width: 36px; height: 36px; background: var(--surface-hover);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.op-item-info { flex: 1; min-width: 0; }
.op-item-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.op-item-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }
.op-item-meta code { background: var(--surface-hover); padding: 1px 4px; border-radius: 3px; }
.op-item-total { font-size: 13px; font-weight: 700; color: var(--text); flex-shrink: 0; }

.op-totals { padding-top: 10px; border-top: 1px solid var(--border); }
.op-total-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 12.5px;
}
.op-total-row.op-total-grand {
  font-size: 16px; font-weight: 700; padding-top: 8px;
  margin-top: 4px; border-top: 1px solid var(--border); color: var(--primary);
}

.op-tracking-card div[style*="font-family:monospace"] { user-select: all; }
.op-tracking-empty p { margin: 0 0 8px; }

.op-notes-list { display: flex; flex-direction: column; gap: 6px; }
.op-note {
  padding: 10px 12px; border-radius: 8px; font-size: 12px;
  border-left: 3px solid var(--border);
}
.op-note.customer { background: #ecfdf5; border-left-color: #16a34a; }
.op-note.internal { background: var(--bg); border-left-color: var(--text-tertiary); }
.op-note-meta { font-size: 10.5px; color: var(--text-tertiary); margin-bottom: 4px; font-weight: 600; }
.op-note-body { line-height: 1.5; color: var(--text); }
.op-empty { padding: 14px; text-align: center; color: var(--text-tertiary); font-size: 12px; }

.op-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }

/* === Mobile === */
@media (max-width: 900px) {
  .op-filter-bar { padding: 10px; gap: 6px; }
  .op-filter-bar input, .op-filter-bar select { font-size: 16px; }
  .op-table-wrap { max-height: none; }
  .op-table { font-size: 12.5px; }
  .op-table th, .op-table td { padding: 8px 10px; }
  .op-city, .op-items { display: none; }
  .op-drawer { max-width: 100%; }
}
@media (max-width: 600px) {
  .op-table .op-date { display: none; }
}

/* === Kar Hesabı (22.05.2026) === */
.op-profit-card {
  background: var(--bg); padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border);
}
.op-profit-row {
  display: flex; justify-content: space-between;
  padding: 5px 0; font-size: 12.5px;
}
.op-profit-row.op-profit-net {
  font-size: 16px; font-weight: 700; padding-top: 10px;
  margin-top: 6px; border-top: 1px solid var(--border);
}
.op-profit-cell { white-space: nowrap; }
.op-table td.op-profit { text-align: right; font-size: 12.5px; }

/* === Müşteriye Mesaj composer (yan pencere) === */
.op-cust-msg {
  background: transparent; border: none; cursor: pointer; font-size: 13px;
  padding: 0 2px; opacity: 0.6; line-height: 1; vertical-align: middle;
}
.op-cust-msg:hover { opacity: 1; }
.op-msg-drawer { max-width: 460px; }
.op-msg-channels { display: flex; gap: 8px; margin-bottom: 14px; }
.op-msg-ch {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-hover); color: var(--text-secondary); cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.op-msg-ch.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.op-msg-templates { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.op-msg-tpl {
  padding: 5px 11px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 12px;
}
.op-msg-tpl:hover { border-color: var(--primary); color: var(--primary); }
.op-msg-text {
  width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical;
  background: var(--surface); color: var(--text-primary); line-height: 1.5;
}
.op-msg-text:focus { outline: none; border-color: var(--primary); }
.op-msg-hint { font-size: 11.5px; color: var(--text-tertiary); margin: 8px 2px 0; line-height: 1.4; }
.op-msg-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.op-msg-actions .op-btn-primary { margin-left: auto; }
.op-msg-status { margin-top: 12px; font-size: 13px; min-height: 18px; }
.op-msg-ok { color: #16a34a; font-weight: 600; }
.op-msg-err { color: #dc2626; font-weight: 600; }
.op-msg-pending { color: var(--text-secondary); }
.op-msg-newrecip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.op-msg-input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: var(--surface); color: var(--text-primary);
}
.op-msg-input:focus { outline: none; border-color: var(--primary); }
.op-table-wrap ~ * .op-btn-primary, .page-header .op-btn-primary { white-space: nowrap; }

/* === Sipariş Merkezi (fulfillment) === */
.fc-bulkbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.fc-bulkbar b { color: var(--primary); }
.fc-actions { white-space: nowrap; text-align: center; }
.fc-act { background: transparent; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; padding: 4px 9px; font-size: 14px; }
.fc-act:hover { border-color: var(--primary); }
.op-table th input[type=checkbox], .op-table td input[type=checkbox] { cursor: pointer; width: 16px; height: 16px; }
