/* ===== LAYOUT — Estrutura geral da página ===== */

.tickets-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 3rem;
  position: relative;
  z-index: 1;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 0.5rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-title em {
  font-style: normal;
  color: var(--accent);
}

.attendant-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.attendant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.logout-btn {
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: var(--accent3);
  color: var(--accent3);
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
}

.admin-btn:hover {
  background: var(--accent);
  color: #fff;
}

.admin-btn.super-admin-btn {
  border-color: #7c3aed;
  color: #7c3aed;
  background: #7c3aed0d;
}

.admin-btn.super-admin-btn:hover {
  background: #7c3aed;
  color: #fff;
}

/* Stats */
.tickets-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent2);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* Tickets header */
.tickets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tickets-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Nova barra de filtros com dropdown */
.tickets-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--muted);
  padding: 0.45rem 1rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.filter-btn:hover {
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tickets-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.new-ticket-btn {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: white;
  padding: 0.6rem 1.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.new-ticket-btn:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-hint {
  font-size: 0.8rem;
}

/* Search widget */
.search-widget {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: 36px;
}

.search-widget.open {
  width: 220px;
  border-color: var(--accent);
  background: var(--surface);
}

.search-toggle-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  border-radius: 10px;
}

.search-toggle-btn svg {
  stroke: currentColor;
}

.search-toggle-btn:hover {
  color: var(--accent);
}

.search-expand-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text);
  padding: 0 0.5rem 0 0;
  min-width: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.search-widget.open .search-expand-input {
  opacity: 1;
}

.search-expand-input::placeholder {
  color: var(--muted);
}

.tickets-search-bar {
  display: none !important;
}

/* ===== TEMA ESCURO — layout.css ===== */
body.dark-mode .admin-btn.super-admin-btn {
  border-color: #7c3aed;
  color: #c084fc;
  background: #3b076420;
}

body.dark-mode .admin-btn.super-admin-btn:hover {
  background: #7c3aed;
  color: #fff;
}

body.dark-mode .btn-primary {
  background: var(--accent);
  color: #fff;
}

body.dark-mode .empty-state-text {
  color: var(--muted);
}

/* ══════════════════════════════════════════════════════
   SIDEBAR RETRÁTIL — Módulo de Chamados
══════════════════════════════════════════════════════ */

.chamados-layout {
  display: flex;
  min-height: calc(100vh - 48px);
}

.chamados-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

/* Suprime animação no carregamento inicial */
.chamados-sidebar.no-transition,
.chamados-sidebar.no-transition * {
  transition: none !important;
}

.chamados-sidebar.collapsed {
  width: 52px;
}

/* Botão toggle */
.chamados-sidebar-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
  flex-shrink: 0;
  padding: 0;
}

.chamados-sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chamados-sidebar.collapsed .chamados-sidebar-toggle {
  right: 50%;
  transform: translateX(50%);
}

/* Items */
.chamados-sidebar-items {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 3rem 0.5rem 1rem;
  overflow: hidden;
  flex: 1;
  height: calc(100vh - 48px);
}

.chamados-sidebar-label {
  font-size: 0.55rem;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.15s;
}

.chamados-sidebar.collapsed .chamados-sidebar-label {
  opacity: 0;
}

.chamados-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.5rem;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  /* Reset para botões */
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  font-family: var(--font-display);
}

.chamados-sidebar-item:hover {
  background: var(--surface2);
  color: var(--accent);
}

.chamados-sidebar-item.active {
  background: var(--surface2);
  color: var(--accent);
  font-weight: 700;
}

.chamados-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.chamados-sidebar-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.15s, max-width 0.25s;
}

.chamados-sidebar.collapsed .chamados-sidebar-name {
  opacity: 0;
  max-width: 0;
}

.chamados-sidebar-soon {
  font-size: 0.48rem;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--surface3);
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 0.1rem 0.25rem;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.chamados-sidebar.collapsed .chamados-sidebar-soon {
  opacity: 0;
}

.chamados-sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0.5rem;
}

/* Área principal cresce */
.chamados-layout .tickets-container {
  flex: 1;
  min-width: 0;
  transition: none;
}

/* Dark mode */
body.dark-mode .chamados-sidebar {
  background: var(--surface);
  border-color: var(--border2);
}

/* ── Sidebar disabled (não clicável) ── */
.chamados-sidebar-disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.chamados-sidebar-disabled:hover {
  background: none !important;
  color: var(--text) !important;
}

.chamados-sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.3rem;
}

.chamados-sidebar.collapsed .chamados-sidebar-footer {
  align-items: center;
  padding: 0.3rem 0 0;
}

.chamados-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-radius: 9px;
  background: var(--surface2);
  overflow: hidden;
  width: 100%;
}

.chamados-sidebar.collapsed .chamados-sidebar-user {
  width: 36px;
  padding: 0.4rem;
  justify-content: center;
  gap: 0;
  overflow: visible;
}

.chamados-sidebar.collapsed .chamados-sidebar-avatar {
  flex-shrink: 0;
}

.chamados-sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.chamados-sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  min-width: 0;
  transition: opacity 0.15s;
}

.chamados-sidebar.collapsed .chamados-sidebar-user-info {
  opacity: 0;
}

.chamados-sidebar-user-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chamados-sidebar-user-role {
  font-size: 0.6rem;
  font-family: 'Space Mono', monospace;
  color: var(--muted);
}

.chamados-sidebar-logout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.chamados-sidebar.collapsed .chamados-sidebar-logout {
  justify-content: center;
  padding: 0.4rem 0;
  width: 36px;
  margin: 0 auto;
}

.chamados-sidebar.collapsed .chamados-sidebar-logout .chamados-sidebar-name {
  display: none;
}

.chamados-sidebar.collapsed .chamados-sidebar-logout .chamados-sidebar-icon {
  margin: 0;
}

.chamados-sidebar.collapsed #sidebar-config-btn,
.chamados-sidebar.collapsed #cs-mod-config {
  justify-content: center;
  padding: 0.65rem 0;
  width: 36px;
  margin: 0 auto;
}

.chamados-sidebar.collapsed #sidebar-config-btn .chamados-sidebar-name,
.chamados-sidebar.collapsed #cs-mod-config .chamados-sidebar-name {
  display: none;
}

.chamados-sidebar-logout:hover {
  background: #fee2e2;
  color: var(--accent);
}

body.dark-mode .chamados-sidebar-logout:hover {
  background: #2a0808;
  color: var(--accent);
}