/* Components Critical CSS - SnapLinked
 * 3B.6: Above-the-fold components (render-blocking)
 * Split from components.css for performance */

/* ============================================
   0. ACCESSIBILITY (WCAG 2.2 Level AA)
   ============================================ */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  border-radius: var(--radius-lg);
  z-index: var(--z-max);
  text-decoration: none;
  transition: top 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.skip-link:focus {
  top: var(--space-4);
  outline: none;
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

/* L11: Focus styles consistentes para elementos interativos */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary-400, #33a3e7);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 4px);
}

.btn:focus-visible {
  outline: 2px solid var(--primary-400, #33a3e7);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--primary-ring, rgba(10, 102, 194, 0.15));
}

:focus:not(:focus-visible) {
  outline: none;
}

/* L14: Scroll-to-top button */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 90px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color, rgba(255,255,255,0.15));
  background: var(--bg-surface, #ffffff);
  color: var(--text-secondary, #475569);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  z-index: 9997;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--primary-500, #0a66c2);
  color: var(--text-inverse, #fff);
  border-color: var(--primary-500, #0a66c2);
}

@media (max-width: 576px) {
  .scroll-to-top { bottom: 16px; right: 72px; width: 40px; height: 40px; }
}

.sr-only,
.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;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   1. BUTTONS - Enterprise Style
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
  padding: var(--space-2-5) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-in-out);
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* Button Sizes */
.btn-xs {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-xl {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-600);
  border-color: var(--primary-600);
  box-shadow: var(--shadow-primary-lg);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-700);
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:active:not(:disabled) {
  background: var(--bg-active);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary-50);
  color: var(--primary-700);
}

.btn-outline:active:not(:disabled) {
  background: var(--primary-100);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-ghost:active:not(:disabled) {
  background: var(--bg-active);
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
  color: var(--text-inverse);
  border-color: var(--success-500);
  box-shadow: var(--shadow-success);
}

.btn-success:hover:not(:disabled) {
  background: var(--success-600);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
  color: var(--text-inverse);
  border-color: var(--danger-500);
  box-shadow: var(--shadow-danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-600);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

/* Warning Button */
.btn-warning {
  background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
  color: var(--text-inverse);
  border-color: var(--warning-500);
}

.btn-warning:hover:not(:disabled) {
  background: var(--warning-600);
}

/* Icon Only Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon:active {
  background: var(--bg-active);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon.btn-lg {
  width: 48px;
  height: 48px;
}

/* Button with Loading */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  will-change: transform;
}

.btn-primary.btn-loading::after {
  border-color: rgba(255,255,255,0.3);
  border-top-color: var(--text-inverse);
}

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

/* Button Group */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.btn-group .btn {
  border-radius: 0;
  margin-left: -1px;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  margin-left: 0;
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}


/* ============================================
   2. FORMS / INPUTS - Modern Style
   ============================================ */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-label .required-indicator {
  color: var(--danger);
  margin-left: var(--space-1);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1-5);
}

.form-control {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast) var(--ease-in-out);
  appearance: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:hover:not(:disabled) {
  border-color: var(--border-medium);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

.form-control:disabled,
.form-control[readonly] {
  background-color: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--danger-ring);
}

.form-control.is-valid {
  border-color: var(--success);
}

.form-control.is-valid:focus {
  box-shadow: 0 0 0 3px var(--success-ring);
}

/* Input Sizes */
.form-control-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.form-control-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

/* Textarea */
textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Select */
.form-select {
  padding-right: var(--space-10);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px 12px;
}

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  flex: 1;
  border-radius: 0;
}

.input-group .form-control:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group .form-control:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background-color: var(--bg-muted);
  border: 1px solid var(--border-default);
}

.input-group-text:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-right: none;
}

.input-group-text:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border-left: none;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 24px;
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  background-color: var(--bg-input);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  appearance: none;
  flex-shrink: 0;
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3e%3c/svg%3e");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.form-check-input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3ccircle cx='8' cy='8' r='4' fill='white'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

/* Toggle Switch (custom — NÃO aplica ao Bootstrap .form-check.form-switch) */
.form-switch:not(.form-check) {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.form-switch:not(.form-check) input {
  opacity: 0;
  width: 0;
  height: 0;
}

.form-switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--neutral-300);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.form-switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--bg-surface);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.form-switch input:checked + .form-switch-slider {
  background-color: var(--primary);
}

.form-switch input:checked + .form-switch-slider::before {
  transform: translateX(20px);
}

.form-switch input:focus + .form-switch-slider {
  box-shadow: 0 0 0 3px var(--primary-ring);
}


/* ============================================
   3. CARDS - Enterprise Design
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-in-out);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-elevated {
  box-shadow: var(--shadow-card-elevated);
  border-color: transparent;
}

.card-elevated:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-card-hover), 0 0 0 1px var(--primary-100);
}

.card-interactive:active {
  transform: scale(0.99);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-title-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.card-body {
  padding: var(--space-6);
}

.card-body-compact {
  padding: var(--space-4);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Card Variants */
