/**
 * 🗺️ USA Map Styles
 * Tooltip and UI elements for the interactive state map
 */

/* State Tooltip */
.state-tooltip {
  position: fixed;
  display: none;
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.95), rgba(30, 30, 45, 0.95));
  border: 2px solid rgba(102, 126, 234, 0.8);
  border-radius: 10px;
  padding: 12px 16px;
  color: white;
  font-size: 0.9em;
  font-weight: 500;
  z-index: 10001;
  pointer-events: none;
  backdrop-filter: blur(15px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.state-tooltip strong {
  color: #667eea;
  font-size: 1.1em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Map View Container (for Communities tab) */
.map-view-container {
  position: relative;
  width: 100%;
  height: 600px;
  background: linear-gradient(135deg, rgba(10, 10, 20, 0.5), rgba(20, 20, 35, 0.5));
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.map-view-canvas {
  width: 100%;
  height: 100%;
}

/* Map View Toggle Button */
.toggle-map-view-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  margin-bottom: 15px;
}

.toggle-map-view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.toggle-map-view-btn:active {
  transform: translateY(0);
}

.toggle-map-view-btn.active {
  background: linear-gradient(135deg, #764ba2, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* State Filter Display */
.state-filter-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(102, 126, 234, 0.2);
  border: 2px solid rgba(102, 126, 234, 0.5);
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 15px;
  color: white;
  font-weight: 600;
}

.state-filter-display .state-name {
  color: #667eea;
  font-size: 1.1em;
}

.state-filter-display .clear-filter {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 4px 10px;
  color: white;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
}

.state-filter-display .clear-filter:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ========================= */
/* State Card - Portal UI    */
/* ========================= */

.state-card {
  position: fixed;
  top: 50%;
  left: 30px;
  transform: translateY(-50%);
  width: 320px;
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.95), rgba(25, 25, 40, 0.95));
  border: 2px solid rgba(102, 126, 234, 0.6);
  border-radius: 16px;
  padding: 0;
  color: white;
  z-index: 1001;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(255, 255, 255, 0.1),
              0 0 30px rgba(102, 126, 234, 0.2);
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.state-card.visible {
  opacity: 1;
  pointer-events: auto;
}

.state-card.locked {
  border-color: rgba(245, 158, 11, 0.8);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(255, 255, 255, 0.1),
              0 0 30px rgba(245, 158, 11, 0.3);
}

.state-card.locked::before {
  content: '🔒';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.9em;
}

/* State Card Header */
.state-card-header {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
  padding: 20px;
  border-bottom: 1px solid rgba(102, 126, 234, 0.3);
}

.state-card-name {
  font-size: 1.6em;
  font-weight: 700;
  color: #667eea;
  margin: 0 0 5px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.state-card-abbr {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.state-card-communities {
  margin-top: 8px;
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.7);
}

.state-card-communities span {
  color: #667eea;
  font-weight: 600;
}

/* State Card Body */
.state-card-body {
  padding: 15px 20px;
  max-height: 400px;
  overflow-y: auto;
}

/* Representative Section */
.state-card-section {
  margin-bottom: 15px;
}

.state-card-section:last-child {
  margin-bottom: 0;
}

.state-card-section-title {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px;
  font-weight: 600;
}

/* Representative Card */
.rep-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rep-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(102, 126, 234, 0.5);
}

.rep-info {
  flex: 1;
}

.rep-name {
  font-weight: 600;
  font-size: 0.95em;
  color: white;
}

.rep-party {
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.rep-party.democrat {
  color: #3b82f6;
}

.rep-party.republican {
  color: #ef4444;
}

/* Bills List */
.bills-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bill-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 3px solid #667eea;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bill-item:hover {
  background: rgba(102, 126, 234, 0.15);
  transform: translateX(3px);
}

.bill-number {
  font-size: 0.75em;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 3px;
}

.bill-title {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.state-card-empty {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85em;
}

/* Loading State */
.state-card-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85em;
}

.state-card-loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .map-view-container {
    height: 400px;
  }

  .state-tooltip {
    font-size: 0.85em;
    padding: 10px 14px;
  }

  .toggle-map-view-btn {
    width: 100%;
    margin-bottom: 10px;
  }

  .state-card {
    width: 280px;
    left: 15px;
    top: auto;
    bottom: 80px;
    transform: none;
  }

  .state-card-header {
    padding: 15px;
  }

  .state-card-name {
    font-size: 1.3em;
  }

  .state-card-body {
    max-height: 250px;
  }
}
