/* ============================================ */
/* Dashboard DentalBot — Estilo tipo Excel      */
/* Blanco, limpio, simple, profesional          */
/* ============================================ */

:root {
  --white: #ffffff;
  --bg: #f8f9fa;
  --border: #e2e5e9;
  --border-dark: #d0d4d9;
  --text: #1a1a1a;
  --text-light: #6c737a;
  --blue: #0066ff;
  --blue-hover: #0052cc;
  --green: #18a957;
  --red: #dc3545;
  --orange: #f59e0b;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

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

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
}

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 20px;
}

.login-box h1 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-box p {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--blue);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.btn:hover { background: var(--bg); }

.btn-primary {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }

.btn-danger {
  color: var(--red);
  border-color: var(--red);
}

.btn-danger:hover { background: #fef2f2; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-block { width: 100%; text-align: center; }

.login-error {
  background: #fef2f2;
  color: var(--red);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 16px;
  display: none;
}

/* ---- LAYOUT ---- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 220px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.sidebar-header small {
  font-size: 11px;
  color: var(--text-light);
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
}

.sidebar-nav button {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
}

.sidebar-nav button:hover { background: var(--bg); color: var(--text); }
.sidebar-nav button.active { background: var(--bg); color: var(--text); font-weight: 600; }

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

.sidebar-footer .user-email {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer button {
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-light);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.sidebar-footer button:hover { color: var(--red); }

/* ---- MAIN CONTENT ---- */
.main {
  flex: 1;
  margin-left: 220px;
  padding: 24px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ---- STATS CARDS ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
}

/* ---- TABLES (Excel style) ---- */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-light);
  background: var(--bg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-dark);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: #f8f9fb; }

.table-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

/* ---- STATUS BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
}

.badge-green { background: #ecfdf5; color: var(--green); }
.badge-orange { background: #fffbeb; color: var(--orange); }
.badge-red { background: #fef2f2; color: var(--red); }

/* ---- TOGGLE SWITCH ---- */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-dark);
  border-radius: 22px;
  cursor: pointer;
  transition: 0.2s;
}

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

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

/* ---- CONVERSATION DETAIL ---- */
.chat-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
}

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

.chat-header h3 { font-size: 14px; font-weight: 600; }

.chat-messages {
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.chat-msg {
  margin-bottom: 12px;
  max-width: 70%;
}

.chat-msg.user { margin-left: auto; text-align: right; }
.chat-msg.assistant { margin-right: auto; }

.chat-msg .msg-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 2px;
}

.chat-msg .msg-text {
  display: inline-block;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1.5;
  text-align: left;
}

.chat-msg.user .msg-text {
  background: var(--blue);
  color: white;
}

.chat-msg.assistant .msg-text {
  background: var(--bg);
  border: 1px solid var(--border);
}

.chat-msg .msg-time {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ---- SETTINGS FORM ---- */
.settings-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
}

.settings-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

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

/* ---- KNOWLEDGE ---- */
.knowledge-add {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.knowledge-add input,
.knowledge-add select {
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.knowledge-add input { flex: 1; }

/* ---- LOADING ---- */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 16px;
  font-size: 13px;
  background: var(--text);
  color: var(--white);
  border-radius: 4px;
  z-index: 999;
  animation: toast-in 0.3s ease;
}

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

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px;
  }

  .sidebar-nav button {
    white-space: nowrap;
    margin-bottom: 0;
  }

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

  .app { flex-direction: column; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }

  .settings-row { grid-template-columns: 1fr; }

  .chat-msg { max-width: 90%; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
}

