:root {
  --bg-color: #0b1120;
  --panel-bg: rgba(30, 41, 59, 0.4);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-color: #903;
  --accent-hover: #7b0029;
  --success-color: #10b981;
  --ring-color: rgba(153, 0, 51, 0.3);
  
  --step-inactive: #334155;
  --step-active: var(--accent-color);
  --step-done: var(--success-color);
  --font-family: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Background mesh / ambient light effect */
.background-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 15% 50%, rgba(153, 0, 51, 0.08), transparent 40%),
              radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05), transparent 40%);
  animation: pulse-ambient 15s infinite alternate;
}

@keyframes pulse-ambient {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

.app-container {
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  z-index: 1;
}

.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fade-in-down 0.8s ease-out forwards;
}

.logo-wrapper {
  display: inline-block;
  background-color: #ffffff;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.brand-logo {
  max-width: 280px;
  height: auto;
  display: block;
}

.brand-subtitle {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-top: 0.2rem;
}

/* Glassmorphism Card */
.tracker-card {
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: slide-up-fade 0.8s ease-out 0.2s forwards;
  opacity: 0;
  transform: translateY(20px);
}

.tracker-intro {
  margin-bottom: 2rem;
  text-align: center;
}

.tracker-intro h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.tracker-intro p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Form Styles */
.tracking-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group {
  position: relative;
}

.input-group label {
  position: absolute;
  left: 1rem;
  top: 1.15rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  transition: all 0.2s ease;
  background: transparent;
  padding: 0 0.2rem;
  z-index: 10;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label,
.input-group textarea:not(:empty) + label {
  top: 0.45rem;
  font-size: 0.75rem;
  color: var(--accent-color);
  font-weight: 600;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 1.6rem 1rem 0.6rem;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.input-group textarea {
  min-height: 80px;
  resize: vertical;
}

.input-group input::placeholder {
  color: transparent; /* hide placeholder to use animated label */
}

.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(15, 23, 42, 0.8) !important;
  box-shadow: 0 0 0 3px var(--ring-color);
}

/* Removed redundant block */

.btn-primary {
  background: var(--accent-color);
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 1.2rem;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px var(--ring-color);
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Result Area */
.result-container {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px dashed rgba(255,255,255,0.1);
  animation: fade-in 0.5s ease-out forwards;
}

.result-container.hidden {
  display: none;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.result-invoice {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-invoice strong {
  color: var(--text-main);
  font-size: 1.1rem;
}

.result-status-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 15px;
  width: 2px;
  background: var(--step-inactive);
  z-index: 0;
}

.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
  opacity: 0.5;
  transition: all 0.4s ease;
}

.timeline-step.active, .timeline-step.done {
  opacity: 1;
}

.step-indicator {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-color);
  border: 2px solid var(--step-inactive);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
}

.step-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s ease;
}

.timeline-step.done .step-indicator {
  border-color: var(--success-color);
  background: var(--success-color);
  color: #fff;
}

.timeline-step.done .step-icon {
  opacity: 1;
  transform: scale(1);
}

.timeline-step.active .step-indicator {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--ring-color);
  background: var(--bg-color);
}

.step-content h3 {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  padding-top: 5px;
}

.step-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-step.active .step-content h3 {
  color: var(--accent-color);
  font-weight: 600;
}

/* Error message */
.error-message {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  font-size: 0.95rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Hints */
.hint-container {
  margin-top: 1.5rem;
  text-align: center;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.6;
}

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

@keyframes fade-in-down {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up-fade {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .app-container { padding: 1rem; }
  .tracker-card { padding: 1.5rem; }
  .brand-logo { max-width: 220px; }
}

/* --- Admin Panel --- */
.admin-container {
  max-width: 98%;
  width: 100%;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-section-header svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

@media (max-width: 1100px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.admin-card {
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
}

.admin-card h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
}

.mt-2 {
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.full-width {
  flex: 1 1 100%;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.admin-form .input-group, .admin-form .form-group {
  flex: 1 1 calc(50% - 1.5rem);
  min-width: 250px;
}

.form-input {
  width: 100%;
  padding: 1.25rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 1.05rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: var(--accent-color);
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-color);
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}

/* Orders Table */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 600px;
}

.orders-table th, .orders-table td {
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.orders-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge-small {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

.status-badge-small.status-1 { background: rgba(59, 130, 246, 0.15); color: #60a5fa; } /* Blue - Received */
.status-badge-small.status-2 { background: rgba(251, 191, 36, 0.15); color: #fbbf24; } /* Yellow - Processing */
.status-badge-small.status-3 { background: rgba(16, 185, 129, 0.15); color: #34d399; } /* Greenish - Shipping */
.status-badge-small.status-4 { background: var(--ring-color); color: var(--accent-color); } /* Theme Color - Done */

.truncate {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.action-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.05);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-right: 0.5rem;
  transition: all 0.2s;
  font-family: inherit;
}

.action-btn:hover {
  background: rgba(255,255,255,0.2);
}

.action-btn.delete {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.2);
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.25);
}

.back-link-container {
  text-align: center;
  margin-top: 2rem;
}

.back-link {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 0.95rem;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Custom Notice box for customer view */
.custom-notice {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: #fef08a;
  padding: 1.25rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.5;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  animation: fade-in 0.5s ease-out forwards;
}

.custom-notice svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
