/**
 * Favorite Panels CSS
 * Styles for favorite camera and route panels
 */

/* Favorite Panel Container */
.favorite-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  max-height: 80vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.favorite-panel.hidden {
  display: none;
}

/* Favorite Panel Header */
.favorite-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.favorite-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header Actions Container */
.favorite-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Layout Switcher */
.favorite-layout-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px;
  border-radius: 6px;
}

.layout-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.layout-btn.active {
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.favorite-panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.favorite-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Favorite Panel Body */
.favorite-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Empty State */
.favorite-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

/* Camera Favorite Item */
.favorite-camera-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e0e0e0;
}

.favorite-camera-item:hover {
  background: #f0f0f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.favorite-camera-thumbnail {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #ddd;
}

.favorite-camera-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.favorite-camera-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.favorite-camera-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-camera-location {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-camera-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

.favorite-camera-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.favorite-camera-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.favorite-camera-view-btn,
.favorite-camera-unfavorite-btn {
  background: #00555F;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-camera-view-btn:hover {
  background: #003d45;
}

.favorite-camera-unfavorite-btn {
  background: #FFD700;
  color: #333;
}

.favorite-camera-unfavorite-btn:hover {
  background: #FFC700;
}

/* Layout Views */
/* Column View (Default) */
.favorite-camera-list[data-layout="column"] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.favorite-camera-list[data-layout="column"] .favorite-camera-item {
  display: flex;
  flex-direction: row;
  gap: 12px;
}

/* Grid View */
.favorite-camera-list[data-layout="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.favorite-camera-list[data-layout="grid"] .favorite-camera-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.favorite-camera-list[data-layout="grid"] .favorite-camera-thumbnail {
  width: 100%;
  height: 120px;
}

.favorite-camera-list[data-layout="grid"] .favorite-camera-info {
  flex: 1;
}

.favorite-camera-list[data-layout="grid"] .favorite-camera-actions {
  flex-direction: row;
  width: 100%;
  justify-content: space-between;
}

.favorite-camera-list[data-layout="grid"] .favorite-camera-view-btn,
.favorite-camera-list[data-layout="grid"] .favorite-camera-unfavorite-btn {
  flex: 1;
}

/* Route Favorite Item */
.favorite-route-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e0e0e0;
}

.favorite-route-item:hover {
  background: #f0f0f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.favorite-route-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF8C00 0%, #FF6347 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.favorite-route-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.favorite-route-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-route-locations {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.favorite-route-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
}

.favorite-route-location span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-route-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #999;
}

.favorite-route-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.favorite-route-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.favorite-route-view-btn,
.favorite-route-unfavorite-btn {
  background: #00555F;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-route-view-btn:hover {
  background: #003d45;
}

.favorite-route-unfavorite-btn {
  background: #FFD700;
  color: #333;
}

.favorite-route-unfavorite-btn:hover {
  background: #FFC700;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .favorite-panel {
    width: calc(100% - 40px);
    max-width: 500px;
    max-height: 90vh;
  }

  .favorite-camera-item,
  .favorite-route-item {
    padding: 10px;
  }

  .favorite-camera-thumbnail {
    width: 60px;
    height: 45px;
  }

  .favorite-route-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* Scrollbar Styling */
.favorite-panel-body::-webkit-scrollbar {
  width: 8px;
}

.favorite-panel-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.favorite-panel-body::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.favorite-panel-body::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Layout Toggle Buttons */
.favorite-layout-toggle {
  display: flex;
  gap: 4px;
  margin-right: 12px;
}

