/**
 * Truebeep Customer Sync Admin Styles
 */

.truebeep-sync-wrap {
  max-width: 100%;
  width: 100%;
  margin: 20px 20px 20px 0;
}

.truebeep-sync-wrap h1 {
  display: flex;
  align-items: center;
  margin-bottom: 30px;
  font-size: 23px;
  font-weight: 600;
  color: #1d2327;
}

.truebeep-sync-wrap h1 .dashicons {
  color: #4a90e2;
}


.sync-status-card {
  width: calc(100% - 20px) !important;
  max-width: none !important;
  margin-bottom: 30px;
  margin-right: 20px;
  border-left: 4px solid #4a90e2;
  display: block !important;
  float: none !important;
  clear: both;
}

.sync-status-card .title {
  background: none;
  color: #1d2327;
  font-weight: 600;
  font-size: 16px;
  width: 100%;
  padding: 20px 24px 16px 24px;
  border-bottom: none;
}

.sync-status-card .card-body {
  width: 100%;
  padding: 0 24px 24px 24px;
}

.truebeep-sync-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-right: 20px;
}

.truebeep-sync-container .card {
  max-width: 100%;
}

/* Card Styling */
.truebeep-sync-wrap .card {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  overflow: hidden;
}

.truebeep-sync-wrap .card .title {
  font-size: 16px;
  font-weight: 600;
  padding: 20px 24px 16px 24px;
  margin: 0;
  border-bottom: none;
  background: none;
  color: #1d2327;
}

.truebeep-sync-wrap .card-body {
  padding: 0 24px 24px 24px;
}

/* Status Indicator */
.sync-status-indicator {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.status-idle {
  background: #f8f9fa;
  color: #6c757d;
  border-color: #dee2e6;
}

.status-preparing {
  background: #fff3cd;
  color: #856404;
  border-color: #ffeaa7;
}

.status-processing,
.status-running {
  background: #d1ecf1;
  color: #0c5460;
  border-color: #4a90e2;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

.status-completed {
  background: #d4edda;
  color: #155724;
  border-color: #28a745;
}

.status-cancelled {
  background: #f8d7da;
  color: #721c24;
  border-color: #dc3545;
}

.status-paused {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}

/* Progress Bar */
.progress-container {
  margin: 24px 20px 24px 0;
}

.progress-bar {
  height: 32px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #dee2e6;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.6) 25%,
    rgba(255, 255, 255, 0.15) 25%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.6) 75%,
    rgba(255, 255, 255, 0.15) 75%,
    rgba(255, 255, 255, 0.15)
  );
  background-size: 32px 32px;
  animation: progress-animation 1.5s linear infinite;
  transition: width 1s ease;
  box-shadow: 
    0 2px 8px rgba(40, 167, 69, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    transparent 100%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes progress-animation {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 32px 32px;
  }
}

/* Completed progress bar style */
.progress-fill.completed {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  animation: none;
}

.progress-fill.completed::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.5) 50%, 
    transparent 100%);
  animation: shimmer-complete 2s ease-in-out;
  animation-fill-mode: forwards;
}

@keyframes shimmer-complete {
  0% { 
    transform: translateX(-100%);
    opacity: 1;
  }
  100% { 
    transform: translateX(100%);
    opacity: 0;
  }
}

.progress-text {
  text-align: center;
  color: #495057;
  font-size: 14px;
  font-weight: 500;
  margin-right: 20px;
}

/* Stats Grid */
.sync-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  margin: 24px 20px 0 0;
  padding: 0;
  background: none;
  border-radius: 0;
  border: none;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
}

.stat-label {
  display: block;
  color: #6c757d;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.stat-value.success {
  color: #28a745;
}

.stat-value.error {
  color: #dc3545;
}

.stat-value.warning {
  color: #ffc107;
}

/* Rate Limit Info */
.rate-limit-info {
  margin: 24px 20px 0 0;
  padding: 18px 20px;
  background: linear-gradient(135deg, #e3f2fd 0%, #f1f8e9 100%);
  border-left: 4px solid #4a90e2;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rate-limit-info .description {
  margin: 8px 0;
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.5;
}

/* Sync Controls */
.sync-controls {
  padding: 16px 0;
}

.sync-actions {
  margin: 24px 0;
  text-align: center;
}

.sync-actions button {
  margin: 0 8px;
}

.sync-actions .button-hero {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  padding: 12px 32px;
  height: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: none;
}

.sync-actions .button-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sync-actions .button-hero.button-primary {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: #fff;
}

.sync-actions .button-hero.button-primary:hover {
  background: linear-gradient(135deg, #357abd 0%, #2968a3 100%);
}

.sync-actions .button-hero.button-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
  color: #fff;
}

.sync-actions .button-hero.button-secondary:hover {
  background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

#cancel-sync.button-hero.button-secondary {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  border-color: #dc3545;
}

#cancel-sync.button-hero.button-secondary:hover {
  background: linear-gradient(135deg, #c82333 0%, #b21e2f 100%);
  border-color: #b21e2f;
}

.sync-actions .button-hero .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  margin: 0;
}

