/**
 * Scraping Panel Styles
 * CSS for credentials management and scraping dashboard UI components
 */

/* ======================
   Credentials Panel
   ====================== */

.credentials-panel .credentials-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
}

.credentials-panel .stat-item {
  text-align: center;
}

.credentials-panel .stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--bs-primary);
}

.credentials-panel .stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.credentials-panel .stat-types {
  padding-top: 0.5rem;
  border-top: 1px solid #e9ecef;
}

/* Credential Domain Group */
.credential-domain-group {
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  overflow: hidden;
}

.credential-domain-group .domain-header {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e9ecef;
}

.credential-domain-group .domain-credentials {
  background: #fff;
}

/* Credential Item */
.credential-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.credential-item:last-child {
  border-bottom: none;
}

.credential-item:hover {
  background: #f8f9fa;
}

.credential-item .credential-info {
  flex: 1;
}

.credential-item .credential-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.credential-item .credential-meta {
  display: flex;
  gap: 1rem;
}

.credential-item .credential-actions {
  display: flex;
  gap: 0.25rem;
}

/* ======================
   Scraping Dashboard
   ====================== */

.scraping-dashboard .overview-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
}

.scraping-dashboard .stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  transition: transform 0.2s;
}

.scraping-dashboard .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scraping-dashboard .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.scraping-dashboard .stat-details {
  flex: 1;
}

.scraping-dashboard .stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #212529;
  line-height: 1;
}

.scraping-dashboard .stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Charts */
.chart-container {
  padding: 1rem;
  min-height: 200px;
}

.pie-chart-container {
  padding: 0.5rem 0;
}

.pie-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  font-size: 0.875rem;
}

.legend-value {
  font-size: 0.875rem;
  font-weight: 600;
}

/* Response Time Chart */
.response-time-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.response-time-bar {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.bar-label {
  text-align: right;
  color: #6c757d;
  font-size: 0.75rem;
}

.bar-container {
  background: #e9ecef;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.bar-value {
  text-align: left;
  font-weight: 600;
  color: #495057;
}

/* Top Domains */
.top-domains-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}

.domain-item {
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

.domain-item:hover {
  background: #e9ecef;
}

.domain-item .domain-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.domain-item .domain-stats {
  margin-bottom: 0.5rem;
}

/* Recent Activity */
.recent-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

.activity-item:hover {
  background: #e9ecef;
}

.activity-item .activity-status {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.activity-item .activity-details {
  flex: 1;
  min-width: 0;
}

.activity-item .activity-url a {
  color: var(--bs-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.activity-item .activity-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.activity-item .activity-actions {
  flex-shrink: 0;
}

/* ======================
   Animations
   ====================== */

.rotate-animation {
  animation: rotate 0.5s linear;
}

/* ======================
   Responsive Design
   ====================== */

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

  .credentials-panel .credentials-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .response-time-bar {
    grid-template-columns: 60px 1fr 50px;
    font-size: 0.75rem;
  }

  .activity-item .activity-meta {
    font-size: 0.75rem;
  }
}

@media (max-width: 576px) {
  .scraping-dashboard .overview-stats-grid {
    grid-template-columns: 1fr;
  }

  .credentials-panel .credentials-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .scraping-dashboard .stat-card {
    padding: 0.75rem;
  }

  .scraping-dashboard .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .credential-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .credential-item .credential-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ======================
   Dark Mode Support
   ====================== */

body[data-theme="dark"] .credentials-panel .stat-label,
body[data-theme="dark"] .scraping-dashboard .stat-label,
body[data-theme="dark"] .bar-label {
  color: var(--text-muted);
}

body[data-theme="dark"] .credentials-panel .stat-types {
  border-top-color: var(--border);
}

body[data-theme="dark"] .credential-domain-group {
  border-color: var(--border);
}

body[data-theme="dark"] .credential-domain-group .domain-header {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border);
}

body[data-theme="dark"] .credential-domain-group .domain-credentials {
  background: var(--bg-secondary);
}

body[data-theme="dark"] .credential-item {
  border-bottom-color: var(--border);
}

body[data-theme="dark"] .credential-item:hover {
  background: var(--hover-bg);
}

body[data-theme="dark"] .scraping-dashboard .stat-card,
body[data-theme="dark"] .domain-item,
body[data-theme="dark"] .activity-item {
  background: var(--bg-tertiary);
}

body[data-theme="dark"] .scraping-dashboard .stat-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .domain-item:hover,
body[data-theme="dark"] .activity-item:hover {
  background: var(--hover-bg);
}

body[data-theme="dark"] .bar-container {
  background: var(--bg-tertiary);
}

body[data-theme="dark"] .bar-value {
  color: var(--text-secondary);
}

body[data-theme="dark"] .scraping-dashboard .stat-value,
body[data-theme="dark"] .credentials-panel .stat-value {
  color: var(--text-primary);
}
