/**
 * Policy Recommendations CSS
 * Dark theme styling matching customers page
 */

/* ==========================================================================
   LAYOUT & CONTAINER
   ========================================================================== */

body {
  background: #0a0a0a;
  color: #e2e8f0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dashboard-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding: 0;
  background: transparent;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
  background: transparent;
}

.page-subtitle {
  font-size: 14px;
  color: #94a3b8;
  margin: 0;
  background: transparent;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   STATS CARDS
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-change {
  font-size: 13px;
  color: #94a3b8;
}

/* ==========================================================================
   FILTERS & CARDS
   ========================================================================== */

.filters-card {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-full {
  grid-column: 1 / -1;
}

.filter-group label {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}

.form-select,
.form-input {
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 12px;
  color: #e2e8f0;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select option {
  background: #1a1a1a;
  color: #e2e8f0;
}

.form-range {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
}

.form-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.sort-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sort-section label {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.form-select-sm {
  padding: 8px 10px;
  font-size: 13px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ==========================================================================
   TABLE STYLES
   ========================================================================== */

.matrix-container {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 24px;
}

.table-responsive {
  overflow-x: auto;
}

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

.matrix-table thead {
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 10;
}

.matrix-table th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 600;
  color: #94a3b8;
  border-bottom: 2px solid rgba(59, 130, 246, 0.3);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(59, 130, 246, 0.05);
}

.insurer-column-header {
  text-align: center !important;
  color: #3b82f6 !important;
  font-weight: 700 !important;
  font-size: 13px !important;
}

.matrix-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  vertical-align: middle;
}

.company-cell {
  font-weight: 600;
  color: #ffffff;
  font-size: 14px;
}

.industry-cell {
  color: #94a3b8;
  font-size: 13px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-table tbody tr {
  transition: background 0.2s;
}

.matrix-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

/* Overall Fit Score Cell */
.fit-score-cell {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: #ffffff;
}

.fit-score-cell.fit-score-green {
  color: #10b981;
}

.fit-score-cell.fit-score-amber {
  color: #f59e0b;
}

.fit-score-cell.fit-score-red {
  color: #ef4444;
}

/* Insurer Column Cells */
.insurer-cell {
  text-align: center;
  cursor: pointer;
  position: relative;
  padding: 12px 8px;
  min-width: 100px;
  vertical-align: middle;
}

.insurer-cell:hover {
  background: rgba(59, 130, 246, 0.1);
  transition: all 0.2s;
}

/* Score badges inside cells */
.score-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 15px;
  min-width: 45px;
  transition: all 0.2s;
}

.score-badge:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Score badge colors */
.score-badge.fit-score-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.score-badge.fit-score-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.score-badge.fit-score-red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* No score indicator */
.insurer-cell .no-score {
  color: #64748b;
  font-size: 14px;
  font-weight: 400;
}

/* Filters */
.filters-card {
  margin-bottom: var(--space-xl);
  padding: var(--space-4);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-group-full {
  grid-column: 1 / -1;
}

.filter-group label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-gray-700);
}

.sort-section {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-gray-200);
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  border-top: 1px solid var(--color-gray-200);
  margin-top: var(--space-4);
}

.pagination-info {
  color: var(--color-gray-600);
  font-size: var(--font-size-sm);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-info {
  font-size: var(--font-size-sm);
  color: var(--color-gray-600);
}

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--color-gray-900);
  color: white;
  padding: var(--space-3) var(--space-4);
  border-radius: 6px;
  font-size: var(--font-size-sm);
  pointer-events: none;
  z-index: 1000;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--color-gray-900);
}

/* ==========================================================================
   ALIGNMENT REPORT STYLES
   ========================================================================== */

.alignment-report-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.report-header {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: 8px;
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.report-header h1 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-2);
}

.report-header-meta {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-4);
  color: var(--color-gray-600);
  font-size: var(--font-size-sm);
}

