/* Customs Portal — shared theme (matches backend dashboard palette) */
:root {
  --cp-bg: #060918;
  --cp-bg2: #0d1f35;
  --cp-navy: #122640;
  --cp-blue: #1e5fa8;
  --cp-blue2: #2575c4;
  --cp-teal: #00d4aa;
  --cp-teal2: #0e9d82;
  --cp-indigo: #18135e;
  --cp-rose: #f43f5e;
  --cp-amber: #eab308;
  --cp-white: #ffffff;
  --cp-muted: #8a99ae;
  --cp-border: rgba(255, 255, 255, 0.1);
  --cp-glass: rgba(255, 255, 255, 0.06);
  --cp-glass2: rgba(255, 255, 255, 0.1);
  --cp-text: #e8edf5;
  --cp-sub: #a8b5c8;
  --cp-radius: 16px;
  --cp-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --cp-font-ar: 'Segoe UI', Tahoma, Arial, sans-serif;
  --cp-mono: 'JetBrains Mono', monospace;
}

.cp-root {
  font-family: var(--cp-font);
  background: var(--cp-bg);
  min-height: 100vh;
  color: var(--cp-text);
  position: relative;
  overflow-x: hidden;
}

.cp-root::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 15%, rgba(0, 212, 170, 0.16) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(24, 19, 94, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 85%, rgba(30, 95, 168, 0.14) 0%, transparent 55%),
    linear-gradient(165deg, #060918 0%, #0a1929 50%, #0d1f35 100%);
  animation: cpMesh 14s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

.cp-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(24, 19, 94, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 19, 94, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: cpGridDrift 22s linear infinite;
}

@keyframes cpMesh {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.92; transform: scale(1.03); }
}

@keyframes cpGridDrift {
  0% { background-position: 0 0; }
  100% { background-position: 48px 48px; }
}

@keyframes cpFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes cpPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes cpSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cpShipMove {
  0% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  100% { transform: translateX(-8px); }
}

.cp-wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.cp-glass {
  background: var(--cp-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--cp-border);
  border-radius: var(--cp-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

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

.cp-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.cp-logo-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 8px 24px rgba(0, 212, 170, 0.25);
}

.cp-logo-image {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 31, 103, 0.35);
}

.cp-logo strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.cp-logo span {
  font-size: 11px;
  color: var(--cp-muted);
  font-family: var(--cp-font-ar);
}

.cp-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 212, 170, 0.12);
  border: 1px solid rgba(0, 212, 170, 0.28);
  color: var(--cp-teal);
}

.cp-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cp-teal);
  animation: cpPulse 2s ease-in-out infinite;
}

/* Login hero */
.cp-login-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .cp-login-grid { grid-template-columns: 1fr; }
}

.cp-hero {
  padding: 36px;
  animation: cpSlideUp 0.6s ease;
}

.cp-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin: 0 0 12px;
}

.cp-hero h1 .grad {
  background: linear-gradient(135deg, #4da8ff, var(--cp-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cp-hero .ar {
  font-family: var(--cp-font-ar);
  font-size: 18px;
  color: var(--cp-muted);
  direction: rtl;
  margin-bottom: 24px;
}

.cp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 28px;
}

@media (max-width: 600px) {
  .cp-stats { grid-template-columns: 1fr; }
}

.cp-stat {
  padding: 18px;
  text-align: center;
  transition: transform 0.25s, box-shadow 0.25s;
}

.cp-stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.cp-stat .n {
  font-size: 26px;
  font-weight: 800;
  color: var(--cp-teal);
}

.cp-stat .l {
  font-size: 11px;
  color: var(--cp-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Animated logistics scene */
.cp-scene {
  position: relative;
  min-height: 280px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: var(--cp-radius);
  border: 1px solid var(--cp-border);
  background: rgba(0, 0, 0, 0.2);
}

.cp-scene-route {
  position: absolute;
  bottom: 42%;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cp-teal), var(--cp-indigo), transparent);
  opacity: 0.5;
}

.cp-scene-route::after {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  width: 40%;
  height: 8px;
  background: linear-gradient(90deg, transparent, var(--cp-teal), transparent);
  animation: cpRoutePulse 3s ease-in-out infinite;
}

@keyframes cpRoutePulse {
  0% { left: 0; opacity: 0; }
  30% { opacity: 1; }
  100% { left: 65%; opacity: 0; }
}

.cp-icon-float {
  position: absolute;
  font-size: 32px;
  animation: cpFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.cp-icon-float.ship { bottom: 48%; left: 12%; animation-delay: 0s; }
.cp-icon-float.truck { bottom: 22%; left: 45%; font-size: 28px; animation-delay: 0.8s; }
.cp-icon-float.container { bottom: 55%; right: 18%; font-size: 36px; animation-delay: 1.2s; }
.cp-icon-float.plane { top: 18%; right: 22%; font-size: 26px; animation-delay: 0.4s; animation-name: cpShipMove; }

/* Login card */
.cp-login-card {
  padding: 36px;
  animation: cpSlideUp 0.7s ease 0.1s both;
}

.cp-login-card h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
}

