/**
 * VendasBoost - Custom Styles
 * Complementa o Tailwind CSS com estilos específicos
 * v7.0 - Multi-Account SaaS
 */

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* ============================================================================
   SCROLLBAR
   ============================================================================ */

.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ============================================================================
   SECTION TRANSITIONS
   ============================================================================ */

.section {
  display: none;
}

.section.active {
  display: block;
}

/* ============================================================================
   DROPDOWNS
   ============================================================================ */

.account-dropdown {
  display: none;
}

.account-dropdown.active {
  display: block;
}

.location-dropdown {
  display: none;
}

.location-dropdown.active {
  display: block;
}

/* ============================================================================
   PHOTO PREVIEW
   ============================================================================ */

.photo-preview-item {
  position: relative;
}

.photo-preview-item .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.photo-preview-item .remove-photo:hover {
  background: rgba(239, 68, 68, 1);
}

/* ============================================================================
   LOCATION AUTOCOMPLETE
   ============================================================================ */

.location-item {
  padding: 12px 16px;
  margin: 4px 8px;
  cursor: pointer !important;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
}

.location-item:first-child {
  margin-top: 8px;
}

.location-item:last-child {
  margin-bottom: 8px;
}

.location-item:hover {
  background: rgba(59, 130, 246, 0.2);
}

.location-item-title {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
  cursor: pointer !important;
}

.location-item-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
  cursor: pointer !important;
}

.location-no-results,
.location-loading {
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

/* ============================================================================
   MARKETPLACE LISTINGS
   ============================================================================ */

.mp-listing-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #334155;
  border-radius: 8px;
  transition: all 0.2s;
}

.mp-listing-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

.mp-listing-thumb {
  width: 60px !important;
  height: 60px !important;
  min-width: 60px;
  max-width: 60px;
  min-height: 60px;
  max-height: 60px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  background: #475569;
}

.mp-listing-info {
  flex: 1;
  min-width: 0;
}

.mp-listing-title {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-listing-price {
  font-size: 13px;
  color: #22c55e;
  font-weight: 600;
  margin-top: 4px;
}

.mp-listing-actions a {
  color: #3b82f6;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  transition: all 0.15s;
}

.mp-listing-actions a:hover {
  background: rgba(59, 130, 246, 0.2);
  text-decoration: none;
}

/* ============================================================================
   GROUPS LIST
   ============================================================================ */

.group-wrapper {
  margin-bottom: 8px;
}

.group-item {
  transition: all 0.15s;
}

.group-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* Indicador de post concluído */
.group-posted {
  border-left: 3px solid #22c55e;
  border-radius: 0.5rem;
}

/* Quando tem botão slide, ajusta o border-radius */
.group-wrapper.has-post .group-posted {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.posted-indicator {
  display: flex;
  align-items: center;
}

.posted-check {
  transition: all 0.2s ease;
}

/* Pulse animation para chamar atenção */
@keyframes pulse-green {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
}

.posted-check {
  animation: pulse-green 2s infinite;
}

/* Indicador de loading durante postagem */
.group-loading {
  border-left: 3px solid #3b82f6;
  background: rgba(59, 130, 246, 0.1) !important;
}

.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Pulse animation para o grupo loading */
@keyframes pulse-blue {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
}

.group-wrapper.is-loading .group-item {
  animation: pulse-blue 1.5s infinite;
}

/* Botão "Ver post" com slide para baixo */
.view-post-slide {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.group-wrapper.has-post:hover .view-post-slide {
  max-height: 50px;
  opacity: 1;
}

.view-post-slide .view-post-btn {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.pagination-btn {
  transition: all 0.15s;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================
   LOG ENTRIES
   ============================================================================ */

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  color: #64748b;
}

.log-success {
  color: #22c55e;
}

.log-error {
  color: #ef4444;
}

.log-info {
  color: #3b82f6;
}

/* ============================================================================
   EMPLOYEE VIEW (hide owner-only elements)
   ============================================================================ */

.hidden-employee {
  display: none !important;
}