.coverage-section {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.coverage-header {
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coverage-header:hover {
  background: #f1f5f9;
}

.coverage-header h3 {
  font-size: 22px;
  font-weight: 700;
  color: #0a0a0a;
  margin: 0;
}

.coverage-priority {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  margin-left: var(--space-2);
}

.priority-critical {
  background: var(--color-risk-critical-bg);
  color: var(--color-risk-critical);
}

.priority-important {
  background: var(--color-risk-medium-bg);
  color: var(--color-risk-medium);
}

.priority-optional {
  background: var(--color-gray-100);
  color: var(--color-gray-600);
}

.coverage-content {
  padding: 24px;
  display: none;
  background: #ffffff;
}

.coverage-section.expanded .coverage-content {
  display: block;
}

.insurers-container h4 {
  font-size: 18px;
  font-weight: 700;
  color: #0a0a0a;
  margin-bottom: 16px;
}

.coverage-summary {
  margin-bottom: var(--space-6);
}

.coverage-summary-item {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
}

.coverage-summary-label {
  font-weight: 600;
  color: #0a0a0a;
  min-width: 150px;
}

.insurer-card {
  background: #f0f9ff;
  border: 2px solid #bae6fd;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.insurer-card-top {
  background: #d1fae5;
  border-color: #10b981;
  border-width: 3px;
}

.insurer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.insurer-name {
  font-weight: 700;
  font-size: 20px;
  color: #0a0a0a;
}

.insurer-score {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
}

.insurer-status {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  margin-left: var(--space-2);
}

.status-accept {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-refer {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.status-decline {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.insurer-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.insurer-detail-item {
  font-size: 14px;
}

.insurer-detail-label {
  color: #475569;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 13px;
}

.insurer-detail-value {
  font-weight: 600;
  color: #0a0a0a;
  font-size: 15px;
}

.insurer-advantages {
  margin-top: 16px;
}

.insurer-advantages h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #0a0a0a;
}

.insurer-advantages ul {
  list-style: disc;
  padding-left: 24px;
  margin: 0;
}

.insurer-advantages li {
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
  border-bottom: 1px solid #e2e8f0;
}

.insurer-advantages li:last-child {
  border-bottom: none;
}

.insurer-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Cross-sell & Risk Improvements */
.section-box {
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  padding: 16px;
  margin-top: 16px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.section-box h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #0a0a0a;
}

.section-box ul {
  list-style: disc;
  padding-left: 24px;
  margin: 0;
}

.section-box li {
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
}

/* Report Actions */
.report-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-gray-200);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--color-white);
  border-radius: 8px;
  padding: var(--space-6);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.modal-header h3 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-size-2xl);
  cursor: pointer;
  color: var(--color-gray-500);
}

.modal-close:hover {
  color: var(--color-gray-900);
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-info {
  color: #94a3b8;
  font-size: 13px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-info {
  font-size: 13px;
  color: #94a3b8;
  padding: 0 12px;
}

/* ==========================================================================
   LOADING & EMPTY STATES
   ========================================================================== */

.loading-state,
.empty-state,
.error-state {
  text-align: center;
  padding: 80px 24px;
  color: #94a3b8;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.loading-state .spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-icon,
.error-icon {
  margin: 0 auto 24px;
  opacity: 0.5;
  color: #64748b;
}

.empty-icon svg,
.error-icon svg {
  display: block;
  margin: 0 auto;
}

.empty-state h3,
.error-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.empty-state p,
.error-state p {
  font-size: 14px;
  color: #94a3b8;
  margin: 0;
}

/* ==========================================================================
   TOOLTIP
   ========================================================================== */

.tooltip {
  position: absolute;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: none;
  z-index: 1000;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1a1a1a;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

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

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .filters-grid {
    grid-template-columns: 1fr;
  }
  
  .sort-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .pagination-container {
    flex-direction: column;
    gap: 16px;
  }
}