.card-primary {
  border-color: var(--primary-200);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--primary-50) 100%);
}

.card-success {
  border-color: var(--success-200);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--success-50) 100%);
}

.card-warning {
  border-color: var(--warning-200);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--warning-50) 100%);
}

.card-danger {
  border-color: var(--danger-200);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--danger-50) 100%);
}

/* Card Glass Effect */
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-color: rgba(255,255,255,0.3);
}


/* ============================================
   4. ALERTS - Notification Banners
   ============================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.alert-message {
  color: inherit;
  opacity: 0.9;
}

.alert-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition-fast);
  margin: -4px -8px -4px 0;
}

.alert-close:hover {
  opacity: 1;
  background: rgba(0,0,0,0.05);
}

/* Alert Variants */
.alert-info {
  background: var(--info-50);
  border-color: var(--info-200);
  color: var(--info-700);
}

.alert-info .alert-icon {
  color: var(--info-500);
}

.alert-success {
  background: var(--success-50);
  border-color: var(--success-200);
  color: var(--success-700);
}

.alert-success .alert-icon {
  color: var(--success-500);
}

.alert-warning {
  background: var(--warning-50);
  border-color: var(--warning-200);
  color: var(--warning-700);
}

.alert-warning .alert-icon {
  color: var(--warning-500);
}

.alert-danger,
.alert-error {
  background: var(--danger-50);
  border-color: var(--danger-200);
  color: var(--danger-700);
}

.alert-danger .alert-icon,
.alert-error .alert-icon {
  color: var(--danger-500);
}

/* Alert with Action */
.alert-action {
  flex-shrink: 0;
  margin-left: var(--space-4);
}


/* ============================================
   5. BADGES / STATUS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-2-5);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Badge Variants */
.badge-primary {
  background: var(--primary-100);
  color: var(--primary-700);
}

.badge-secondary {
  background: var(--neutral-100);
  color: var(--neutral-600);
}

.badge-success {
  background: var(--success-100);
  color: var(--success-700);
}

.badge-warning {
  background: var(--warning-100);
  color: var(--warning-700);
}

.badge-danger {
  background: var(--danger-100);
  color: var(--danger-700);
}

.badge-info {
  background: var(--info-100);
  color: var(--info-700);
}

/* Badge Solid */
.badge-solid-primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.badge-solid-success {
  background: var(--success);
  color: var(--text-inverse);
}

.badge-solid-danger {
  background: var(--danger);
  color: var(--text-inverse);
}

/* Badge Outline */
.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* Badge Dot */
.badge-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
}

.badge-dot-success {
  background: var(--success);
}

.badge-dot-warning {
  background: var(--warning);
}

.badge-dot-danger {
  background: var(--danger);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  border: 1px solid;
}

.status-badge-draft {
  background: var(--status-draft-bg);
  color: var(--status-draft-text);
  border-color: var(--status-draft-border);
}

.status-badge-scheduled {
  background: var(--status-scheduled-bg);
  color: var(--status-scheduled-text);
  border-color: var(--status-scheduled-border);
}

.status-badge-publishing {
  background: var(--status-publishing-bg);
  color: var(--status-publishing-text);
  border-color: var(--status-publishing-border);
}

.status-badge-published {
  background: var(--status-published-bg);
  color: var(--status-published-text);
  border-color: var(--status-published-border);
}

.status-badge-failed {
  background: var(--status-failed-bg);
  color: var(--status-failed-text);
  border-color: var(--status-failed-border);
}


/* ============================================
   7. AVATARS
   ============================================ */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary-100);
  color: var(--primary-700);
  font-weight: var(--font-semibold);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar Sizes */
.avatar-xs { width: 24px; height: 24px; font-size: var(--text-2xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-base); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-xl); }
.avatar-2xl { width: 80px; height: 80px; font-size: var(--text-2xl); }

/* Avatar Status */
.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 25%;
  height: 25%;
  min-width: 8px;
  min-height: 8px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.avatar-status-online { background: var(--success); }
.avatar-status-offline { background: var(--neutral-400); }
.avatar-status-busy { background: var(--danger); }
.avatar-status-away { background: var(--warning); }

/* Avatar Group */
.avatar-group {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--bg-surface);
  transition: var(--transition-fast);
}

.avatar-group .avatar:hover {
  z-index: 1;
  transform: translateY(-2px);
}

.avatar-group .avatar:last-child {
  margin-left: 0;
}


/* ============================================
   A11: THEME TOGGLE (GLOBAL)
   ============================================ */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  position: relative;
  line-height: 1;
}

/* Light mode: show moon icon (click → switch to dark) */
.theme-toggle .theme-icon-dark { display: inline; }
.theme-toggle .theme-icon-light { display: none; }

