/* ============================================
   BBHME — Suporte Técnico Styles
   ============================================ */

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

:root {
  --green: #00C853;
  --green-dark: #00A844;
  --green-light: #69F0AE;
  --dark: #0d1117;
  --dark-2: #161b22;
  --text: #24292f;
  --text-secondary: #57606a;
  --text-light: #e6edf3;
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --border: #d0d7de;
  --border-light: #e8ecf0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.06);
  --transition: 0.3s cubic-bezier(.4,0,.2,1);
  --font: 'Inter', -apple-system, sans-serif;
  --font-display: 'Space Grotesk', var(--font);
}

html { -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text); background: var(--bg-alt); line-height: 1.6; }
a { text-decoration: none; color: var(--green-dark); }
a:hover { color: var(--green); }
.hidden { display: none !important; }

/* --- Auth Page --- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-container { width: 100%; max-width: 420px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 32px; }
.logo-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--dark); color: var(--green);
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
}
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--dark); }
.auth-card {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 16px; padding: 40px; box-shadow: var(--shadow);
}
.auth-card h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 28px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--text-secondary); }

/* --- Forms --- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; font-family: var(--font); font-size: 0.95rem;
  transition: var(--transition); background: var(--bg);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,200,83,0.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-error { color: #e53935; font-size: 0.85rem; margin-bottom: 12px; min-height: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 10px;
  font-family: var(--font); font-size: 0.95rem; font-weight: 600;
  transition: var(--transition); cursor: pointer; border: none;
}
.btn-primary { background: var(--dark); color: var(--text-light); }
.btn-primary:hover { background: var(--dark-2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--green); color: var(--green-dark); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: var(--green-dark); }
.btn-danger { background: #e53935; color: white; }
.btn-danger:hover { background: #c62828; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; }

/* --- Dashboard Layout --- */
.dashboard { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--dark); color: var(--text-light);
  padding: 24px 16px; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; margin-bottom: 32px; }
.sidebar-logo .logo-text { color: var(--text-light); font-size: 1.2rem; }
.sidebar-nav { flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px; color: var(--text-light);
  font-size: 0.9rem; font-weight: 500; margin-bottom: 4px;
  transition: var(--transition); opacity: 0.7;
}
.sidebar-link:hover, .sidebar-link.active { opacity: 1; background: rgba(255,255,255,0.08); color: var(--green); }
.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-user {
  padding: 16px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user-email { font-size: 0.75rem; opacity: 0.5; }
.sidebar-logout {
  background: none; border: none; color: var(--text-light); opacity: 0.5;
  cursor: pointer; padding: 8px; border-radius: 8px; transition: var(--transition);
}
.sidebar-logout:hover { opacity: 1; background: rgba(255,255,255,0.08); }

.main { margin-left: 260px; flex: 1; padding: 32px; }
.page-header { margin-bottom: 32px; }
.page-title { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* --- Cards --- */
.card {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 16px; padding: 24px; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }

/* --- Stats Row --- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: 12px; padding: 20px; text-align: center;
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--green); }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }

/* --- Table --- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 12px 16px; font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary);
  border-bottom: 2px solid var(--border-light);
}
tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
tbody tr { cursor: pointer; transition: var(--transition); }
tbody tr:hover { background: var(--bg-alt); }

/* --- Badges --- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
}
.badge-aberto { background: #E3F2FD; color: #1565C0; }
.badge-em_andamento { background: #FFF3E0; color: #E65100; }
.badge-aguardando { background: #FFF8E1; color: #F57F17; }
.badge-resolvido { background: #E8F5E9; color: #2E7D32; }
.badge-fechado { background: #ECEFF1; color: #546E7A; }
.badge-baixa { background: #E8F5E9; color: #2E7D32; }
.badge-media { background: #FFF3E0; color: #E65100; }
.badge-alta { background: #FBE9E7; color: #D84315; }
.badge-urgente { background: #FFEBEE; color: #C62828; }

/* --- Filters --- */
.filters {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
  padding: 16px; background: var(--bg-alt); border-radius: 12px;
}
.filters select, .filters input {
  padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 0.85rem; background: var(--bg);
}
.filters select:focus, .filters input:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,200,83,0.1);
}

