/* Custom styles for Meta Ads Viewer */

.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.ad-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.ad-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.preview-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.ad-preview-placeholder {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 4px;
  padding: 2rem;
  text-align: center;
  color: #6c757d;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}

.navbar-brand-text {
  font-weight: 600;
  font-size: 1.25rem;
}

.empty-icon {
  font-size: 4rem;
  color: #d6dae1;
}

.btn-group-vertical .btn {
  margin-bottom: 0.5rem;
}

.btn-group-vertical .btn:last-child {
  margin-bottom: 0;
}

/* Loading spinner */
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

/* Card image container */
.card-img-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: #f8f9fa;
  overflow: hidden;
}

.card-img-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-img-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #d6dae1;
  font-size: 3rem;
}

/* Status indicators */
.status-active {
  background-color: #2fb344;
  color: white;
}

.status-paused {
  background-color: #d63939;
  color: white;
  cursor: help;
}

/* Modal improvements */
.modal-blur {
  backdrop-filter: blur(4px);
}

/* Preview modal */
.preview-container {
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.preview-image-large {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ad-preview-placeholder-large {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  padding: 4rem 2rem;
  text-align: center;
  color: #6c757d;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.ad-preview-placeholder-large i {
  font-size: 4rem;
  color: #d6dae1;
  margin-bottom: 1rem;
}

.modal-xl .modal-body {
  padding: 2rem;
}

.btn-list {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.btn-icon {
  padding: 0.375rem;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-ghost-secondary {
  color: #6c757d;
  background: transparent;
  border: none;
}

.btn-ghost-secondary:hover {
  color: #495057;
  background: #f8f9fa;
}

/* Filters */
.filters-container {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #e6e8eb;
}

.filter-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-item {
  flex: 1;
  min-width: 200px;
}

/* Table improvements */
.ad-row {
  transition: background-color 0.2s;
}

.ad-row:hover {
  background-color: #f8f9fa;
}

.table-vcenter td {
  vertical-align: middle;
}

.avatar.avatar-md {
  width: 48px;
  height: 48px;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sortable columns */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem !important;
}

.sortable:hover {
  background-color: #f8f9fa;
}

.sortable .sort-icon {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.sortable:hover .sort-icon {
  opacity: 1;
}

.sortable.sort-asc .sort-icon::before {
  content: "\ea5f"; /* ti-chevron-up */
  font-family: 'tabler-icons';
}

.sortable.sort-desc .sort-icon::before {
  content: "\ea61"; /* ti-chevron-down */
  font-family: 'tabler-icons';
}

.sortable.sort-asc .sort-icon,
.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: #206bc4;
}

/* Preview iframe */
.preview-iframe-container {
  width: 100%;
  height: 600px;
  border: 1px solid #e6e8eb;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fa;
  margin-bottom: 1rem;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .ad-card {
    margin-bottom: 1rem;
  }

  .navbar-brand-text {
    font-size: 1rem;
  }

  .table-responsive {
    font-size: 0.875rem;
  }

  .btn-group .btn {
    padding: 0.25rem 0.5rem;
  }

  .preview-iframe-container {
    height: 400px;
  }
}
