/* === DASHBOARD LAYOUT === */
.dash-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
}

/* === SIDEBAR === */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--bg-card);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--bg-card);
}

.sidebar-profile {
  padding: 20px 24px;
  border-bottom: 1px solid var(--bg-card);
}

.profile-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-meta {
  font-size: 13px;
  color: var(--fg-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

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

.nav-badge {
  margin-left: auto;
  background: var(--bg-card);
  color: var(--fg-subtle);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
}

.nav-item.active .nav-badge {
  background: rgba(249, 115, 22, 0.2);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* === MAIN CONTENT === */
.dash-main {
  margin-left: 260px;
  flex: 1;
  padding: 32px 40px;
  max-width: 1100px;
}

/* === STATS BAR === */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 12px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  transition: border-color 0.2s;
}

.stat-pill:hover {
  border-color: rgba(249, 115, 22, 0.3);
}

.stat-pill.accent {
  background: var(--accent-soft);
  border-color: rgba(249, 115, 22, 0.3);
}

.stat-pill-num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-pill-label {
  font-size: 12px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* === SECTION === */
.dash-section {
  animation: fadeIn 0.2s ease;
}

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

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

.section-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--fg);
}

/* === BUTTONS === */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; text-align: center; display: block; }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--bg-card);
  border-radius: 10px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: opacity 0.15s;
}
.btn-sm:hover { opacity: 0.8; }

.btn-generate {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(249, 115, 22, 0.3) !important;
}

.btn-send {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

/* === STATUS BADGES === */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 100px;
}

.status-new { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.status-contacted { background: rgba(249, 115, 22, 0.12); color: var(--accent); }
.status-responded { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.status-booked, .status-confirmed { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.status-completed { background: rgba(34, 197, 94, 0.2); color: #16a34a; }
.status-closed, .status-cancelled { background: var(--bg-card); color: var(--fg-subtle); }
.status-draft { background: var(--bg-card); color: var(--fg-subtle); }
.status-sent { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.status-pending { background: rgba(249, 115, 22, 0.12); color: var(--accent); }

/* === LEADS GRID === */
.leads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.lead-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 14px;
  padding: 20px;
  transition: border-color 0.2s;
}

.lead-card:hover {
  border-color: rgba(249, 115, 22, 0.3);
}

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

.lead-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
}

.lead-source {
  font-size: 12px;
  color: var(--fg-subtle);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.lead-need {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.lead-contact {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
}

.lead-lang {
  font-size: 12px;
  color: var(--fg-subtle);
  margin-bottom: 14px;
}

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

.status-select {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid var(--bg-card);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
}

/* === MESSAGES LIST === */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 14px;
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.message-card:hover { border-color: rgba(249, 115, 22, 0.2); }

.message-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.message-to { font-size: 14px; color: var(--fg-muted); }
.message-to strong { color: var(--fg); }

.message-lang-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-subtle);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 6px;
}

.message-source {
  font-size: 12px;
  color: var(--fg-subtle);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-body {
  font-size: 15px;
  color: var(--fg);
  line-height: 1.7;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 10px;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-date { font-size: 13px; color: var(--fg-subtle); margin-left: auto; }

/* === APPOINTMENTS === */
.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.appt-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 14px;
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.appt-card:hover { border-color: rgba(249, 115, 22, 0.2); }

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

.appt-name { font-weight: 700; color: var(--fg); }
.appt-time { font-size: 14px; color: var(--accent); margin-bottom: 6px; }
.appt-notes { font-size: 14px; color: var(--fg-muted); margin-bottom: 6px; }
.appt-contact { font-size: 13px; color: var(--fg-subtle); margin-bottom: 14px; }
.appt-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.appt-form {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.form-sub-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-row select,
.form-row input[type="datetime-local"],
.form-row input[type="text"] {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--bg-card);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  min-width: 180px;
}

.form-row select:focus,
.form-row input:focus {
  outline: none;
  border-color: var(--accent);
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--fg-muted);
}

.empty-icon {
  font-size: 48px;
  color: var(--fg-subtle);
  margin-bottom: 16px;
}

.empty-state p { font-size: 16px; line-height: 1.7; }
.empty-state a { color: var(--accent); text-decoration: none; }
.empty-state strong { color: var(--fg); }

/* === SEARCH STATUS === */
.search-status {
  background: var(--accent-soft);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-status::before {
  content: '◌';
  animation: spin 1.2s linear infinite;
  display: inline-block;
}

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

/* === MODAL === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--bg-card);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-subtle);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--fg); }

.modal-content {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--bg-card);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.message-preview-block {
  margin-bottom: 20px;
}

.message-preview-lang {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 8px;
}

.message-preview-text {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px;
  font-size: 15px;
  color: var(--fg);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* === ALERTS === */
.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: #ef4444;
  font-size: 14px;
  margin-bottom: 20px;
}

/* === SETUP PAGE === */
.setup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.setup-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-card);
  border-radius: 20px;
  padding: 48px;
  width: 100%;
  max-width: 520px;
}

.setup-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 28px;
}

.setup-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 8px;
}

.setup-sub {
  font-size: 15px;
  color: var(--fg-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.req { color: var(--accent); }
.hint { color: var(--fg-subtle); font-weight: 400; text-transform: none; letter-spacing: 0; }

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--bg-card);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--fg-subtle);
}

.form-group textarea { resize: vertical; }

/* === HIDDEN === */
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 16px;
  }

  .dash-body { flex-direction: column; }
  .dash-main { margin-left: 0; padding: 20px 16px; }
  .leads-grid { grid-template-columns: 1fr; }
  .stats-bar { gap: 10px; }
  .stat-pill { min-width: 90px; }
}
