/**
 * StaffKit Pro - Estilos
 * Basado en Replanta Design System
 */

:root {
  --rep-green: #93F1C9;
  --rep-forest: #1E2F23;
  --rep-teal: #41999F;
  --rep-sun: #F7D450;
  --rep-mint: #92F1CB;
  --rep-card: #FFFFFF;
  --rep-border: #E6F3EF;
  --rep-bg: #F7FBF9;
  --rep-danger: #E53935;
  --rep-warning: #F57C00;
  --rep-muted: #6b7c74;
  --rep-light: #F8FFFC;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--rep-bg);
  color: var(--rep-forest);
  font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* Reset de overlay si hay alguno */
body::before,
body::after,
.layout::before,
.layout::after {
  display: none !important;
}

.fraunces {
  font-family: 'Fraunces', serif;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--rep-forest);
  color: #fff;
  padding: 20px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 20px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: .2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.sidebar-nav a.active {
  border-left: 3px solid var(--rep-green);
}

/* Badge de notificación en sidebar */
.nav-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 15px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--rep-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.main {
  flex: 1;
  margin-left: 240px;
  padding: 24px;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--rep-card);
  border: 1px solid var(--rep-border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

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

.card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: .2s;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--rep-teal);
  color: #fff;
}

.btn-primary:hover {
  background: #378a8f;
}

.btn-success {
  background: var(--rep-green);
  color: var(--rep-forest);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--rep-teal);
  color: var(--rep-teal);
}

.btn-outline:hover {
  background: var(--rep-teal);
  color: #fff;
}

.btn-danger {
  background: var(--rep-danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: .85rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: .9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--rep-border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  transition: .2s;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--rep-teal);
  box-shadow: 0 0 0 3px rgba(65, 153, 159, .15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.form-help {
  font-size: .8rem;
  color: #6b7c74;
  margin-top: 4px;
}

/* Grid */
.grid {
  display: grid;
  gap: 20px;
}

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

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
  
  .main {
    margin-left: 0;
  }
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--rep-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all .2s;
}

.stat-card:hover {
  border-color: var(--rep-teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.stat-card.active {
  border-color: var(--rep-teal);
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f7fa 100%);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--rep-teal);
  line-height: 1;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--rep-teal);
  line-height: 1;
}

.stat-label {
  font-size: .85rem;
  color: #6b7c74;
  margin-top: 4px;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--rep-border);
}

.table th {
  font-weight: 600;
  font-size: .85rem;
  text-transform: uppercase;
  color: #6b7c74;
  background: #f8faf9;
}

.table tbody tr:hover {
  background: #f8fffc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-danger { background: #FFEBEE; color: #C62828; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-teal { background: #E0F7FA; color: #00838F; }

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  color: #2E7D32;
}

.alert-error {
  background: #FFEBEE;
  border: 1px solid #EF9A9A;
  color: #C62828;
}

.alert-warning {
  background: #FFF3E0;
  border: 1px solid #FFCC80;
  color: #E65100;
}

.alert-info {
  background: #E3F2FD;
  border: 1px solid #90CAF9;
  color: #1565C0;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  background: #E8FFF7;
  border: none;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
}

.tab.active {
  background: var(--rep-teal);
  color: #fff;
}

.tab-content {
  display: none;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--rep-border);
  border-radius: 0 12px 12px 12px;
}

.tab-content.active {
  display: block;
}

/* Icons */
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

