/**
 * Supplier Comparison Styles
 */

/* ============================================
   Floating Compare Button
   ============================================ */
.compare-floating-btn {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1a1a2e;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.compare-floating-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

.compare-floating-btn .compare-icon {
  font-size: 18px;
}

.compare-floating-btn .compare-count {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  min-width: 20px;
  text-align: center;
}

/* ============================================
   Compare Checkbox/Button on Cards
   ============================================ */
.compare-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #f59e0b;
}

/* Compare button on card rows */
.school-card {
  position: relative;
}

.school-card .compare-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 6px;
  color: #f59e0b;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0;
}

.school-card:hover .compare-btn {
  opacity: 1;
}

.school-card .compare-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-50%) scale(1.05);
}

.school-card .compare-btn.active {
  opacity: 1;
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1a1a2e;
}

/* Show buttons on touch devices without hover */
@media (hover: none) {
  .school-card .compare-btn {
    opacity: 0.8;
  }
  .school-card:active .compare-btn {
    opacity: 1;
  }
}

/* Standalone compare button (for other contexts) */
.compare-btn:not(.school-card .compare-btn) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  color: #f59e0b;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-btn:not(.school-card .compare-btn):hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
}

.compare-btn:not(.school-card .compare-btn).active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1a1a2e;
}

/* ============================================
   Compare Modal
   ============================================ */
.compare-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.compare-modal.visible {
  display: flex;
}

.compare-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.compare-modal-content {
  position: relative;
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  background: #0f1a2e;
  border: 1px solid rgba(0, 180, 216, 0.2);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.compare-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
}

.compare-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #f1f5f9;
}

.compare-modal-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.compare-clear-btn {
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.compare-close-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.compare-modal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* ============================================
   Compare Table
   ============================================ */
.compare-table-wrapper {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.compare-table th,
.compare-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.compare-header-cell {
  background: rgba(0, 0, 0, 0.3);
  color: #f1f5f9;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  min-width: 180px;
}

.compare-header-cell:first-child {
  min-width: 150px;
  background: rgba(0, 0, 0, 0.4);
}

.supplier-header {
  position: relative;
}

.supplier-header-content {
  padding-right: 24px;
}

.compare-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 50%;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-remove-btn:hover {
  background: #ef4444;
  color: white;
}

.supplier-name {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.supplier-location {
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
}

.add-supplier-cell {
  background: rgba(0, 0, 0, 0.2);
  border-left: 1px dashed rgba(255, 255, 255, 0.1);
}

.add-supplier-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #64748b;
  font-size: 12px;
}

.add-supplier-prompt .add-icon {
  font-size: 24px;
  opacity: 0.5;
}

/* Section Headers */
.compare-section-header td {
  background: rgba(0, 180, 216, 0.1);
  color: #00b4d8;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
}

/* Data Rows */
.compare-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.compare-cell {
  vertical-align: middle;
}

.compare-cell.label-cell {
  color: #94a3b8;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.15);
}

.compare-cell.value-cell {
  color: #e2e8f0;
}

.compare-cell.check-cell {
  text-align: center;
  font-size: 16px;
}

.compare-cell.check-cell.has-value {
  color: #10b981;
}

.compare-cell.check-cell.no-value {
  color: #475569;
}

.compare-cell.empty-cell {
  background: rgba(0, 0, 0, 0.1);
  border-left: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Score Bar */
.score-bar {
  position: relative;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  min-width: 100px;
}

.score-bar .score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.score-bar.high .score-fill {
  background: linear-gradient(90deg, #10b981, #059669);
}

.score-bar.medium .score-fill {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.score-bar.low .score-fill {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.score-bar .score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Actions Row */
.compare-actions-row {
  background: rgba(0, 0, 0, 0.2);
}

.compare-actions-row .compare-cell {
  padding: 16px;
}

.action-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-action-btn {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(0, 180, 216, 0.1);
  border: 1px solid rgba(0, 180, 216, 0.3);
  border-radius: 6px;
  color: #00b4d8;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
}

.compare-action-btn:hover {
  background: rgba(0, 180, 216, 0.2);
  border-color: rgba(0, 180, 216, 0.5);
}

.compare-action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.compare-action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

/* ============================================
   Toast Notifications
   ============================================ */
.compare-toast {
  position: fixed;
  bottom: 220px;
  right: 20px;
  padding: 12px 20px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 14px;
  z-index: 2900;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.compare-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.compare-toast.success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}

.compare-toast.warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

.compare-toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
  .compare-floating-btn {
    bottom: 80px;
    right: 12px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .compare-floating-btn .compare-label {
    display: none;
  }

  .compare-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .compare-modal-header {
    padding: 12px 16px;
  }

  .compare-modal-header h2 {
    font-size: 16px;
  }

  .compare-table th,
  .compare-table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .compare-header-cell {
    min-width: 140px;
  }

  .compare-header-cell:first-child {
    min-width: 100px;
  }

  .supplier-name {
    font-size: 14px;
  }

  .compare-toast {
    bottom: 200px;
    left: 12px;
    right: 12px;
  }
}

/* 480px breakpoint for smaller phones */
@media (max-width: 480px) {
  .compare-modal-content {
    padding: 12px;
  }

  .compare-table th,
  .compare-table td {
    padding: 8px;
    font-size: 11px;
    min-width: 100px;
  }

  .compare-floating-btn {
    bottom: 60px;
    right: 12px;
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
  }

  .compare-floating-btn .compare-label,
  .compare-floating-btn .compare-count {
    display: none;
  }

  .compare-toast {
    bottom: 180px;
    left: 12px;
    right: 12px;
    transform: none;
  }

  .compare-toast.visible {
    transform: translateY(0);
  }
}
