/* NimoChat Dash - Visual identity matching Atende */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --primary: #00346e;
  --primary-light: #058fcb;
  --secondary: #52abd1;
  --accent: #00BCD4;
  --positive: #25d366;
  --negative: #f44336;
  --warning: #ffeb3b;
  --neutral: #058fcb;

  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: rgba(255, 255, 255, 0.92);
  --bg-header: rgba(255, 255, 255, 0.95);

  --text-primary: #2c2c2c;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --text-light: #ffffff;

  --border: #e0e0e0;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Roboto', 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
}

/* === LOGIN === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00346e 0%, #058fcb 50%, #52abd1 100%);
  padding: 20px;
}

.login-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-logo {
  display: block;
  margin: 0 auto 32px;
  max-width: 200px;
  height: auto;
}

.login-title {
  text-align: center;
  color: #152F63;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 52, 110, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  gap: 8px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #152F63, #058ECB);
  color: #fff;
  font-size: 15px;
  padding: 14px;
  border-radius: var(--radius);
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 52, 110, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover { background: rgba(0, 52, 110, 0.06); }

.btn-sm { padding: 8px 16px; font-size: 13px; }

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

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

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

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

.sidebar-logo {
  max-width: 160px;
  height: auto;
}

.sidebar-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 0 12px 12px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-item:hover {
  background: rgba(0, 52, 110, 0.07);
  color: var(--primary);
}

.nav-item.active {
  background: rgba(0, 52, 110, 0.12);
  color: var(--primary);
  font-weight: 500;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

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

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-tenant { font-size: 11px; color: var(--text-muted); }

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  transition: color 0.2s;
}
.btn-logout:hover { color: var(--negative); }

/* === MAIN === */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 24px 32px;
}

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

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === CARDS/PANELS === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* === FILTERS === */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.filter-group input,
.filter-group select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  min-width: 160px;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 52, 110, 0.1);
}

.btn-filter {
  background: var(--primary);
  color: #fff;
  padding: 9px 20px;
}

.btn-filter:hover {
  background: #002a58;
}

.btn-export {
  background: var(--positive);
  color: #fff;
  padding: 9px 20px;
}

.btn-export:hover { background: #1fb855; }

/* === STATS === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* === TABLE === */
.table-wrapper {
  overflow-x: auto;
}

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

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
  color: var(--text-secondary);
}

tbody tr:hover {
  background: rgba(0, 52, 110, 0.03);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-primary { background: rgba(0, 52, 110, 0.1); color: var(--primary); }
.badge-success { background: rgba(37, 211, 102, 0.1); color: #1a9e4c; }
.badge-warning { background: rgba(255, 152, 0, 0.1); color: #e68a00; }
.badge-muted { background: #f0f0f0; color: var(--text-muted); }

/* === SUMMARY TABLE === */
.summary-table {
  margin-top: 24px;
}

.summary-table td:last-child {
  font-weight: 600;
  color: var(--primary);
}

/* === LOADING === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 12px;
}

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

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

.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* === FOLLOW-UP FORM === */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

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

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 52, 110, 0.1);
}

.message-row {
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

.message-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.message-row-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
}

.btn-remove-msg {
  background: none;
  border: none;
  color: var(--negative);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}

.message-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 8px;
}

.message-body-field {
  margin-top: 8px;
}

.message-body-field textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
}

/* === TEMPLATE CARD === */
.template-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: box-shadow 0.2s;
}

.template-card:hover {
  box-shadow: var(--shadow);
}

.template-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.template-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

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

/* === SCHEDULE CARD === */
.schedule-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.schedule-contact {
  flex: 1;
}

.schedule-contact strong {
  font-size: 14px;
  display: block;
  margin-bottom: 2px;
}

.schedule-contact small {
  color: var(--text-muted);
  font-size: 12px;
}

.schedule-progress {
  text-align: center;
  min-width: 80px;
}

.schedule-progress .step-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.schedule-progress .next-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* === BADGES EXTRA === */
.badge-danger { background: rgba(244, 67, 54, 0.1); color: var(--negative); }
.badge-info { background: rgba(0, 188, 212, 0.1); color: #00838f; }

/* === MODAL === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

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

/* === PAGE HEADER with button === */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header .page-title {
  margin-right: auto;
}

.page-header .page-subtitle {
  width: 100%;
  order: 3;
  margin-top: -8px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .filters { flex-direction: column; }
  .filter-group input,
  .filter-group select { min-width: 100%; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
