/* ============================================================
   SapiTickets - Custom Styles (Mobile-First)
   ============================================================ */

:root {
  --primary: #1b3a6b;
  --primary-dark: #142d52;
  --sidebar-width: 240px;
  --navbar-height: 56px;
}

* {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  padding-top: var(--navbar-height);
  background: #f1f5f9;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background-color: var(--primary);
  border-color: var(--primary);
}

.cursor-pointer {
  cursor: pointer;
}

.table-hover .cursor-pointer:hover td {
  background-color: #e8f0fe;
}

/* ---- Gradient Navbar ---- */
.bg-primary-gradient {
  background: linear-gradient(135deg, #1b3a6b 0%, #2c5aa0 100%) !important;
}

.navbar {
  height: var(--navbar-height);
  z-index: 1040;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #0f2440;
  color: #fff;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1035;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1030;
}

.sidebar-overlay.show {
  display: block;
}

.sidebar-nav {
  padding: 0.5rem 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-divider {
  border-color: rgba(255, 255, 255, 0.15);
  margin: 0.5rem 1rem;
}

/* Desktop: sidebar always visible */
@media (min-width: 992px) {
  .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: var(--sidebar-width);
  }
}

/* ---- Main Content ---- */
.main-content {
  padding: 1rem 0;
  min-height: calc(100vh - var(--navbar-height));
}

/* ---- Cards ---- */
.card {
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

/* ---- KPI Cards ---- */
.kpi-card {
  color: #fff;
  border-radius: 0.75rem;
}

.kpi-card .h3 {
  font-size: 2rem;
}

/* ---- Status Badges ---- */
.badge-status {
  font-size: 0.72rem;
  padding: 0.35em 0.65em;
}

.bg-status-nuevo {
  background: #3b82f6 !important;
}

.bg-status-en_clasificacion {
  background: #8b5cf6 !important;
}

.bg-status-asignado {
  background: #6366f1 !important;
}

.bg-status-en_progreso {
  background: #f59e0b !important;
  color: #333 !important;
}

.bg-status-en_espera_cliente {
  background: #ef4444 !important;
}

.bg-status-resuelto {
  background: #10b981 !important;
}

.bg-status-cerrado {
  background: #6b7280 !important;
}

.bg-status-reabierto {
  background: #f97316 !important;
}

.bg-status-cancelado {
  background: #9ca3af !important;
}

/* ---- Priority Badges ---- */
.bg-priority-baja {
  background: #94a3b8 !important;
}

.bg-priority-media {
  background: #3b82f6 !important;
}

.bg-priority-alta {
  background: #f59e0b !important;
  color: #333 !important;
}

.bg-priority-critica {
  background: #ef4444 !important;
}

/* ---- Chat ---- */
.chat-container {
  max-height: 450px;
  overflow-y: auto;
}

.chat-message {
  display: flex;
  margin-bottom: 0.75rem;
}

.chat-own {
  justify-content: flex-end;
}

.chat-other {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  background: #f1f5f9;
  word-break: break-word;
}

.chat-own .chat-bubble {
  background: #e0e7ff;
  border-bottom-right-radius: 0.15rem;
}

.chat-other .chat-bubble {
  border-bottom-left-radius: 0.15rem;
}

.chat-internal .chat-bubble {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
}

.chat-deleted .chat-bubble {
  opacity: 0.5;
}

.chat-text {
  white-space: pre-wrap;
}

/* ---- Notification Badge ---- */
.notification-badge {
  font-size: 0.6rem;
  padding: 0.2em 0.45em;
  min-width: 16px;
}

/* ---- Table ---- */
.cursor-pointer {
  cursor: pointer;
}

.table-hover tbody tr:hover {
  background: #f8fafc;
}

/* ---- Login ---- */
.login-body {
  background: linear-gradient(135deg, #0f2440 0%, #1b3a6b 50%, #2c5aa0 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: 0;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* ---- Responsive utilities ---- */
@media (max-width: 575.98px) {
  .main-content {
    padding: 0.5rem 0;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .h5 {
    font-size: 1rem;
  }
}