/* Dark mode: show sun icon (click → switch to light) */
[data-bs-theme="dark"] .theme-toggle .theme-icon-dark { display: none; }
[data-bs-theme="dark"] .theme-toggle .theme-icon-light { display: inline; color: #fbbf24; }


/* ============================================
   FLASH MESSAGES
   ============================================ */

.flash-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
}

.flash-message {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--info);
  animation: flash-slide-in 0.3s var(--ease-spring);
}

.flash-message.success {
  border-left-color: var(--success);
}

.flash-message.error {
  border-left-color: var(--danger);
}

.flash-message.warning {
  border-left-color: var(--warning);
}

.flash-close {
  background: transparent;
  border: none;
  padding: var(--space-1);
  margin-left: auto;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.flash-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* M10: Flash auto-dismiss progress bar */
.flash-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  animation: flash-countdown 5s linear forwards;
}

.flash-message {
  position: relative;
  overflow: hidden;
}

.flash-message:hover .flash-progress {
  animation-play-state: paused;
}

@keyframes flash-countdown {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes flash-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
    max-height: 100px;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
    max-height: 0;
  }
}

@keyframes flash-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* ============================================
   DROPDOWN MENUS
   ============================================ */

.dropdown-menu {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  min-width: 200px;
  z-index: var(--z-dropdown);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2-5) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.active {
  background: var(--primary-50);
  color: var(--primary);
}

.dropdown-item i {
  width: 18px;
  text-align: center;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) 0;
}

.dropdown-header {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ============================================
   DARK HEADER TEXT FIX
   ============================================
   When containers have dark/gradient backgrounds,
   h1-h6 and p elements inherit --text-primary/secondary
   from tokens.css base resets. These overrides
   ensure white text on dark headers.
   ============================================ */

.page-header h1, .page-header h2, .page-header h3,
.page-header h4, .page-header h5, .page-header h6,
.page-header p, .page-header .headline,
.lead-header h1, .lead-header h2, .lead-header h3,
.lead-header h4, .lead-header h5, .lead-header h6,
.lead-header p, .lead-header .headline,
.company-header h1, .company-header h2, .company-header h3,
.company-header h4, .company-header h5, .company-header h6,
.company-header p, .company-header .tagline,
.deal-header h1, .deal-header h2, .deal-header h3,
.deal-header h4, .deal-header h5, .deal-header h6,
.deal-header p {
  color: var(--text-inverse, #fff) !important;
}

/* ============================================
   DARK MODE — COMPONENT OVERRIDES
   Garante legibilidade de alerts, badges,
   stat icons e notificações nos fundos escuros.
   Tokens -50/-100 já são dark via tokens.css,
   mas -700 text colors precisam ser claros.
   ============================================ */

/* Alerts: texto claro sobre fundo dark tintado */
[data-bs-theme="dark"] .alert-info { color: var(--info-text); }
[data-bs-theme="dark"] .alert-info .alert-icon { color: var(--info-text); }
[data-bs-theme="dark"] .alert-success { color: var(--success-text); }
[data-bs-theme="dark"] .alert-success .alert-icon { color: var(--success-text); }
[data-bs-theme="dark"] .alert-warning { color: var(--warning-text); }
[data-bs-theme="dark"] .alert-warning .alert-icon { color: var(--warning-text); }
[data-bs-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-error { color: var(--danger-text); }
[data-bs-theme="dark"] .alert-danger .alert-icon,
[data-bs-theme="dark"] .alert-error .alert-icon { color: var(--danger-text); }

/* Badges: texto claro sobre fundo dark tintado */
[data-bs-theme="dark"] .badge-primary { color: var(--primary-300); }
[data-bs-theme="dark"] .badge-success { color: var(--success-text); }
[data-bs-theme="dark"] .badge-warning { color: var(--warning-text); }
[data-bs-theme="dark"] .badge-danger { color: var(--danger-text); }
[data-bs-theme="dark"] .badge-info { color: var(--info-text); }

/* Stat card icons */
[data-bs-theme="dark"] .stat-card-icon.success { color: var(--success-text); }
[data-bs-theme="dark"] .stat-card-icon.danger { color: var(--danger-text); }
[data-bs-theme="dark"] .stat-card-icon.info { color: var(--info-text); }

/* Notification icons */
[data-bs-theme="dark"] .notification-icon.success { color: var(--success-text); }
[data-bs-theme="dark"] .notification-icon.danger { color: var(--danger-text); }
[data-bs-theme="dark"] .notification-icon.info { color: var(--info-text); }

/* Form-select arrow visibility in dark mode */
[data-bs-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Ghost button hover/active */
[data-bs-theme="dark"] .btn-ghost:hover { color: var(--primary-300); }
[data-bs-theme="dark"] .btn-ghost:active { color: var(--primary-300); }
