/**
 * GRUPO FALCON - ERP Profissional
 * Estilos do Layout Principal
 * 
 * Menu Lateral + Header + Responsivo
 */

/* ============================================================================
   VARIÁVEIS CSS
   ============================================================================ */
:root {
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 70px;
  --header-height: 64px;
  --falcon-blue: #0047AB;
  --falcon-blue-dark: #003380;
  --falcon-blue-light: #4A90E2;
  --sidebar-bg: #1E293B;
  --sidebar-hover: #334155;
  --sidebar-active: #0047AB;
}

/* ============================================================================
   SIDEBAR - MENU LATERAL
   ============================================================================ */
.sidebar-falcon {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: all 0.3s ease;
  overflow: hidden;
}

.sidebar-falcon.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-falcon.collapsed .sidebar-logo-text,
.sidebar-falcon.collapsed .sidebar-categoria-header span,
.sidebar-falcon.collapsed .sidebar-item span,
.sidebar-falcon.collapsed .sidebar-categoria-arrow,
.sidebar-falcon.collapsed .badge-soon,
.sidebar-falcon.collapsed .sidebar-footer {
  display: none;
}

.sidebar-falcon.collapsed .sidebar-categoria-header {
  justify-content: center;
  padding: 0.75rem;
}

.sidebar-falcon.collapsed .sidebar-item {
  justify-content: center;
  padding: 0.75rem;
}

/* Header do Sidebar */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 70px;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: var(--falcon-blue);
}

/* Navegação do Sidebar */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Categoria */
.sidebar-categoria {
  margin-bottom: 0.5rem;
}

.sidebar-categoria-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.sidebar-categoria-header:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-categoria-header i:first-child {
  width: 20px;
  text-align: center;
  font-size: 0.875rem;
}

.sidebar-categoria-arrow {
  margin-left: auto;
  font-size: 0.625rem;
  transition: transform 0.2s;
}

.sidebar-categoria.collapsed .sidebar-categoria-arrow {
  transform: rotate(-90deg);
}

.sidebar-categoria.collapsed .sidebar-categoria-items {
  display: none;
}

/* Items do Menu */
.sidebar-categoria-items {
  padding: 0.25rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem 0.625rem 2.5rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s;
  position: relative;
}

.sidebar-item:hover {
  color: white;
  background: var(--sidebar-hover);
}

.sidebar-item.active {
  color: white;
  background: var(--sidebar-active);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: white;
}

.sidebar-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sidebar-item.disabled:hover {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-item i {
  width: 20px;
  text-align: center;
  font-size: 0.875rem;
}

.badge-soon {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Footer do Sidebar */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   HEADER PRINCIPAL
   ============================================================================ */
.header-falcon {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #E5E7EB;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

/* ============================================================================
   OVERLAY MOBILE
   ============================================================================ */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ============================================================================
   RESPONSIVO
   ============================================================================ */
@media (max-width: 1024px) {
  .sidebar-falcon {
    transform: translateX(-100%);
  }

  .sidebar-falcon.mobile-open {
    transform: translateX(0);
  }

  #mainContent {
    margin-left: 0 !important;
  }
}

@media (min-width: 1025px) {
  #mainContent {
    margin-left: var(--sidebar-width);
  }

  .sidebar-falcon.collapsed + #mainContent,
  #mainContent.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
  }
}

/* ============================================================================
   CARDS E COMPONENTES
   ============================================================================ */
.card-falcon {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #E5E7EB;
  overflow: hidden;
}

.card-falcon-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #E5E7EB;
  background: #F8FAFC;
}

.card-falcon-body {
  padding: 1.5rem;
}

/* ============================================================================
   KPIs
   ============================================================================ */
.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.kpi-icon.blue {
  background: rgba(0, 71, 171, 0.1);
  color: var(--falcon-blue);
}

.kpi-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
}

.kpi-icon.yellow {
  background: rgba(245, 158, 11, 0.1);
  color: #F59E0B;
}

.kpi-icon.red {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

.kpi-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8B5CF6;
}

.kpi-content {
  flex: 1;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.875rem;
  color: #6B7280;
}

/* ============================================================================
   TABELAS
   ============================================================================ */
.table-falcon {
  width: 100%;
  border-collapse: collapse;
}

.table-falcon thead {
  background: var(--falcon-blue);
  color: white;
}

.table-falcon th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
}

.table-falcon tbody tr {
  border-bottom: 1px solid #E5E7EB;
  transition: background 0.2s;
}

.table-falcon tbody tr:hover {
  background: #F8FAFC;
}

.table-falcon tbody tr:nth-child(even) {
  background: #FAFAFA;
}

