/**
 * Frontend Bulk Actions - Frontend Styles
 *
 * @package Frontend_Bulk_Actions
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */
:root {
  --fba-primary: #007cba;
  --fba-primary-hover: #005a87;
  --fba-success: #28a745;
  --fba-warning: #ffc107;
  --fba-danger: #dc3545;
  --fba-gray-100: #f8f9fa;
  --fba-gray-200: #e9ecef;
  --fba-gray-300: #dee2e6;
  --fba-gray-400: #ced4da;
  --fba-gray-500: #adb5bd;
  --fba-gray-600: #6c757d;
  --fba-gray-700: #495057;
  --fba-gray-800: #343a40;
  --fba-gray-900: #212529;
  --fba-border-radius: 4px;
  --fba-transition: all 0.15s ease-in-out;
}

/* ==========================================================================
   Container
   ========================================================================== */
.fba-container {
  max-width: 100%;
  margin: 20px 0;
  background: #fff;
  border: 1px solid var(--fba-gray-300);
  border-radius: var(--fba-border-radius);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Error Message
   ========================================================================== */
.fba-error-message {
  padding: 20px;
  background: #f8d7da;
  color: #721c24;
  border-radius: var(--fba-border-radius);
  text-align: center;
}

/* ==========================================================================
   Actions Bar
   ========================================================================== */
.fba-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--fba-gray-100);
  border-bottom: 1px solid var(--fba-gray-300);
  flex-wrap: wrap;
  gap: 10px;
  min-height: 60px;
}

.fba-actions-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.fba-actions-right {
  font-size: 14px;
  color: var(--fba-gray-600);
  font-weight: 500;
}

.fba-select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  color: var(--fba-gray-700);
}

.fba-select-all-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.fba-action-select {
  padding: 8px 12px;
  border: 1px solid var(--fba-gray-400);
  border-radius: var(--fba-border-radius);
  background: white;
  min-width: 150px;
  font-size: 14px;
  color: var(--fba-gray-700);
  cursor: pointer;
}

.fba-action-select:focus {
  outline: none;
  border-color: var(--fba-primary);
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.fba-btn {
  padding: 8px 16px;
  border: 1px solid var(--fba-gray-400);
  border-radius: var(--fba-border-radius);
  background: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  transition: var(--fba-transition);
  user-select: none;
  color: var(--fba-gray-700);
}

.fba-btn:hover {
  background: var(--fba-gray-200);
  border-color: var(--fba-gray-500);
  text-decoration: none;
}

.fba-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.fba-btn-primary {
  background: var(--fba-primary);
  color: white;
  border-color: var(--fba-primary);
}

.fba-btn-primary:hover {
  background: var(--fba-primary-hover);
  border-color: var(--fba-primary-hover);
  color: white;
}

.fba-btn-danger {
  color: var(--fba-danger);
  border-color: var(--fba-danger);
}

.fba-btn-danger:hover {
  background: var(--fba-danger);
  color: white;
}

.fba-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.fba-btn:disabled {
  background: var(--fba-gray-200);
  color: var(--fba-gray-600);
  cursor: not-allowed;
  border-color: var(--fba-gray-400);
  opacity: 0.65;
}

/* ==========================================================================
   Filters Bar
   ========================================================================== */
.fba-filters-bar {
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid var(--fba-gray-300);
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.fba-filters-left {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
}

.fba-filters-right {
  display: flex;
  gap: 15px;
  align-items: center;
}

.fba-result-counter {
  font-size: 14px;
  color: var(--fba-gray-700);
  font-weight: 600;
  white-space: nowrap;
}

.fba-search-box {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 250px;
}

.fba-search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--fba-gray-400);
  border-radius: var(--fba-border-radius);
  font-size: 14px;
}

.fba-search-input:focus {
  outline: none;
  border-color: var(--fba-primary);
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.fba-filter-box {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.fba-filter-box select {
  padding: 8px 12px;
  border: 1px solid var(--fba-gray-400);
  border-radius: var(--fba-border-radius);
  background: white;
  font-size: 14px;
  min-width: 120px;
  cursor: pointer;
}

.fba-filter-box select:focus {
  outline: none;
  border-color: var(--fba-primary);
}

.fba-clear-filters {
  padding: 8px 16px;
  border: 1px solid var(--fba-danger);
  border-radius: var(--fba-border-radius);
  background: white;
  color: var(--fba-danger);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--fba-transition);
  white-space: nowrap;
}

.fba-clear-filters:hover:not(:disabled) {
  background: var(--fba-danger);
  color: white;
}

.fba-clear-filters:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--fba-gray-400);
  color: var(--fba-gray-600);
}

