/* User-Agent Generator Specific Styles */

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.textarea-field {
  min-height: 80px;
  font-family: monospace;
  line-height: 1.4;
  resize: vertical;
}

.generated-ua {
  min-height: 100px;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  transition: all 0.3s ease;
}

.generated-ua.has-value {
  background: rgba(40, 167, 69, 0.05);
  border-color: #28a745;
  color: #2c3e50;
}

.current-ua-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.ua-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 12px;
}

.ua-label {
  color: #6c757d;
  font-weight: 500;
}

.ua-value {
  font-family: monospace;
  color: #2c3e50;
  font-weight: 600;
  text-align: right;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ua-analysis {
  margin-top: 16px;
  padding: 12px;
  background: rgba(102, 126, 234, 0.05);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 6px;
}

.analysis-title {
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.analysis-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.analysis-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #e9ecef;
  border-radius: 3px;
  font-size: 11px;
}

.analysis-label {
  color: #6c757d;
  font-weight: 500;
}

.analysis-value {
  font-family: monospace;
  color: #495057;
  font-weight: 600;
}

.ua-templates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.template-category {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
}

.category-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}

.category-header:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.category-header.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.category-toggle {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.category-header.active .category-toggle {
  transform: rotate(180deg);
}

.category-content {
  display: none;
  padding: 8px;
  background: #f8f9fa;
}

.category-content.active {
  display: block;
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.template-item:hover {
  background: rgba(102, 126, 234, 0.1);
  border-color: #667eea;
  transform: translateX(2px);
}

.template-info {
  flex: 1;
  min-width: 0;
}

.template-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 2px;
}

.template-desc {
  color: #6c757d;
  font-size: 10px;
}

.template-actions {
  display: flex;
  gap: 4px;
}

.btn-mini {
  padding: 2px 6px;
  font-size: 10px;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mini:hover {
  background: #f8f9fa;
  border-color: #667eea;
  color: #667eea;
}

.ua-history {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #dee2e6;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 12px;
}

.history-item:hover {
  background: rgba(102, 126, 234, 0.05);
  border-color: #667eea;
  transform: translateY(-1px);
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-ua {
  font-family: monospace;
  color: #495057;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  color: #6c757d;
  font-size: 10px;
}

.history-actions {
  display: flex;
  gap: 4px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
  font-style: italic;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
  margin-bottom: 12px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

@media (max-width: 768px) {
  .current-ua-info {
    grid-template-columns: 1fr;
  }
  
  .analysis-content {
    grid-template-columns: 1fr;
  }
  
  .template-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .template-actions {
    align-self: stretch;
    justify-content: center;
  }
  
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .history-actions {
    align-self: stretch;
    justify-content: center;
  }
  
  .toolbar {
    justify-content: center;
  }
}

/* 动画效果 */
.generated-ua.updated {
  animation: glow 0.5s ease-in-out;
}

@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
  50% { box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.history-item.new {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 滚动条样式 */
.ua-history::-webkit-scrollbar {
  width: 6px;
}

.ua-history::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.ua-history::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.ua-history::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}