/* OneXpress Dispatch — Shared Styles */
:root {
  --blue: #1B75BB;
  --blue-dark: #155f9a;
  --blue-light: #e8f3fc;
  --red: #C0272D;
  --dark: #1a2332;
  --gray-900: #1f2937;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.5;
  font-size: 14px;
}

/* ── Typography ── */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--success); color: var(--white); }
.btn-ghost { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 7px 10px; }

/* ── Form elements ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,117,187,0.15); }
.form-control.error { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-blue { background: var(--blue-light); color: var(--blue-dark); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: var(--blue-light); color: var(--blue-dark); border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Loading spinner ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--blue);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-100);
  background: var(--gray-50);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ── OX Logo component ── */
.ox-logo {
  display: flex;
  align-items: center;
  gap: 0;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.5px;
  line-height: 1;
  text-decoration: none;
}
.ox-logo .ox-one { color: var(--blue); }
.ox-logo .ox-x {
  background: var(--blue);
  color: var(--red);
  padding: 0 3px;
  margin: 0 1px;
  border-radius: 2px;
}
.ox-logo .ox-press { color: var(--blue); }
.ox-logo.on-dark .ox-one,
.ox-logo.on-dark .ox-press { color: var(--white); }
.ox-logo.on-dark .ox-x {
  background: var(--white);
  color: var(--red);
}
.ox-logo-sub {
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  margin-top: 3px;
}

/* ── Tag input (recipient emails) ── */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  min-height: 42px;
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tag-input-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,117,187,0.15); }
.tag-input-wrap.error { border-color: var(--danger); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 2px 8px 2px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.tag-chip button {
  background: none; border: none; cursor: pointer;
  color: var(--blue); font-size: 16px; line-height: 1;
  padding: 0; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
}
.tag-chip button:hover { color: var(--red); }
.tag-input-field {
  border: none; outline: none;
  font-size: 14px; color: var(--gray-900);
  background: transparent;
  flex: 1; min-width: 180px;
}

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}
.dropzone .dz-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.dropzone p { color: var(--gray-500); }
.dropzone strong { color: var(--blue); }

/* ── File item ── */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.file-item:last-child { margin-bottom: 0; }
.file-icon { font-size: 20px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--gray-500); }
.file-remove { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 18px; padding: 0; }
.file-remove:hover { color: var(--danger); }

/* ── Password display ── */
.password-box {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.password-value {
  font-family: 'Courier New', monospace;
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 4px;
  margin: 8px 0 16px;
}
.password-label { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 2px; }

/* ── S3 Browser ── */
.s3-browser {
  display: flex;
  gap: 0;
  height: 440px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.s3-tree {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--gray-200);
  background: var(--gray-50);
  overflow-y: auto;
  padding: 8px 0;
}
.s3-files {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.s3-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-700);
  transition: background 0.1s;
  border-left: 3px solid transparent;
}
.s3-folder:hover { background: var(--gray-100); }
.s3-folder.active { background: var(--blue-light); color: var(--blue); border-left-color: var(--blue); font-weight: 600; }
.s3-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}
.s3-file-row:hover { background: var(--gray-100); }
.s3-file-row.selected { background: var(--blue-light); }
.s3-file-row input[type=checkbox] { flex-shrink: 0; }
.s3-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s3-file-size { font-size: 11px; color: var(--gray-500); flex-shrink: 0; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-500);
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  flex-wrap: wrap;
}
.breadcrumb span { cursor: pointer; color: var(--blue); }
.breadcrumb span:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--gray-300); }

/* ── Step indicator ── */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
}
.step.active { color: var(--blue); }
.step.done { color: var(--success); }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--gray-200);
  color: var(--gray-500);
  flex-shrink: 0;
}
.step.active .step-num { background: var(--blue); color: var(--white); }
.step.done .step-num { background: var(--success); color: var(--white); }
.step-line { flex: 1; height: 1px; background: var(--gray-200); margin: 0 8px; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .s3-browser { flex-direction: column; height: auto; }
  .s3-tree { width: 100%; height: 160px; border-right: none; border-bottom: 1px solid var(--gray-200); }
  .s3-files { min-height: 200px; }
}