.layout-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.layout-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.layout-toggle-btn.active {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Route Preview Canvas */
.favorite-route-preview {
  position: relative;
  width: 100%;
  height: 150px;
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.route-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.favorite-route-icon-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.9);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.favorite-route-icon-overlay i {
  font-size: 14px;
  color: #333;
}

/* Grid Layout */
.favorite-route-list[data-layout="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  padding: 16px;
}

.favorite-route-list[data-layout="grid"] .favorite-route-item {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.favorite-route-list[data-layout="grid"] .favorite-route-preview {
  margin-bottom: 0;
  border-radius: 0;
  height: 180px;
}

.favorite-route-list[data-layout="grid"] .favorite-route-info {
  padding: 12px;
  flex: 1;
}

.favorite-route-list[data-layout="grid"] .favorite-route-name {
  font-size: 14px;
  margin-bottom: 8px;
}

.favorite-route-list[data-layout="grid"] .favorite-route-locations {
  margin-bottom: 8px;
}

.favorite-route-list[data-layout="grid"] .favorite-route-location {
  font-size: 11px;
  margin-bottom: 4px;
}

.favorite-route-list[data-layout="grid"] .favorite-route-meta {
  font-size: 11px;
  flex-wrap: wrap;
  gap: 8px;
}

.favorite-route-list[data-layout="grid"] .favorite-route-actions {
  position: static;
  flex-direction: row;
  justify-content: space-around;
  padding: 8px;
  border-top: 1px solid #e0e0e0;
  background: #f9f9f9;
}

.favorite-route-list[data-layout="grid"] .favorite-route-view-btn,
.favorite-route-list[data-layout="grid"] .favorite-route-unfavorite-btn {
  position: static;
  margin: 0;
}

/* List Layout (default) */
.favorite-route-list[data-layout="list"] .favorite-route-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  transition: background 0.2s ease;
}

.favorite-route-list[data-layout="list"] .favorite-route-item:hover {
  background: #f9f9f9;
}

.favorite-route-list[data-layout="list"] .favorite-route-preview {
  width: 200px;
  height: 120px;
  flex-shrink: 0;
  margin-right: 16px;
  margin-bottom: 0;
}

.favorite-route-list[data-layout="list"] .favorite-route-info {
  flex: 1;
  min-width: 0;
}

.favorite-route-list[data-layout="list"] .favorite-route-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 12px;
}

/* Route Preview Image */
.route-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Route Preview Canvas (replaces image) */
.route-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Route Preview Map (replaces canvas) */
.route-preview-map {
  width: 100%;
  height: 100%;
  display: block;
}

/* AI Recommendations Button */
.favorite-route-ai-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.favorite-route-ai-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.favorite-route-ai-btn.active {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.favorite-route-ai-btn i {
  font-size: 14px;
}

/* AI Recommendations Section */
.favorite-route-ai-section {
  width: 100%;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-top: 2px solid #667eea;
  padding: 16px;
  margin-top: 12px;
  border-radius: 8px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

.ai-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.ai-section-header i {
  font-size: 18px;
}

.ai-collapse-btn {
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  color: #667eea;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-collapse-btn:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: scale(1.1);
}

.ai-collapse-btn i {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.ai-section-content {
  background: white;
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  transition: all 0.3s ease;
}

/* Scrollbar styling for AI content */
.ai-section-content::-webkit-scrollbar {
  width: 8px;
}

.ai-section-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.ai-section-content::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

.ai-section-content::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

.ai-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #667eea;
  font-size: 14px;
}

.ai-loading i {
  font-size: 20px;
}

.ai-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #ef4444;
  font-size: 14px;
}

.ai-error i {
  font-size: 20px;
}

.ai-recommendations {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.ai-recommendations p {
  margin: 0 0 12px 0;
}

.ai-recommendations p:last-child {
  margin-bottom: 0;
}

.ai-highlight {
  color: #667eea;
  font-weight: 700;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Structured AI Sections */
.ai-section {
  margin-bottom: 20px;
}

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

.ai-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.ai-section-title i {
  font-size: 18px;
  color: #764ba2;
}

.ai-section-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 6px;
  border-left: 3px solid #667eea;
  transition: all 0.2s ease;
}

.ai-item:hover {
  background: rgba(102, 126, 234, 0.1);
  transform: translateX(4px);
}

.ai-item-icon {
  color: #667eea;
  font-size: 14px;
  margin-top: 2px;
  flex-shrink: 0;
}

.ai-item span {
  flex: 1;
  line-height: 1.5;
}

.ai-item-highlight {
  color: #764ba2;
  font-weight: 600;
  background: rgba(118, 75, 162, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
}

.ai-item em {
  color: #555;
  font-style: italic;
}

/* Grid layout adjustments for AI section */
.favorite-route-list[data-layout="grid"] .favorite-route-ai-section {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: 0;
}

/* List layout adjustments for AI section */
.favorite-route-list[data-layout="list"] .favorite-route-item {
  flex-wrap: wrap;
}

.favorite-route-list[data-layout="list"] .favorite-route-ai-section {
  width: 100%;
  margin-top: 12px;
}
