/* SimStudio Master Design System & Dark Glassmorphism Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --card: rgba(255, 255, 255, 0.85);
  --card-solid: #ffffff;
  --muted: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.08);
  --border-bright: rgba(0, 0, 0, 0.16);
  --accent: #4f46e5;
  --accent-hover: #3730a3;
  --accent-glow: rgba(79, 70, 229, 0.15);
  --amber: #d97706;
  --red: #dc2626;
  --green: #059669;
  --white: #0f172a;
  --text-dim: #334155;
  --text-muted: #64748b;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Outfit', 'Inter', sans-serif;

  --shadow-accent: 0 4px 20px rgba(79, 70, 229, 0.15);
  --shadow-red: 0 4px 20px rgba(220, 38, 38, 0.15);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.06);
  --border-default: 1px solid var(--border);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--white);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(79, 70, 229, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 90% 90%, rgba(5, 150, 105, 0.03) 0%, transparent 45%);
  padding-bottom: 80px; /* Space for mobile nav bar */
}

@media (min-width: 769px) {
  body {
    padding-bottom: 0;
  }
}

.mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-dim { color: var(--text-dim); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* Desktop Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (min-width: 769px) {
  .navbar {
    padding: 16px 32px;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
}

@media (min-width: 769px) {
  .wordmark {
    font-size: 22px;
  }
}

.badge-role {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.badge-role.admin {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-role.user {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (min-width: 769px) {
  .nav-links {
    gap: 24px;
  }
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--white);
}

/* Mobile Bottom Navigation Bar */
.mobile-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 200;
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}

.mobile-nav-item.active {
  color: var(--accent);
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

/* Layout Container */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
}

@media (min-width: 769px) {
  .main-container {
    padding: 32px 24px;
  }
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 769px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
  }
}

.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

@media (min-width: 769px) {
  .page-title {
    font-size: 28px;
  }
}

.page-subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

/* Glass Cards */
.card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: var(--border-default);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

@media (min-width: 769px) {
  .card {
    padding: 24px;
    margin-bottom: 24px;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

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

@media (min-width: 769px) {
  .card-title {
    font-size: 18px;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 44px; /* Touch friendly */
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:active, .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--muted);
  color: var(--white);
  border: 1px solid var(--border);
}

.btn-secondary:active, .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-bright);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  min-height: 36px;
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color 0.2s ease;
  min-height: 46px; /* Touch friendly */
}

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

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 12px 14px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Grid System - Mobile First Defaults */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid { gap: 24px; }
  .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Specific Layout Helpers */
.layout-span-2 {
  grid-column: span 1;
}

@media (min-width: 1024px) {
  .layout-span-2 {
    grid-column: span 2;
  }
}

.layout-span-3 {
  grid-column: span 1;
}

@media (min-width: 1024px) {
  .layout-span-3 {
    grid-column: span 3;
  }
}

/* Metric & Score Cards */
.score-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.score-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
}

@media (min-width: 769px) {
  .score-value {
    font-size: 32px;
  }
}

.score-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Siri-style Buyer Orb */
.siri-orb-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.siri-orb {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #a855f7, #6366f1, #3b82f6);
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.6);
  animation: pulse-orb 3s infinite ease-in-out;
}

.siri-orb.buyer-orb-compact {
  width: 52px;
  height: 52px;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.5);
}

@media (min-width: 769px) {
  .siri-orb:not(.buyer-orb-compact) {
    width: 120px;
    height: 120px;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
  }
}

.siri-orb.speaking {
  animation: speak-orb 0.8s infinite alternate ease-in-out;
  box-shadow: 0 0 60px rgba(168, 85, 247, 0.8);
}

.siri-orb.buyer-orb-compact.speaking {
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.75);
}

@keyframes pulse-orb {
  0%, 100% { transform: scale(1); filter: hue-rotate(0deg); }
  50% { transform: scale(1.05); filter: hue-rotate(30deg); }
}

@keyframes speak-orb {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.12); }
}

/* Flatpickr Interactive Date Picker Custom Styling */
.flatpickr-calendar {
  background: var(--card-solid) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-card) !important;
  backdrop-filter: blur(16px);
}

.flatpickr-calendar, .flatpickr-calendar *, .flatpickr-months, .flatpickr-month, .flatpickr-weekday, .flatpickr-day, .flatpickr-time, .flatpickr-time input, .flatpickr-time .numInputWrapper span {
  color: var(--white) !important;
}

.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
}

.flatpickr-day:hover {
  background: var(--muted) !important;
}


