/**
 * Sistema de Controle de Chamados
 * CSS Moderno e Responsivo
 * Versão 2.0 - Melhorias UI/UX + Mobile
 */

/* ============================================
   IMPORTS E RESET
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Cores Principais */
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;

  /* Cores de Status */
  --status-atendimento: #3b82f6;
  --status-sucesso: #10b981;
  --status-falha: #f59e0b;
  --status-rejeitado: #ef4444;
  --status-cancelado: #6b7280;

  /* Cores Neutras */
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* Transições */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Bordas */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

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

/* ============================================
   BODY E TIPOGRAFIA
   ============================================ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

/* ============================================
   CONTAINERS
   ============================================ */
.container-fluid {
  background: var(--bg-white);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  padding: 1rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--bg-black) !important;
  transition: opacity var(--transition-fast);
}

.navbar-brand:hover {
  opacity: 0.9;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
  font-weight: 600;
  border-radius: var(--radius-lg);
  padding: 0.625rem 1.25rem;
  transition: all var(--transition-base);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

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

/* Botões Específicos */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

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

.btn-outline-primary:hover {
  background: var(--primary);
  color: white;
}

.btn-outline-secondary {
  background: transparent;
  border: 2px solid var(--border-color);
  color: black;
  border-color: black;
}

.btn-outline-secondary:hover {
  background: black;
  border-color: black;
  color: white;
}

.btn-outline-danger {
  background: transparent;
  border: 2px solid #ef4444;
  color: #ef4444;
}

.btn-outline-danger:hover {
  background: #ef4444;
  color: white;
}

/* Botões Pequenos */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

/* ============================================
   CARDS DE CHAMADOS
   ============================================ */
.chamado-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
}

.chamado-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.chamado-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  transition: width var(--transition-fast);
}

.chamado-card:hover::before {
  width: 8px;
}

/* Bordas Coloridas por Status */
.border-info::before { background: var(--status-atendimento); }
.border-success::before { background: var(--status-sucesso); }
.border-warning::before { background: var(--status-falha); }
.border-danger::before { background: var(--status-rejeitado); }
.border-secondary::before { background: var(--status-cancelado); }

.card-body {
  padding: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* ============================================
   BADGES DE STATUS
   ============================================ */
.badge {
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.025em;
}

.bg-info {
  background: linear-gradient(135deg, var(--status-atendimento) 0%, #2563eb 100%) !important;
  color: white;
}

.bg-success {
  background: linear-gradient(135deg, var(--status-sucesso) 0%, #059669 100%) !important;
  color: white;
}

.bg-warning {
  background: linear-gradient(135deg, var(--status-falha) 0%, #d97706 100%) !important;
  color: white;
}

.bg-danger {
  background: linear-gradient(135deg, var(--status-rejeitado) 0%, #dc2626 100%) !important;
  color: white;
}

.bg-secondary {
  background: linear-gradient(135deg, var(--status-cancelado) 0%, #4b5563 100%) !important;
  color: white;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
  border-radius: var(--radius-lg);
  border: none;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert-light {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-control,
.form-select {
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  padding: 0.625rem 1rem;
  transition: all var(--transition-fast);
  font-size: 0.9375rem;
  background: var(--bg-white);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

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

.invalid-feedback {
  font-size: 0.875rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

/* ============================================
   MODAIS
   ============================================ */
.modal-content {
  border-radius: var(--radius-xl);
  border: none;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
  background: var(--bg-light);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-weight: 700;
  font-size: 1.25rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  background: var(--bg-light);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ============================================
   PAGINAÇÃO
   ============================================ */
.pagination {
  gap: 0.5rem;
}

.page-item .page-link {
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  color: var(--primary);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  transition: all var(--transition-fast);
  min-width: 40px;
  text-align: center;
}

.page-item .page-link:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   TOASTS (NOTIFICAÇÕES)
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1060;
  max-width: 400px;
}

.toast {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: none;
  overflow: hidden;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-header {
  padding: 1rem 1.25rem;
  font-weight: 600;
  border-bottom: none;
}

.toast-body {
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
}

.toast-header-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.toast-header-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.toast-header-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.toast-header-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3rem;
}

/* ============================================
   SCROLLBAR CUSTOMIZADA
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-primary);
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.text-muted {
  color: var(--text-secondary) !important;
}

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ============================================
   RESPONSIVIDADE MOBILE
   ============================================ */
@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }

  body {
    padding-top: 0;
  }

  .container-fluid {
    padding: 0.75rem 1rem;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  .btn-toolbar {
    flex-direction: column;
    gap: 0.5rem !important;
  }

  .btn-toolbar .btn {
    width: 100%;
  }

  .card-body {
    padding: 1rem;
  }

  .card-title {
    font-size: 1rem;
  }

  .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: 100%;
  }

  .form-control,
  .form-select {
    font-size: 16px; /* Previne zoom no iOS */
  }

  .pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .page-item .page-link {
    min-width: 36px;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 576px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }

  .display-5 {
    font-size: 2rem !important;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    border-radius: var(--radius-md) !important;
    margin-bottom: 0.5rem;
  }
}

/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chamado-card {
  animation: fadeIn 0.3s ease-out;
}

/* ============================================
   ACESSIBILIDADE
   ============================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============================================
   IMPRESSÃO
   ============================================ */
@media print {
  .btn,
  .navbar,
  .pagination,
  .modal,
  .toast-container {
    display: none !important;
  }

  .chamado-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
}