/* ==========================================================================
   View Toggle
   ========================================================================== */
.fba-view-toggle {
  display: flex;
  gap: 5px;
  padding: 10px 20px;
  background: var(--fba-gray-100);
  border-bottom: 1px solid var(--fba-gray-300);
}

.fba-view-btn {
  display: flex;
  align-items: center;
  gap: 5px;
}

.fba-view-btn.active {
  background: var(--fba-primary);
  color: white;
  border-color: var(--fba-primary);
}

/* ==========================================================================
   Table View
   ========================================================================== */
.fba-table-container {
  overflow-x: auto;
  background: white;
}

.fba-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin: 0;
}

.fba-table thead th {
  background: var(--fba-gray-100);
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  color: var(--fba-gray-700);
  border-bottom: 2px solid var(--fba-gray-300);
  white-space: nowrap;
}

.fba-table tbody td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--fba-gray-200);
  vertical-align: middle;
  font-size: 14px;
  color: var(--fba-gray-700);
}

.fba-table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.fba-table tbody tr:hover {
  background: var(--fba-gray-100);
}

.fba-col-check {
  width: 40px;
  text-align: center;
  padding: 8px !important;
}

.fba-col-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.fba-col-title {
  min-width: 200px;
  max-width: 300px;
}

.fba-col-title strong a {
  color: var(--fba-primary);
  text-decoration: none;
  font-weight: 600;
}

.fba-col-title strong a:hover {
  color: var(--fba-primary-hover);
  text-decoration: underline;
}

.fba-post-state {
  color: var(--fba-gray-600);
  font-weight: normal;
  font-size: 13px;
}

.fba-col-actions {
  white-space: nowrap;
}

.fba-action-link {
  color: var(--fba-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.fba-col-actions .fba-action-link::before,
.fba-col-actions .fba-action-link::after {
  content: none !important;
}

.fba-action-link:hover {
  color: var(--fba-primary-hover);
  text-decoration: underline;
}

.fba-action-sep {
  margin: 0 5px;
  color: var(--fba-gray-400);
}

.fba-delete-link {
  color: var(--fba-danger) !important;
}

.fba-delete-link:hover {
  color: #c82333 !important;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */
.fba-status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

.fba-status-publish {
  background: transparent;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.fba-status-draft {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.fba-status-pending {
  background: #e2e3e5;
  color: #383d41;
  border: 1px solid #d6d8db;
}

.fba-status-private {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.fba-status-trash {
  background: #e2e3e5;
  color: #383d41;
  border: 1px solid #d6d8db;
}

/* ==========================================================================
   Card View
   ========================================================================== */
.fba-cards-container {
  padding: 20px;
  background: var(--fba-gray-100);
}

.fba-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.fba-card {
  background: white;
  border-radius: var(--fba-border-radius);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: var(--fba-transition);
}

.fba-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.fba-card-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  background: white;
  border-radius: 4px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.fba-card-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.fba-card-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--fba-gray-200);
}

.fba-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fba-card-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--fba-gray-500);
}

.fba-card-no-image .dashicons {
  font-size: 48px;
  width: 48px;
  height: 48px;
}

.fba-card-thumbnail .fba-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

.fba-card-content {
  padding: 15px;
}

.fba-card-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.fba-card-title a {
  color: var(--fba-gray-800);
  text-decoration: none;
}

.fba-card-title a:hover {
  color: var(--fba-primary);
}

.fba-card-excerpt {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--fba-gray-600);
  line-height: 1.5;
}

.fba-card-meta {
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: var(--fba-gray-600);
}

.fba-card-meta .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 3px;
}

.fba-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 15px;
  border-top: 1px solid var(--fba-gray-200);
  background: var(--fba-gray-100);
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.fba-pagination {
  padding: 20px;
  text-align: center;
  background: var(--fba-gray-100);
  border-top: 1px solid var(--fba-gray-300);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fba-page-link {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--fba-gray-300);
  border-radius: var(--fba-border-radius);
  background: white;
  color: var(--fba-primary);
  font-size: 14px;
  font-weight: 500;
  min-width: 40px;
  text-align: center;
  transition: var(--fba-transition);
  cursor: pointer;
  line-height: 1.4;
  text-decoration: none;
  outline: none;
}

.fba-page-link:hover {
  background: var(--fba-gray-200);
  border-color: var(--fba-gray-500);
  color: var(--fba-primary-hover);
}

.fba-page-link.current {
  background: var(--fba-primary);
  color: white;
  border-color: var(--fba-primary);
  cursor: default;
}

