/* Ringly Dashboard – matches landing page design language */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

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

:root {
  --bg: #08010d;
  --surface: #120818;
  --surface-2: #1a0e22;
  --border: #2a1232;
  --border-hover: #3d1c48;
  --accent: #FF0080;
  --accent-hover: #FF3399;
  --accent-glow: rgba(255, 0, 128, 0.18);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.12);
  --yellow: #eab308;
  --yellow-glow: rgba(234, 179, 8, 0.12);
  --text: #ede4f0;
  --muted: #8a7090;
  --white: #fafafa;
  --sidebar-w: 260px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--white);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Auth Pages ─────────────────────────────────────────── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-logo span { color: var(--accent); }

.logo-fox-img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(255, 0, 128, 0.4));
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* ─── Layout ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  padding: 0 24px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { color: var(--accent); }

.sidebar-badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(255, 0, 128, 0.25);
  border-radius: 100px;
  color: var(--accent);
  font-weight: 500;
  margin: 0 24px 24px;
  display: inline-block;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 0, 128, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 2px solid var(--accent);
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 12px;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent-glow);
  border: 1px solid rgba(255, 0, 128, 0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}
.btn-logout:hover { color: var(--red); }

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 40px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.8rem;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}

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

.card-header h3 {
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

/* ─── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  transition: border-color 0.2s;
}

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

.stat-card .label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -1px;
}

.stat-card .value.accent { color: var(--accent); }
.stat-card .value.green { color: var(--green); }

.stat-card .change {
  font-size: 0.8rem;
  margin-top: 4px;
}
.stat-card .change.up { color: var(--green); }
.stat-card .change.down { color: var(--red); }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group .hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 15px rgba(255, 0, 128, 0.1);
}

textarea { min-height: 100px; resize: vertical; }
select { cursor: pointer; }

/* ─── Toggle ─────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-label .title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--white);
}

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

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .slider {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(255, 0, 128, 0.4);
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--white);
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 0 15px rgba(255, 0, 128, 0.25);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 25px rgba(255, 0, 128, 0.4); }

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--border); }

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

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
}
.btn-ghost:hover { color: var(--white); background: rgba(255,255,255,0.05); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(30, 30, 46, 0.5);
  color: var(--text);
}

tr:hover td { background: rgba(255, 0, 128, 0.03); }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-green { background: var(--green-glow); border: 1px solid rgba(34,197,94,0.2); color: var(--green); }
.badge-red { background: var(--red-glow); border: 1px solid rgba(239,68,68,0.2); color: var(--red); }
.badge-yellow { background: var(--yellow-glow); border: 1px solid rgba(234,179,8,0.2); color: var(--yellow); }
.badge-accent { background: var(--accent-glow); border: 1px solid rgba(255,0,128,0.25); color: var(--accent); }
.badge-muted { background: rgba(113,113,122,0.1); border: 1px solid rgba(113,113,122,0.2); color: var(--muted); }

/* ─── Calendar ───────────────────────────────────────────── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.calendar-nav button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.calendar-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-day-header {
  background: var(--surface-2);
  padding: 10px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.cal-day {
  background: var(--surface);
  padding: 8px;
  min-height: 100px;
  position: relative;
}

.cal-day.other-month { opacity: 0.3; }
.cal-day.today { background: var(--surface-2); }

.cal-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.cal-day.today .cal-date {
  color: var(--accent);
  background: var(--accent-glow);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.cal-event {
  font-size: 0.7rem;
  padding: 3px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 2px solid var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cal-event.cancelled {
  background: var(--red-glow);
  color: var(--red);
  border-left-color: var(--red);
  text-decoration: line-through;
}

.cal-event.completed {
  background: var(--green-glow);
  color: var(--green);
  border-left-color: var(--green);
}

/* ─── Chart (simple CSS bar chart) ───────────────────────── */
.chart-container {
  padding: 20px 0;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-top: 20px;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 32px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.5s ease;
  position: relative;
}

.bar:hover { opacity: 0.8; }

.bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
}

.bar-value {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

/* ─── Period Tabs ────────────────────────────────────────── */
.period-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.period-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.15s;
}

.period-tab.active {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 0 12px rgba(255, 0, 128, 0.3);
}

.period-tab:hover:not(.active) {
  color: var(--text);
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 20px;
}

/* ─── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 0.88rem;
  color: var(--text);
  z-index: 9999;
  animation: slideUp 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }

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

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ─── Call Log Item ──────────────────────────────────────── */
.call-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid rgba(30,30,46,0.5);
  transition: background 0.15s;
}

.call-item:hover { background: rgba(255,0,128,0.03); }

.call-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.call-icon.booked { background: var(--green-glow); }
.call-icon.info { background: var(--accent-glow); }
.call-icon.voicemail { background: var(--yellow-glow); }
.call-icon.transferred { background: rgba(113,113,122,0.1); }

.call-details { flex: 1; min-width: 0; }

.call-name {
  font-weight: 600;
  color: var(--white);
  font-size: 0.9rem;
}

.call-summary {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.call-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ─── FAQ Item ───────────────────────────────────────────── */
.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.faq-item:hover { border-color: var(--border-hover); }

.faq-question {
  font-weight: 600;
  color: var(--white);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.faq-answer {
  font-size: 0.85rem;
  color: var(--muted);
}

.faq-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ─── Service Card ───────────────────────────────────────── */
.service-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s;
  margin-bottom: 10px;
}

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

.service-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-glow);
  border: 1px solid rgba(255,0,128,0.25);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.service-info { flex: 1; min-width: 0; }

.service-name {
  font-weight: 600;
  color: var(--white);
  font-size: 0.95rem;
}

.service-meta {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
  margin-top: 2px;
}

.service-actions {
  display: flex;
  gap: 8px;
}

/* ─── Hours Grid ─────────────────────────────────────────── */
.hours-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hour-row {
  display: grid;
  grid-template-columns: 100px 1fr 1fr auto;
  gap: 12px;
  align-items: center;
}

.hour-day {
  font-weight: 500;
  color: var(--white);
  font-size: 0.9rem;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }

  .mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .cal-day { min-height: 60px; }
  .hour-row { grid-template-columns: 80px 1fr 1fr auto; }
  .modal { padding: 24px; }
}

@media (min-width: 769px) {
  .mobile-header { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.6);
  z-index: 150;
}

/* ─── Loading ────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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