/* ========================================
   District X - Complete Stylesheet
   ======================================== */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #f0e6ff;
}

body {
  background: #07071a; /* deep space */
  position: relative;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* ---------- SPACE BACKGROUND ---------- */
/* nebula layer - subtle radial gradients */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(76, 0, 130, 0.25) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 100, 150, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(139, 0, 0, 0.15) 0%, transparent 55%);
  animation: nebulaDrift 20s ease-in-out infinite alternate;
  z-index: -2;
  pointer-events: none;
}

@keyframes nebulaDrift {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

/* starfield container - will be filled by JS */
#space-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

/* drifting/twinkling star */
.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: drift var(--drift-duration) linear infinite, twinkle var(--twinkle-duration) ease-in-out infinite;
  opacity: var(--star-opacity, 0.8);
  width: var(--star-size, 2px);
  height: var(--star-size, 2px);
  left: var(--star-x);
  top: var(--star-y);
}

@keyframes drift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(calc(var(--drift-x) * 0.5px), calc(var(--drift-y) * 0.5px)); }
  50% { transform: translate(calc(var(--drift-x) * 1px), calc(var(--drift-y) * 1px)); }
  75% { transform: translate(calc(var(--drift-x) * 0.5px), calc(var(--drift-y) * 0.5px)); }
  100% { transform: translate(0, 0); }
}

@keyframes twinkle {
  0%, 100% { opacity: var(--star-opacity, 0.8); }
  50% { opacity: calc(var(--star-opacity) * 0.3); }
}

/* shooting star - a thin glowing line */
.shooting-star {
  position: absolute;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.8), rgba(255,255,255,1));
  border-radius: 2px;
  transform: rotate(-35deg);
  opacity: 0;
  animation: shoot var(--shoot-duration) linear var(--shoot-delay) infinite;
  left: var(--shoot-x);
  top: var(--shoot-y);
}

@keyframes shoot {
  0% { opacity: 0; transform: translate(0, 0) rotate(-35deg); }
  5% { opacity: 1; }
  15% { opacity: 0; transform: translate(300px, 200px) rotate(-35deg); }
  100% { opacity: 0; transform: translate(300px, 200px) rotate(-35deg); }
}

/* rare meteor - larger, with a trail */
.meteor {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #ff7b42;
  border-radius: 50%;
  box-shadow: 0 0 6px 2px #ff7b42, 0 0 20px 6px #ff4500;
  opacity: 0;
  animation: meteorFall var(--meteor-duration) linear var(--meteor-delay) infinite;
  left: var(--meteor-x);
  top: var(--meteor-y);
}
.meteor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, #ff7b42, transparent);
  transform: translateY(-50%);
}

@keyframes meteorFall {
  0% { opacity: 0; transform: translate(0, 0) rotate(25deg); }
  5% { opacity: 1; }
  20% { opacity: 0; transform: translate(200px, 150px) rotate(25deg); }
  100% { opacity: 0; transform: translate(200px, 150px) rotate(25deg); }
}

/* ---------- MAIN LAYOUT ---------- */
.app-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  max-width: 500px;
  margin: 0 auto;
}

/* card used for forms and info */
.card {
  background: rgba(20, 15, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(156, 92, 230, 0.3);
  border-radius: 16px;
  padding: 30px 24px;
  width: 100%;
  margin: 20px 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ---------- TYPOGRAPHY ---------- */
h1 {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 2px;
  color: #9c5ce6;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(156, 92, 230, 0.5);
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  color: #d0bfff;
}

h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

/* ---------- FORM ELEMENTS ---------- */
label {
  display: block;
  margin-bottom: 6px;
  color: #c0a8ff;
  font-weight: 500;
  font-size: 0.95rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(156, 92, 230, 0.4);
  border-radius: 10px;
  color: white;
  font-size: 1rem;
  outline: none;
  transition: border 0.2s;
  margin-bottom: 18px;
}

input:focus, textarea:focus {
  border-color: #9c5ce6;
  box-shadow: 0 0 8px rgba(156, 92, 230, 0.5);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #9c5ce6;
  margin-right: 8px;
  vertical-align: middle;
}

.checkbox-label {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  cursor: pointer;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: scale(1.03);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #9c5ce6, #6c3cc7);
  color: white;
  box-shadow: 0 4px 15px rgba(156, 92, 230, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #d0bfff;
  border: 1px solid rgba(156, 92, 230, 0.5);
}

.btn-accept {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
}

.btn-decline {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.btn-counter {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

.btn-message {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

.btn-small {
  padding: 8px 18px;
  font-size: 0.9rem;
}

.btn-full {
  width: 100%;
  margin-bottom: 10px;
}

/* ---------- STATUS BADGE ---------- */
.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.1);
}

/* ---------- MESSAGE AREA ---------- */
.messages-container {
  max-height: 300px;
  overflow-y: auto;
  margin: 20px 0;
  padding: 10px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
}

.message-bubble {
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
  font-size: 0.95rem;
}

.message-customer {
  background: rgba(156, 92, 230, 0.3);
  margin-left: auto;
  text-align: right;
  border-bottom-right-radius: 4px;
}

.message-owner {
  background: rgba(255, 107, 107, 0.2);
  margin-right: auto;
  text-align: left;
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-top: 4px;
}

/* ---------- ARCHIVED ORDERS ---------- */
.archived-section {
  margin-top: 20px;
  width: 100%;
}

.archived-order summary {
  cursor: pointer;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  font-weight: 600;
  list-style: none;
}

.archived-order summary::-webkit-details-marker {
  display: none;
}

.archived-order .details-content {
  padding: 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 0 0 10px 10px;
  font-size: 0.9rem;
}

/* ---------- ANIMATED SPACESHIP ---------- */
.spaceship {
  cursor: pointer;
  width: 80px;
  height: 80px;
  margin: 20px auto;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,10 20,80 50,70 80,80" fill="%239c5ce6"/><polygon points="35,50 50,70 65,50" fill="%23ff6b6b"/><circle cx="50" cy="40" r="8" fill="%23ffffff"/></svg>') no-repeat center/contain;
  transition: transform 0.3s;
}

.spaceship.launching {
  animation: launch 1s ease-out forwards;
}

@keyframes launch {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.2); }
  100% { transform: translateY(-80px) scale(0.3); opacity: 0; }
}

/* ---------- UTILITY ---------- */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

/* scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
}
::-webkit-scrollbar-thumb {
  background: #9c5ce6;
  border-radius: 3px;
}