/* ========================================
   Meu AC4 - Component Styles
   Reusable UI components
   ======================================== */

/* ==================== Badge ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: var(--primary-bg);
  color: var(--primary);
}

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

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

.badge-error {
  background: var(--error-bg);
  color: var(--error);
}

.badge-ac4 {
  background: var(--ac4-bg);
  color: var(--ac4);
}

.badge-ordinario {
  background: var(--ordinario-bg);
  color: var(--ordinario);
}

/* ==================== Divider ==================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ==================== Tag / Chip ==================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.tag-removable {
  cursor: pointer;
  transition: all 0.2s;
}

.tag-removable:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

/* ==================== Progress Bar ==================== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
  background: var(--primary);
}

.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.error { background: var(--error); }

/* ==================== Tooltip ==================== */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 50;
}

.tooltip-wrapper:hover .tooltip-content {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ==================== Modal / Overlay ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  width: 100%;
  max-width: var(--max-width);
  max-height: 85vh;
  background: var(--glass-bg-strong, rgba(255,255,255,0.12));
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: var(--glass-border, 1px solid rgba(255,255,255,0.15));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--bottom-safe-area));
  animation: slideUp 0.3s ease;
  overflow-y: auto;
  box-shadow: var(--glass-shadow, 0 8px 32px rgba(0,0,0,0.12));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-close:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ==================== Skeleton Loader ==================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-sm);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-card {
  height: 80px;
  width: 100%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==================== Pull to Refresh ==================== */
.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  color: var(--text-muted);
  font-size: 13px;
}

.pull-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: var(--space-sm);
}

/* ==================== Dropdown ==================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--glass-bg-strong, rgba(255,255,255,0.12));
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow-strong, 0 12px 40px rgba(0,0,0,0.2));
  z-index: 50;
  padding: var(--space-xs);
  display: none;
}

.dropdown-menu.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.dropdown-item:hover {
  background: rgba(255,255,255,0.1);
}

.dropdown-item-danger {
  color: var(--error);
}

.dropdown-item-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ==================== Floating Action Button ==================== */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--bottom-safe-area) + var(--space-lg));
  right: calc(50% - var(--max-width) / 2 + var(--space-lg));
  min-width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all 0.2s;
  z-index: 90;
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-xl);
}

.fab:active {
  transform: scale(0.95);
}

/* ==================== Empty State Variants ==================== */
.empty-state-sm {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-sm .empty-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.empty-state-sm p {
  font-size: 13px;
}

/* ==================== List Group ==================== */
.list-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg-card);
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
  cursor: pointer;
}

.list-group-item:hover {
  background: var(--bg);
}

.list-group-item:active {
  background: var(--border-light);
}

.list-group-item-primary {
  border-left: 3px solid var(--primary);
}

.list-group-item-success {
  border-left: 3px solid var(--success);
}

.list-group-item-warning {
  border-left: 3px solid var(--warning);
}

/* ==================== Stepper / Counter ==================== */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg);
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}

.stepper-btn:hover {
  background: var(--border);
}

.stepper-value {
  width: 48px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font);
}

/* ==================== Search Bar ==================== */
.search-bar {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  transition: all 0.2s;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==================== Info Banner ==================== */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.info-banner-info {
  background: var(--info-bg);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.info-banner-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.info-banner-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.info-banner-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.info-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ==================== Data Table (Simple) ==================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.data-table tr:hover td {
  background: var(--bg);
}

/* ==================== Bottom Sheet ==================== */
.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--max-width);
  max-height: 80vh;
  background: var(--glass-bg-strong, rgba(255,255,255,0.12));
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--bottom-safe-area));
  z-index: 200;
  transition: transform 0.3s ease;
  box-shadow: var(--glass-shadow-strong, 0 12px 40px rgba(0,0,0,0.2));
  overflow-y: auto;
}

.bottom-sheet.open {
  transform: translateX(-50%) translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto var(--space-lg);
}

/* ==================== Notification Dot ==================== */
.notif-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* ==================== Coming Soon ==================== */
.coming-soon {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
  border-top: 1px solid var(--border, #e2e8f0);
  margin-top: 24px;
}

/* ==================== Animations ==================== */
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOut {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-slide-in {
  animation: slideIn 0.3s ease;
}

.animate-slide-out {
  animation: slideOut 0.3s ease;
}
