/* ================================================================
   ADMIN CSS - Painel Administrativo
   Estilos específicos do painel (login, chat, tickets, etc.)
   ================================================================ */

/* === LOGIN PAGE === */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
}
.login-wrap {
  width: 100%;
  max-width: 400px;
}
/* Brand header (padrão prontuário) */
.brand {
  text-align: center;
  padding-top: 8px;
  margin-bottom: 24px;
  animation: fadeIn 0.6s ease-out;
}
.brand .name {
  font-size: 20pt;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1.1;
}
.brand .tagline {
  font-size: 12pt;
  color: #6b7280;
  font-weight: 400;
  line-height: 1.15;
  margin-top: 6px;
}
.brand .credentials {
  font-size: 10pt;
  color: var(--muted2);
  font-weight: 400;
  line-height: 1.15;
  margin-top: 7px;
}
.form-title-box {
  margin-top: 20px;
  text-align: center;
}
.formtitle {
  margin-top: 0;
  font-size: 13pt;
  font-weight: 700;
  color: var(--muted2);
  line-height: 1.15;
  display: inline-block;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
/* Login Card */
.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.6);
  overflow: hidden;
  animation: slideUp 0.6s ease-out;
}
.login-card-header {
  padding: 14px 18px 10px;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.login-card-header .login-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(15,118,110,0.1);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 8px;
}
.login-card-header h1 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 4px;
}
.login-card-header p {
  font-size: 0.8rem;
  color: var(--muted-light);
  margin: 0;
}
.login-card-body {
  padding: 18px 22px;
}
.login-card-body .form-group { margin-bottom: 12px; }
.login-card-body label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.login-card-body input {
  padding: 10px 12px;
}
.password-wrap {
  position: relative;
}
.password-wrap input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted-light);
  cursor: pointer;
  padding: 4px;
  font-size: 11px;
  box-shadow: none;
  border-radius: 4px;
}
.password-toggle:hover {
  color: var(--accent);
  transform: translateY(-50%);
  box-shadow: none;
}
.login-extras {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 0.85rem;
}
.login-extras label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  font-size: 0.85rem;
  cursor: pointer;
}
.login-extras label input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.login-extras a {
  color: var(--accent);
  font-weight: 600;
}
.login-submit {
  width: 100%;
  padding: 12px;
}
.login-card-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  text-align: center;
  background: #f8fafc;
}
.login-card-footer a {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

/* 2FA Section */
.twofa-section { display: none; }
.twofa-section.active { display: block; }
.codigo-2fa-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
}
.codigo-2fa-inputs input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
}
.codigo-2fa-inputs input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(14,165,233,0.15);
  background: #fff;
}
/* Recuperar Senha */
.recuperar-section { display: none; }
.recuperar-section.active { display: block; }

/* === CHAT / MENSAGENS (tickets) === */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 400px;
}
.chat-header {
  padding: 20px 28px;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.message {
  max-width: 75%;
  animation: fadeIn 0.3s ease-out;
}
.message.sent {
  align-self: flex-end;
}
.message.received {
  align-self: flex-start;
}
.message-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.message.sent .message-bubble {
  background: var(--accent-dark);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message.received .message-bubble {
  background: #f1f5f9;
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.message-meta {
  font-size: 0.7rem;
  color: var(--muted-light);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.message.sent .message-meta { justify-content: flex-end; }
.chat-input {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border-radius: 12px;
  padding: 10px 14px;
}
.chat-input button {
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
}

/* === TICKET DETAIL === */
.ticket-detail-header {
  padding: 24px 28px;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
  border-bottom: 1px solid var(--line);
}
.ticket-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.ticket-info-item {}
.ticket-info-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-light);
  margin-bottom: 4px;
}
.ticket-info-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

/* === TICKETS STATS ROW === */
.tickets-stats {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  flex-wrap: wrap;
}
.tickets-stat-item {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--muted);
}
.tickets-stat-item.active {
  background: rgba(15,118,110,0.1);
  color: var(--accent);
}

/* === PATIENT CARDS === */
.patient-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: all 0.2s;
  cursor: pointer;
}
.patient-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.patient-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(15,118,110,0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.patient-info { flex: 1; min-width: 0; }
.patient-name {
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 0.95rem;
}
.patient-detail {
  font-size: 0.8rem;
  color: var(--muted-light);
}

/* === TASKS === */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: all 0.2s;
}
.task-item:hover { border-color: var(--accent); }
.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--line);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
}
.task-item.completed {
  opacity: 0.6;
}
.task-item.completed .task-title { text-decoration: line-through; }
.task-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.task-due {
  font-size: 0.8rem;
  color: var(--muted-light);
  margin-top: 2px;
}

/* === CALENDAR === */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.calendar-header-cell {
  padding: 10px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
  color: var(--muted);
}
.calendar-cell {
  background: #fff;
  padding: 8px;
  min-height: 80px;
  font-size: 0.85rem;
}
.calendar-cell.today {
  background: rgba(14,165,233,0.05);
}
.calendar-cell.today .day-num {
  background: var(--accent-blue);
  color: #fff;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-event {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  background: rgba(15,118,110,0.1);
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === CONFIGURAÇÕES (settings) === */
.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.config-item:last-child { border-bottom: none; }
.config-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}
.config-desc {
  font-size: 0.8rem;
  color: var(--muted-light);
  margin-top: 2px;
}
/* Switch toggle */
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* === TEMPLATES LIST === */
.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.template-item:hover { border-color: var(--accent); }

/* === RESPONSIVIDADE ADMIN === */
@media (max-width: 900px) {
  .brand .name { font-size: 18px; }
  .brand .tagline { font-size: 11px; }
  .formtitle { font-size: 12pt; }
  .login-wrap { max-width: 100%; padding: 0 4px; }
  .login-card-body { padding: 20px; }
  .chat-container { height: calc(100vh - 180px); }
  .chat-messages { padding: 16px; }
  .message { max-width: 85%; }
  .ticket-info-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .brand .name { font-size: 16px; }
  .brand .tagline { font-size: 10px; }
  .brand .credentials { font-size: 9pt; }
  .codigo-2fa-inputs input { width: 38px; height: 46px; font-size: 1.1rem; }
  .ticket-info-grid { grid-template-columns: 1fr; }
}
