﻿/* Base */
:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --text: #0f172a;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

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

body {
  font-family: "Work Sans", sans-serif;
  background: radial-gradient(circle at top, #1e293b, #0b1120 55%, #020617);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3, .title {
  font-family: "Space Grotesk", sans-serif;
}

.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: block;
}

/* Toast */
.toast {
  position: fixed;
  right: 24px;
  top: 24px;
  background: var(--surface-strong);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all 0.25s ease;
  z-index: 99;
  font-size: 14px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid #ef4444;
}

/* Login */
#login-view {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: -10%;
  z-index: 0;
}

.bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.35;
  filter: blur(2px) saturate(1.1);
}

.layer1 {
  background-image: url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1600&q=60");
  animation: drift 28s linear infinite;
}

.layer2 {
  background-image: url("https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=1600&q=60");
  animation: drift 34s linear infinite reverse;
}

.layer3 {
  background-image: url("https://images.unsplash.com/photo-1483683804023-6ccdb62f86ef?auto=format&fit=crop&w=1600&q=60");
  animation: drift 40s linear infinite;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0.3));
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(420px, 92vw);
  background: var(--surface);
  border-radius: 22px;
  padding: 32px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: floatIn 0.8s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 14px;
}

.brand h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.brand p {
  color: var(--muted);
  font-size: 14px;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

input, select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 15px;
  font-family: "Work Sans", sans-serif;
  background: white;
}

input:focus, select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.3);
  border-color: var(--primary);
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: "Work Sans", sans-serif;
}

button:active {
  transform: scale(0.98);
}

.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.3);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-dark);
}

.ghost {
  background: transparent;
  color: var(--muted);
}

/* App shell */
#app-view {
  padding: 28px 6vw 60px;
  animation: fadeIn 0.6s ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  color: white;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title {
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.7);
}

.user-chip {
  background: rgba(15, 23, 42, 0.6);
  color: white;
  padding: 10px 14px;
  border-radius: 14px;
  text-align: right;
  font-size: 13px;
}

.role {
  color: rgba(148, 163, 184, 0.9);
}

.nav-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.main {
  display: grid;
  gap: 22px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.card {
  background: var(--surface);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.badge {
  background: rgba(15, 23, 42, 0.1);
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.calc-panel {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: rgba(15, 23, 42, 0.04);
  border-radius: 16px;
  padding: 16px;
}

.calc-item {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.calc-item strong {
  font-size: 18px;
}

.calc-item.highlight {
  background: rgba(37, 99, 235, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 18px;
}

.totals {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 20px;
}

.total-card {
  background: rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.tour-list {
  display: grid;
  gap: 12px;
}

.tour-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  border-left: 6px solid rgba(148, 163, 184, 0.5);
  display: grid;
  gap: 8px;
}

.tour-card.paid {
  border-left-color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

.tour-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
}

.tour-meta {
  color: var(--muted);
  font-size: 12px;
}

.tour-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.tiny {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  font-size: 12px;
}

.settings-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.panel {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.inline-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: center;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-card {
  background: white;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.user-card strong {
  font-size: 15px;
}

.user-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto auto;
  align-items: center;
}

.admin-only {
  display: none;
}

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

@keyframes drift {
  0% {
    transform: scale(1) translateX(0);
  }
  50% {
    transform: scale(1.08) translateX(4%);
  }
  100% {
    transform: scale(1) translateX(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  #app-view {
    padding: 20px 16px 50px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .nav-actions {
    overflow-x: auto;
  }

  .user-actions {
    grid-template-columns: 1fr;
  }
}