/* Utilities */
.text-muted { color: #6b7c74; }
.text-small { font-size: .85rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

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

.page-title {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.page-subtitle {
  margin: 0;
  color: #6b7c74;
}

/* Login page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E8FFF7 0%, #F7FBF9 100%);
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo h1 {
  margin: 10px 0 0;
  font-size: 1.5rem;
}

/* Prospect card */
.prospect-card {
  background: #fff;
  border: 1px solid var(--rep-border);
  border-radius: 12px;
  padding: 16px;
  transition: .2s;
  cursor: pointer;
}

.prospect-card:hover {
  border-color: var(--rep-teal);
  box-shadow: 0 4px 12px rgba(65,153,159,.15);
}

.prospect-name {
  font-weight: 600;
  margin: 0 0 4px;
}

.prospect-company {
  color: #6b7c74;
  font-size: .9rem;
}

.prospect-meta {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  font-size: .85rem;
}

/* Message templates */
.msg-card {
  background: #F8FFFC;
  border: 1px solid var(--rep-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.msg-card:hover {
  border-color: var(--rep-teal);
}

.msg-text {
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  font-size: .9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

.tone-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #6b7c74;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6b7c74;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  opacity: .5;
  margin-bottom: 16px;
}

/* ============================================
   SYSTEM STATUS BAR
   ============================================ */
.system-status-bar {
  position: fixed;
  top: 10px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #1a1f2e 0%, #252b3d 100%);
  border-radius: 8px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.9);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  flex-wrap: nowrap;
  max-width: calc(100vw - 300px);
  overflow: visible;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  transition: background 0.2s;
  white-space: nowrap;
}

.status-item:hover {
  background: rgba(255,255,255,0.1);
}

.status-icon {
  font-weight: 700;
  font-size: 0.85rem;
}

.status-icon.pulse {
  animation: statusPulse 1.5s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-label {
  color: rgba(255,255,255,0.7);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-divider {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.15);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: dotPulse 2s infinite;
}

.status-dot.pulse {
  animation: dotPulseActive 1s infinite;
  box-shadow: 0 0 8px currentColor;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

@keyframes dotPulseActive {
  0%, 100% { transform: scale(1); box-shadow: 0 0 4px currentColor; }
  50% { transform: scale(1.3); box-shadow: 0 0 12px currentColor; }
}

.status-time {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  margin-left: 4px;
}

.cron-status, .bot-status {
  gap: 8px;
}

.status-alert {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Alert info style */
.alert-info {
  background: #E0F2FE;
  border-left: 4px solid #3B82F6;
  color: #1E40AF;
}

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

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Table Responsive */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -24px;
  padding: 0 24px;
}

.table-responsive table {
  min-width: 800px;
}

/* Bootstrap-compatible utilities */
.row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.col-md-3, .col-md-4, .col-md-8 { padding: 0 10px; box-sizing: border-box; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
@media (max-width: 900px) {
  .col-md-3, .col-md-4, .col-md-8 { flex: 0 0 100%; max-width: 100%; margin-bottom: 15px; }
}

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.text-center { text-align: center; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-2 { margin-top: .5rem !important; }
.p-0 { padding: 0 !important; }
.py-2 { padding-top: .5rem !important; padding-bottom: .5rem !important; }

.card-body { padding: 20px; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }

.btn-outline-primary { 
  background: transparent; 
  border: 1px solid var(--rep-teal); 
  color: var(--rep-teal); 
}
.btn-outline-primary:hover { 
  background: var(--rep-teal); 
  color: #fff; 
}

.badge { 
  display: inline-block; 
  padding: 4px 10px; 
  font-size: .75rem; 
  font-weight: 600; 
  border-radius: 50px; 
}
.badge.bg-primary { background: var(--rep-teal); color: #fff; }
.badge.bg-success { background: #198754; color: #fff; }
.badge.bg-warning { background: #ffc107; color: #000; }
.badge.bg-danger { background: #dc3545; color: #fff; }
.badge.bg-secondary { background: #6c757d; color: #fff; }

.table-hover tbody tr:hover { background: #f8f9fa; }
.table-light, thead.table-light, tfoot.table-light { background: #f8f9fa; }
.table-light th, .table-light td { background: #f8f9fa; }

.border-bottom { border-bottom: 1px solid var(--rep-border); }
.text-muted { color: #6c757d !important; }
.text-success { color: #198754 !important; }
.text-danger { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-white { color: #fff !important; }
.small { font-size: .875rem; }

.alert { padding: 15px 20px; border-radius: 8px; margin-bottom: 20px; }
.alert-warning { background: #fff3cd; border: 1px solid #ffeeba; color: #856404; }
.alert h5 { margin: 0 0 10px; }