/* Notices */
.truebeep-sync-wrap .notice {
  margin: 20px 20px 20px 0;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.truebeep-sync-wrap .notice.inline {
  display: block;
  margin: 20px 0;
}

.truebeep-sync-wrap .notice p {
  margin: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}

/* Table Improvements */
.truebeep-sync-wrap table.widefat {
  border: none;
  box-shadow: none;
}

.truebeep-sync-wrap table.widefat th {
  font-weight: 500;
  color: #50575e;
  width: 40%;
}

.truebeep-sync-wrap table.widefat td {
  color: #2c3338;
}

.truebeep-sync-wrap table.widefat tr:last-child td,
.truebeep-sync-wrap table.widefat tr:last-child th {
  border-bottom: none;
}

/* Button Improvements */
.truebeep-sync-wrap .button-link-delete {
  color: #a00;
  text-decoration: none;
}

.truebeep-sync-wrap .button-link-delete:hover {
  color: #dc3232;
  border: none;
  background: none;
}

/* Spinner Adjustment */
.truebeep-sync-wrap .spinner {
  visibility: visible;
  margin-top: 0;
}

/* Sync Log Section */
.sync-log-card {
  width: 100%;
  max-width: 100%;
  margin: 30px 20px 20px 0;
  border-left: 4px solid #17a2b8;
}

.sync-log-card .title {
  background: linear-gradient(135deg, #d1ecf1 0%, #f8f9fa 100%);
  color: #2c3e50;
  font-weight: 600;
}

.sync-log-container {
  max-height: 400px;
  overflow-y: auto;
}

.log-entry {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #f8f9fa;
  transition: background-color 0.2s ease;
}

.log-entry:hover {
  background: #e9ecef;
}

.log-entry:last-child {
  margin-bottom: 0;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.log-timestamp {
  font-size: 13px;
  color: #6c757d;
  font-weight: 500;
}

.log-summary {
  font-size: 14px;
  color: #495057;
  font-weight: 500;
}

.log-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dee2e6;
}

.log-errors strong {
  color: #dc3545;
  font-size: 13px;
}

.error-list {
  margin: 8px 0 0 0;
  padding: 0;
  list-style: none;
}

.error-item {
  margin-bottom: 6px;
  padding: 8px 12px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  font-size: 13px;
}

.error-item:last-child {
  margin-bottom: 0;
}

.error-user {
  font-weight: 600;
  color: #721c24;
}

.error-message {
  color: #721c24;
  margin-left: 8px;
}

.log-success {
  margin-top: 8px;
  padding: 8px 12px;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
}

.success-count {
  color: #155724;
  font-size: 13px;
  font-weight: 500;
}

.log-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #dee2e6;
  text-align: center;
}

.log-note {
  color: #6c757d;
  font-size: 12px;
  margin: 0;
  font-style: italic;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
  .truebeep-sync-container {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 900px) {
  .truebeep-sync-container {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 782px) {
  .truebeep-sync-wrap {
    margin: 10px;
  }

  .truebeep-sync-container {
    gap: 12px;
  }
  
  .sync-log-card {
    margin: 20px 10px 20px 0;
  }
  
  .log-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .log-timestamp {
    font-size: 12px;
  }
  
  .log-summary {
    font-size: 13px;
  }
  
  .sync-log-container {
    max-height: 300px;
  }

  .sync-status-card {
    margin-bottom: 20px;
    width: calc(100% - 10px) !important;
    margin-right: 10px;
  }

  .sync-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 0;
    margin: 24px 10px 0 0;
  }
  
  .progress-container {
    margin: 24px 10px 24px 0;
  }
  
  .progress-text {
    margin-right: 10px;
  }
  
  .rate-limit-info {
    margin: 24px 10px 0 0;
  }

  .stat-item {
    padding: 12px;
  }

  .stat-value {
    font-size: 24px;
  }

  .sync-actions .button-hero {
    width: 100%;
    justify-content: center;
    margin: 8px 0;
    padding: 14px 24px;
  }

  .truebeep-sync-wrap h1 {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .truebeep-sync-wrap h1 .dashicons {
    font-size: 20px !important;
    width: 20px !important;
    height: 20px !important;
  }

  .truebeep-sync-wrap .card .title {
    padding: 16px 20px 12px 20px;
    font-size: 15px;
  }

  .truebeep-sync-wrap .card-body {
    padding: 20px;
  }
}

@media screen and (max-width: 480px) {
  .truebeep-sync-container {
    gap: 10px;
  }

  .sync-status-card {
    margin-right: 0;
    width: 100% !important;
  }
  
  .sync-log-card {
    margin: 20px 0 20px 0;
    width: 100%;
  }

  .sync-stats-grid {
    grid-template-columns: 1fr;
    margin: 24px 0 0 0;
  }
  
  .progress-container {
    margin: 24px 0;
  }
  
  .progress-text {
    margin-right: 0;
  }

  .stat-item {
    padding: 16px;
  }

  .rate-limit-info {
    padding: 16px;
    margin: 20px 0 0 0;
  }
}