.fba-page-dots {
  padding: 8px 4px;
  color: var(--fba-gray-600);
}

/* ==========================================================================
   No Posts
   ========================================================================== */
.fba-no-posts {
  text-align: center;
  padding: 60px 20px;
  color: var(--fba-gray-600);
  background: white;
}

/* ==========================================================================
   Loading
   ========================================================================== */
.fba-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--fba-gray-600);
  background: white;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 100;
}

.fba-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--fba-gray-300);
  border-top: 3px solid var(--fba-primary);
  border-radius: 50%;
  animation: fba-spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes fba-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Messages
   ========================================================================== */
.fba-messages {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
  pointer-events: none;
}

.fba-message {
  margin-bottom: 10px;
  padding: 15px 45px 15px 15px;
  border-radius: var(--fba-border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  pointer-events: auto;
  border-left: 4px solid;
  animation: fba-slide-in 0.3s ease;
}

@keyframes fba-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fba-message-success {
  background: #d4edda;
  color: #155724;
  border-left-color: #28a745;
}

.fba-message-error {
  background: #f8d7da;
  color: #721c24;
  border-left-color: #dc3545;
}

.fba-message-info {
  background: #cce5ff;
  color: #004085;
  border-left-color: #007bff;
}

.fba-message-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  line-height: 1;
}

.fba-message-close:hover {
  opacity: 1;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.fba-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fba-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.fba-modal-content {
  position: relative;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: fba-modal-in 0.3s ease;
}

@keyframes fba-modal-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fba-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--fba-gray-300);
}

.fba-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.fba-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--fba-gray-600);
  padding: 0;
  line-height: 1;
}

.fba-modal-close:hover {
  color: var(--fba-gray-800);
}

.fba-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.fba-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--fba-gray-300);
  background: var(--fba-gray-100);
}

/* ==========================================================================
   Form Elements in Modal
   ========================================================================== */
.fba-field-group {
  margin-bottom: 15px;
}

.fba-field-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 14px;
}

.fba-field-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--fba-gray-400);
  border-radius: var(--fba-border-radius);
  font-size: 14px;
}

.fba-field-input:focus {
  outline: none;
  border-color: var(--fba-primary);
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.fba-checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: normal;
}

/* ==========================================================================
   Term Tree
   ========================================================================== */
.fba-term-tree {
  list-style: none;
  padding-left: 20px;
  margin: 0;
}

.fba-term-tree.level-0 {
  padding-left: 0;
}

.fba-term-tree li {
  margin-bottom: 5px;
}

.fba-term-tree label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.fba-term-tree input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.fba-term-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--fba-gray-600);
}

.fba-term-toggle:hover {
  color: var(--fba-gray-800);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .fba-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .fba-actions-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 15px;
  }

  .fba-actions-left {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 10px;
  }

  .fba-action-select,
  .fba-apply-action {
    width: 100%;
    margin: 0;
  }

  .fba-actions-right {
    text-align: center;
  }

  .fba-filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
    padding: 15px;
  }

  .fba-filters-left {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .fba-search-box {
    flex-direction: column;
    width: 100%;
    min-width: unset;
  }

  .fba-search-input,
  .fba-search-btn {
    width: 100%;
  }

  .fba-filter-box {
    flex-direction: column;
    width: 100%;
  }

  .fba-filter-box select,
  .fba-author-filter,
  .fba-date-filter,
  .fba-status-filter,
  .fba-tax-filter {
    width: 100% !important;
    margin-right: 0 !important;
  }

  .fba-tax-filter-group {
    display: block !important;
    margin-right: 0 !important;
    width: 100%;
  }

  .fba-filters-right {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .fba-clear-filters {
    width: 100%;
  }

  .fba-result-counter {
    text-align: center;
    width: 100%;
  }

  /* Table Responsiveness */
  .fba-table-container {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--fba-gray-200);
  }

  .fba-table-container::after {
    content: "Scroll →";
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0.7;
  }

  .fba-table {
    font-size: 13px;
    min-width: 600px; /* Force scroll if screen is too small */
  }

  .fba-table thead th,
  .fba-table tbody td {
    padding: 10px 8px;
  }

  /* Larger touch targets for mobile */
  input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
  }

  .fba-btn {
    padding: 12px 20px; /* Larger buttons for fingers */
  }

  .fba-btn-sm {
    padding: 8px 15px;
  }

  .fba-action-link {
    display: inline-block;
    padding: 5px 0;
  }

  .fba-cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .fba-pagination {
    gap: 4px;
  }

  .fba-page-link {
    padding: 6px 8px;
    min-width: 30px;
    font-size: 12px;
  }
}
