/* ============================================
   ACTION BUTTONS WITH ICONS
   Botões de ação modernos com apenas ícones
   ============================================ */

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  transition: all 0.2s ease;
}

/* View Button (Primary - Olho) */
.btn-icon-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-icon-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 195, 189, 0.3);
}

.btn-icon-primary svg {
  stroke: white;
}

/* Edit Button (Lápis) */
.btn-icon-edit {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.btn-icon-edit:hover {
  background: var(--accent-2);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.btn-icon-edit:hover svg {
  stroke: white;
}

.btn-icon-edit svg {
  stroke: var(--accent-2);
}

/* Delete Button (Lixeira) */
.btn-icon-delete {
  background: var(--danger);
  border-color: white;
  color: white;
}

.btn-icon-delete svg {
  stroke: white;
}

.btn-icon-delete:hover {
  background: #dc2626; /* Vermelho mais escuro */
  border-color: white;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

.btn-icon-delete:hover svg {
  stroke: white;
}

/* Add Button (Plus) */
.btn-icon-add {
  border-color: var(--success);
  color: var(--success);
}

.btn-icon-add:hover {
  background: var(--success);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-icon-add:hover svg {
  stroke: white;
}

.btn-icon-add svg {
  stroke: var(--success);
}

/* Complete Button (Check Circle) */
.btn-icon-complete {
  background: transparent;
  border-color: #10b981; /* Verde */
  color: #10b981;
}

.btn-icon-complete svg {
  stroke: #10b981;
}

.btn-icon-complete:hover {
  background: #10b981; /* Fundo verde */
  border-color: #10b981;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-icon-complete:hover svg {
  stroke: white;
}

/* Reopen Button (Refresh) */
.btn-icon-reopen {
  background: transparent;
  border-color: #10b981; /* Verde */
  color: #10b981;
}

.btn-icon-reopen svg {
  stroke: #10b981;
}

.btn-icon-reopen:hover {
  background: #10b981; /* Fundo verde */
  border-color: #10b981;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-icon-reopen:hover svg {
  stroke: white;
}

/* Locked Button (Disabled) */
.btn-icon-locked {
  background: transparent;
  border-color: #9ca3af; /* Cinza */
  color: #9ca3af;
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon-locked svg {
  stroke: #9ca3af;
}

/* Disabled state */
.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Tooltip on hover */
.btn-icon::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.btn-icon::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.btn-icon:hover::after,
.btn-icon:hover::before {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .btn-icon {
    width: 32px;
    height: 32px;
  }
  
  .btn-icon svg {
    width: 16px;
    height: 16px;
  }
}

/* Actions container - Force horizontal layout for icon buttons */
.customer-actions,
.project-actions {
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  margin-top: 1rem;
}

/* Override any flex: 1 from styles.css for icon buttons */
.customer-actions .btn-icon,
.project-actions .btn-icon {
  flex: none !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px;
  padding: 0 !important;
  margin: 0;
}

/* Legacy buttons with text - keep original behavior */
.customer-actions button:not(.btn-icon),
.project-actions button:not(.btn-icon) {
  flex: 1;
  padding: 0.5rem 0.875rem;
  min-width: auto;
  width: auto;
}

/* List view - keep icons horizontal */
.customers-cards.list-view .customer-actions,
.projects-cards.list-view .project-actions,
.teams-cards.list-view .project-actions,
.finance-cards.list-view .customer-actions,
.finance-cards.list-view .project-actions,
.invoices-cards.list-view .project-actions,
.cash-cards.list-view .project-actions {
  flex-direction: row !important;
  margin-left: auto;
  margin-top: 0;
  gap: 8px;
}

/* Grid view optimization */
.customers-cards.grid-view .customer-card,
.projects-cards.grid-view .project-card,
.teams-cards.grid-view .team-card,
.finance-cards.grid-view .customer-card,
.invoices-cards.grid-view .invoice-card,
.cash-cards.grid-view .cash-card {
  display: flex;
  flex-direction: column;
}

.customers-cards.grid-view .customer-actions,
.projects-cards.grid-view .project-actions,
.teams-cards.grid-view .project-actions,
.finance-cards.grid-view .customer-actions,
.invoices-cards.grid-view .project-actions,
.cash-cards.grid-view .project-actions {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .customer-actions,
  .project-actions {
    flex-direction: row !important;
    justify-content: center;
    gap: 12px;
  }
  
  .customer-actions .btn-icon,
  .project-actions .btn-icon {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .customer-actions,
  .project-actions {
    gap: 8px;
  }
}

/* Smooth focus state */
.btn-icon:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 195, 189, 0.2);
}

.btn-icon-edit:focus {
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.btn-icon-delete:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Better hover states - Override individual button hovers */
.btn-icon:hover {
  transform: translateY(-2px) scale(1.05) !important;
}

.btn-icon:active {
  transform: translateY(0) scale(0.98) !important;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .btn-icon {
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .btn-icon:not(.btn-icon-primary):not(:hover) {
    background: rgba(255, 255, 255, 0.05);
  }
}