.table-falcon tbody tr:nth-child(even):hover {
  background: #F0F4F8;
}

.table-falcon td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #374151;
}

/* ============================================================================
   BOTÕES
   ============================================================================ */
.btn-falcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-falcon-primary {
  background: var(--falcon-blue);
  color: white;
}

.btn-falcon-primary:hover {
  background: var(--falcon-blue-dark);
}

.btn-falcon-secondary {
  background: #F3F4F6;
  color: #374151;
  border: 1px solid #D1D5DB;
}

.btn-falcon-secondary:hover {
  background: #E5E7EB;
}

.btn-falcon-success {
  background: #10B981;
  color: white;
}

.btn-falcon-success:hover {
  background: #059669;
}

.btn-falcon-danger {
  background: #EF4444;
  color: white;
}

.btn-falcon-danger:hover {
  background: #DC2626;
}

.btn-falcon-warning {
  background: #F59E0B;
  color: white;
}

.btn-falcon-warning:hover {
  background: #D97706;
}

/* Tamanhos */
.btn-falcon-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-falcon-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

/* ============================================================================
   FORMULÁRIOS
   ============================================================================ */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
}

.form-label.required::after {
  content: ' *';
  color: #EF4444;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--falcon-blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.1);
}

.form-input.error {
  border-color: #EF4444;
}

.form-input.success {
  border-color: #10B981;
}

.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: var(--falcon-blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.1);
}

.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--falcon-blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.1);
}

.form-error {
  color: #EF4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* ============================================================================
   BADGES
   ============================================================================ */
.badge-falcon {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-falcon-success {
  background: #D1FAE5;
  color: #065F46;
}

.badge-falcon-danger {
  background: #FEE2E2;
  color: #991B1B;
}

.badge-falcon-warning {
  background: #FEF3C7;
  color: #92400E;
}

.badge-falcon-info {
  background: #DBEAFE;
  color: #1E40AF;
}

.badge-falcon-gray {
  background: #F3F4F6;
  color: #374151;
}

/* ============================================================================
   MODAIS
   ============================================================================ */
.modal-falcon-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-falcon-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-falcon {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(-20px);
  transition: all 0.3s;
}

.modal-falcon-overlay.active .modal-falcon {
  transform: scale(1) translateY(0);
}

.modal-falcon-lg {
  max-width: 800px;
}

.modal-falcon-xl {
  max-width: 1000px;
}

.modal-falcon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #E5E7EB;
  background: #F8FAFC;
}

.modal-falcon-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1F2937;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-falcon-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #E5E7EB;
  border: none;
  cursor: pointer;
  color: #6B7280;
  transition: all 0.2s;
}

.modal-falcon-close:hover {
  background: #EF4444;
  color: white;
}

.modal-falcon-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-falcon-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #E5E7EB;
  background: #F8FAFC;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  max-width: 400px;
  transform: translateX(120%);
  transition: all 0.3s;
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.toast-success .toast-icon {
  background: #D1FAE5;
  color: #065F46;
}

.toast-error .toast-icon {
  background: #FEE2E2;
  color: #991B1B;
}

.toast-warning .toast-icon {
  background: #FEF3C7;
  color: #92400E;
}

.toast-info .toast-icon {
  background: #DBEAFE;
  color: #1E40AF;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #1F2937;
}

.toast-message {
  font-size: 0.75rem;
  color: #6B7280;
}

.toast-close {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
}

.toast-close:hover {
  color: #374151;
}

/* ============================================================================
   LOADING
   ============================================================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #E5E7EB;
  border-top-color: var(--falcon-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================================================
   PAGINAÇÃO
   ============================================================================ */
.pagination-falcon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
}

.pagination-falcon button {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #E5E7EB;
  background: white;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-falcon button:hover:not(:disabled) {
  background: #F3F4F6;
  border-color: #D1D5DB;
}

.pagination-falcon button.active {
  background: var(--falcon-blue);
  border-color: var(--falcon-blue);
  color: white;
}

.pagination-falcon button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6B7280;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: #F3F4F6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #9CA3AF;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================================================
   GRID RESPONSIVO
   ============================================================================ */
.grid-falcon {
  display: grid;
  gap: 1.5rem;
}

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

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

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

@media (min-width: 640px) {
  .grid-falcon-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-falcon-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-falcon-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-falcon-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-falcon-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
.text-falcon-blue {
  color: var(--falcon-blue);
}

.bg-falcon-blue {
  background: var(--falcon-blue);
}

.border-falcon-blue {
  border-color: var(--falcon-blue);
}
