/* ── Reset & Variables ──────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --bg-secondary: #111118;
  --card-bg: rgba(17, 17, 24, 0.8);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #e4e4e7;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Utility ───────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; }

.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.nav-username {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-logout {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  padding: 0.3rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-logout:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* ── Welcome ───────────────────────────────────────────────── */
.welcome-section {
  margin-bottom: 2rem;
}

.welcome-section h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.welcome-section p {
  font-size: 0.9rem;
}

/* ── Service Cards ─────────────────────────────────────────── */
.services-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.service-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.service-card:hover {
  border-color: var(--border-hover);
}

.service-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.service-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.service-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.service-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Usage Bar ─────────────────────────────────────────────── */
.usage-bar-container {
  margin-bottom: 1rem;
}

.usage-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.usage-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Form ──────────────────────────────────────────────────── */
.input-group {
  display: flex;
  gap: 0.5rem;
}

.input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

/* ── Order Feedback ────────────────────────────────────────── */
.order-feedback {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.order-feedback.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.order-feedback.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--error);
}

/* ── Cooldown Timer ────────────────────────────────────────── */
.cooldown-timer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--warning);
}

/* ── Orders Page ───────────────────────────────────────────── */
.orders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.orders-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.orders-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.orders-table td {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.orders-table tbody tr:last-child td {
  border-bottom: none;
}

.orders-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.target-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Status Badges ─────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-processing {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.status-completed {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.status-canceled,
.status-cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.status-in-progress {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

.status-partial {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.status-pending {
  background: rgba(113, 113, 122, 0.15);
  color: var(--text-muted);
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  z-index: 200;
}

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

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-username { display: none; }

  .input-group {
    flex-direction: column;
  }

  .orders-table-wrap {
    overflow-x: auto;
  }

  .features {
    flex-direction: column;
    gap: 1rem;
  }
}