.cp-login-card .sub {
  color: var(--cp-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.cp-field {
  margin-bottom: 16px;
}

.cp-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--cp-sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.cp-field input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.25);
  border: 1.5px solid var(--cp-border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--cp-text);
  font-family: var(--cp-font);
  font-size: 14px;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

.cp-field input:focus {
  border-color: var(--cp-teal);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.cp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-family: var(--cp-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.cp-btn-primary {
  background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal));
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 212, 170, 0.3);
  margin-top: 8px;
}

.cp-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 212, 170, 0.4);
  color: #fff;
}

.cp-btn-ghost {
  background: transparent;
  border: 1.5px solid var(--cp-border);
  color: var(--cp-sub);
  margin-top: 10px;
}

.cp-btn-ghost:hover {
  border-color: var(--cp-teal);
  color: var(--cp-teal);
}

.cp-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--cp-muted);
  font-size: 12px;
}

.cp-divider::before,
.cp-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cp-border);
}

.cp-alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.cp-alert-error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

/* Tracking dashboard */
.cp-track-header {
  margin-bottom: 28px;
  animation: cpSlideUp 0.5s ease;
}

.cp-track-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 6px;
}

.cp-shipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.cp-ship-card {
  padding: 22px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  animation: cpSlideUp 0.5s ease both;
  text-decoration: none;
  color: inherit;
  display: block;
}

.cp-ship-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 212, 170, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  color: inherit;
}

.cp-ship-ref {
  font-family: var(--cp-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--cp-teal);
}

.cp-ship-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  font-size: 12px;
}

.cp-ship-meta .k { color: var(--cp-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.cp-ship-meta .v { color: var(--cp-text); font-weight: 600; }

.cp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 12px;
}

.cp-status-pill.draft { background: rgba(30, 95, 168, 0.2); color: #7ab3f0; }
.cp-status-pill.confirmed { background: rgba(0, 212, 170, 0.15); color: var(--cp-teal); }
.cp-status-pill.done { background: rgba(26, 107, 53, 0.2); color: #6ee7b7; }
.cp-status-pill.cancelled { background: rgba(244, 63, 94, 0.15); color: #fda4af; }

/* Detail / timeline */
.cp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
}

@media (max-width: 960px) {
  .cp-detail-grid { grid-template-columns: 1fr; }
}

.cp-timeline {
  padding: 28px;
}

.cp-timeline h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 22px;
}

.cp-tl-item {
  display: flex;
  gap: 14px;
  padding-bottom: 22px;
  position: relative;
}

.cp-tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--cp-border);
}

.cp-tl-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--cp-border);
  z-index: 1;
}

.cp-tl-item.done .cp-tl-dot {
  background: rgba(0, 212, 170, 0.2);
  border-color: var(--cp-teal);
}

.cp-tl-item.active .cp-tl-dot {
  background: linear-gradient(135deg, var(--cp-blue), var(--cp-teal));
  border-color: transparent;
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.4);
  animation: cpPulse 2s ease-in-out infinite;
}

.cp-tl-title { font-weight: 700; font-size: 14px; }
.cp-tl-sub { font-size: 12px; color: var(--cp-muted); margin-top: 2px; }

.cp-map-box {
  padding: 24px;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.cp-map-visual {
  height: 160px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 60%, rgba(0, 212, 170, 0.15), transparent 50%),
    radial-gradient(circle at 70% 40%, rgba(24, 19, 94, 0.12), transparent 50%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
  border: 1px solid var(--cp-border);
  position: relative;
}

.cp-map-pin {
  position: absolute;
  font-size: 20px;
  animation: cpFloat 3s ease-in-out infinite;
}

.cp-map-pin.origin { left: 18%; top: 55%; }
.cp-map-pin.dest { right: 20%; top: 35%; animation-delay: 0.6s; }

.cp-map-line {
  position: absolute;
  top: 48%;
  left: 22%;
  right: 24%;
  height: 2px;
  background: linear-gradient(90deg, var(--cp-teal), var(--cp-indigo));
  opacity: 0.6;
}

.cp-info-card {
  padding: 22px;
  margin-bottom: 18px;
}

.cp-info-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--cp-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 14px;
}

.cp-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--cp-border);
  font-size: 13px;
}

.cp-info-row:last-child { border: none; }
.cp-info-row .k { color: var(--cp-muted); }
.cp-info-row .v { font-weight: 600; text-align: right; max-width: 58%; }

.cp-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 16px;
}

.cp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cp-blue), var(--cp-teal));
  border-radius: 3px;
  transition: width 1s ease;
}

.cp-container-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(24, 19, 94, 0.12);
  border: 1px solid rgba(24, 19, 94, 0.25);
  border-radius: 8px;
  font-family: var(--cp-mono);
  font-size: 12px;
  margin: 4px 4px 0 0;
}

.cp-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--cp-muted);
}

.cp-empty .ico { font-size: 48px; margin-bottom: 12px; }