/* --- Chat --- */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.chat-choice { display: flex; gap: 16px; justify-content: center; padding: 60px 24px; }
.chat-choice-card {
  flex: 1; max-width: 280px; padding: 40px 32px; text-align: center;
  background: var(--bg); border: 2px solid var(--border-light); border-radius: 16px;
  cursor: pointer; transition: var(--transition);
}
.chat-choice-card:hover { border-color: var(--green); transform: translateY(-4px); box-shadow: var(--shadow); }
.chat-choice-card svg { width: 48px; height: 48px; color: var(--green); margin-bottom: 16px; }
.chat-choice-card h3 { font-family: var(--font-display); margin-bottom: 8px; }
.chat-choice-card p { font-size: 0.85rem; color: var(--text-secondary); }

.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg {
  max-width: 70%; padding: 12px 18px; border-radius: 16px;
  font-size: 0.9rem; line-height: 1.6; word-wrap: break-word;
}
.chat-msg.user { align-self: flex-end; background: var(--dark); color: var(--text-light); border-bottom-right-radius: 4px; }
.chat-msg.ai, .chat-msg.agent { align-self: flex-start; background: var(--bg-alt); border: 1px solid var(--border-light); border-bottom-left-radius: 4px; }
.chat-msg.system { align-self: center; background: rgba(0,200,83,0.08); color: var(--green-dark); font-size: 0.82rem; text-align: center; max-width: 90%; }
.chat-msg-time { font-size: 0.7rem; opacity: 0.5; margin-top: 4px; }

.chat-input {
  display: flex; gap: 12px; padding: 20px;
  border-top: 1px solid var(--border-light); background: var(--bg);
}
.chat-input input {
  flex: 1; padding: 14px 20px; border: 1.5px solid var(--border);
  border-radius: 12px; font-family: var(--font); font-size: 0.95rem;
}
.chat-input input:focus { outline: none; border-color: var(--green); }
.chat-input button {
  padding: 14px 24px; background: var(--dark); color: var(--text-light);
  border: none; border-radius: 12px; font-family: var(--font); font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.chat-input button:hover { background: var(--green-dark); }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px); display: flex; align-items: center;
  justify-content: center; z-index: 1000; padding: 24px;
}
.modal {
  background: var(--bg); border-radius: 20px; padding: 36px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.15);
}
.modal h2 { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* --- Empty state --- */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-secondary);
}
.empty-state svg { width: 64px; height: 64px; color: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-family: var(--font-display); color: var(--text); margin-bottom: 8px; }

/* --- Timeline --- */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.timeline-item { display: flex; gap: 16px; }
.timeline-avatar {
  width: 36px; height: 36px; border-radius: 10px; background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--green);
  flex-shrink: 0; border: 1px solid var(--border-light);
}
.timeline-avatar.admin { background: var(--dark); color: var(--green); }
.timeline-content { flex: 1; }
.timeline-meta { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 4px; }
.timeline-meta strong { color: var(--text); }
.timeline-text {
  padding: 14px 18px; background: var(--bg-alt); border-radius: 12px;
  border: 1px solid var(--border-light); font-size: 0.9rem; line-height: 1.7;
}
.timeline-text.admin { background: var(--dark); color: var(--text-light); border-color: transparent; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-toggle {
    display: flex; position: fixed; top: 16px; left: 16px; z-index: 101;
    width: 40px; height: 40px; border-radius: 10px; background: var(--dark);
    color: var(--text-light); align-items: center; justify-content: center;
    border: none; cursor: pointer;
  }
  .form-row { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .chat-choice { flex-direction: column; align-items: center; }
}

/* --- Loading --- */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border-light);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Print --- */
@media print {
  .sidebar, .filters, .btn, .chat-input { display: none !important; }
  .main { margin-left: 0; padding: 0; }
  .card { border: none; box-shadow: none; }
}
