/* ============================================================================
 * SYNC DASHBOARD UI STYLES
 * ============================================================================
 * Version: 1.0.0
 * Part of the IGA Connector Framework
 * ============================================================================ */

/* ============================================================================
 * SYNC SECTION LAYOUT
 * ============================================================================ */

.sync-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-primary, white);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e5e7eb);
}

.sync-section.csv-mode {
  padding: 0;
  background: transparent;
  border: none;
}

.sync-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.sync-header h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.sync-header h4 svg {
  width: 20px;
  height: 20px;
  color: var(--primary, #3b82f6);
}

.sync-actions {
  display: flex;
  gap: 0.75rem;
}

.sync-info-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--info-light, #eff6ff);
  border: 1px solid var(--info-border, #bfdbfe);
  border-radius: 10px;
}

.sync-info-banner > svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--info, #3b82f6);
}

.sync-info-banner > div {
  flex: 1;
}

.sync-info-banner strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-primary, #111827);
}

.sync-info-banner p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
}

/* ============================================================================
 * SYNC STATUS GRID
 * ============================================================================ */

.sync-status-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .sync-status-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .sync-status-grid {
    grid-template-columns: 1fr;
  }
}

/* Main Status Card */
.sync-status-card.main-status {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--status-bg, #f3f4f6);
  border-radius: 10px;
  border-left: 4px solid var(--status-color, #9ca3af);
}

.sync-status-card .status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: white;
  border-radius: 10px;
  color: var(--status-color, #9ca3af);
}

.sync-status-card .status-icon svg {
  width: 24px;
  height: 24px;
}

.sync-status-card .status-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sync-status-card .status-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.sync-status-card .status-time,
.sync-status-card .status-next {
  font-size: 0.8rem;
  color: var(--text-secondary, #6b7280);
}

.sync-status-card .status-error {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--error-light, #fee2e2);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--error-dark, #991b1b);
}

.sync-status-card .status-error svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Stat Cards */
.sync-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
  border: 1px solid var(--border-color, #e5e7eb);
}

.sync-stat-card .stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary-light, #dbeafe);
  border-radius: 8px;
  color: var(--primary, #3b82f6);
}

.sync-stat-card .stat-icon svg {
  width: 20px;
  height: 20px;
}

.sync-stat-card .stat-info {
  display: flex;
  flex-direction: column;
}

.sync-stat-card .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.sync-stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
}

/* ============================================================================
 * SYNC DETAILS
 * ============================================================================ */

.sync-details {
  padding: 1rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.sync-details h5 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.sync-details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .sync-details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sync-details .detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sync-details .detail-label {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sync-details .detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary, #111827);
}

.sync-details-empty {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  color: var(--text-secondary, #6b7280);
}

.sync-details-empty svg {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary, #9ca3af);
}

.sync-details-empty p {
  margin: 0;
  font-size: 0.9rem;
}

/* ============================================================================
 * SYNC HISTORY TABLE
 * ============================================================================ */

.sync-history-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.sync-history-section .section-header h5 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #111827);
}

.sync-history-section .section-header h5 svg {
  width: 18px;
  height: 18px;
  color: var(--primary, #3b82f6);
}

.sync-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sync-history-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary, #6b7280);
  background: var(--bg-tertiary, #f3f4f6);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.sync-history-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
  color: var(--text-primary, #111827);
}

.sync-history-table .history-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.sync-history-table .history-row:hover {
  background: var(--bg-hover, #f9fafb);
}

.sync-type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.sync-type-badge.full {
  background: var(--primary-light, #dbeafe);
  color: var(--primary-dark, #1e40af);
}

.sync-type-badge.delta {
  background: var(--success-light, #d1fae5);
  color: var(--success-dark, #065f46);
}

.sync-type-badge.manual {
  background: var(--warning-light, #fef3c7);
  color: var(--warning-dark, #92400e);
}

.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--status-bg, #f3f4f6);
  color: var(--status-color, #6b7280);
}

.sync-status-badge svg {
  width: 14px;
  height: 14px;
}

.sync-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--text-tertiary, #9ca3af);
  text-align: center;
}

.sync-history-empty svg {
  width: 32px;
  height: 32px;
}

.sync-history-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light, #f3f4f6);
}

.btn-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pagination:hover:not(:disabled) {
  background: var(--bg-hover, #f3f4f6);
  border-color: var(--primary, #3b82f6);
}

.btn-pagination:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-pagination svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary, #6b7280);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-secondary, #6b7280);
}

/* ============================================================================
 * SYNC DETAIL MODAL
 * ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-container {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
}

.modal-close:hover {
  background: var(--bg-secondary, #f9fafb);
}

.modal-body {
  padding: 1.25rem;
}

.sync-detail-modal {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sync-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--status-bg, #f3f4f6);
  border-radius: 10px;
}

.sync-detail-header svg {
  width: 32px;
  height: 32px;
}

.sync-detail-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.sync-detail-header span {
  font-size: 0.85rem;
  color: var(--text-secondary, #6b7280);
}

.sync-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
}

.sync-detail-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.sync-detail-stats .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
}

.sync-detail-stats .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
}

.sync-detail-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sync-detail-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
}

.sync-detail-info .info-label {
  color: var(--text-secondary, #6b7280);
  font-size: 0.875rem;
}

.sync-detail-info .info-value {
  font-weight: 500;
  color: var(--text-primary, #111827);
  font-size: 0.875rem;
}

.sync-detail-error {
  padding: 1rem;
  background: var(--error-light, #fee2e2);
  border-radius: 10px;
}

.sync-detail-error h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--error-dark, #991b1b);
}

.sync-detail-error h4 svg {
  width: 18px;
  height: 18px;
}

.sync-detail-error pre {
  margin: 0;
  padding: 0.75rem;
  background: white;
  border-radius: 6px;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
