/* Importing common tool styles */
@import "../common.css";

/* Network Status Tool Specific Styles */

/* Network Banner */
.network-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  transform: translateY(-100%);
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.network-banner.show {
  transform: translateY(0);
}

.network-banner.online {
  background: linear-gradient(135deg, #00c853, #2e7d32);
  color: white;
}

.network-banner.offline {
  background: linear-gradient(135deg, #f44336, #c62828);
  color: white;
}

.network-banner.checking {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: white;
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.banner-icon {
  font-size: 1.2rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Main Content Adjustments */
main.container {
  padding-top: 60px; /* Account for fixed banner */
}

/* Status Dashboard */
.status-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.status-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
}

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

.status-header h3 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.3rem;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
}

.indicator-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 10px;
  background: #4caf50;
  box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  animation: pulse-dot 1.2s infinite cubic-bezier(0.66, 0, 0, 1);
}

.status-indicator.online .indicator-dot {
  background: #00c853;
  box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.2);
}

.status-indicator.offline .indicator-dot {
  background: #f44336;
  box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.2);
  animation: pulse-dot-offline 1.2s infinite cubic-bezier(0.66, 0, 0, 1);
}

.status-indicator.checking .indicator-dot {
  background: #ff9800;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
  animation: checking-pulse 1.5s infinite;
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

@keyframes pulse-dot-offline {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
  }
}

.status-indicator.online {
  color: #00c853;
}

.status-indicator.offline {
  color: #f44336;
}

.status-indicator.checking {
  color: #ff9800;
}

/* Status Details */
.status-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.detail-label {
  font-weight: 500;
  color: #666;
}

.detail-value {
  font-weight: 600;
  color: var(--text-color);
}

/* Connection Test */
.test-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.test-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.test-label {
  font-weight: 500;
  color: #666;
}

.test-result {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.test-result.success {
  background: #e8f5e8;
  color: #2e7d32;
}

.test-result.error {
  background: #ffebee;
  color: #c62828;
}

.test-result.testing {
  background: #fff3e0;
  color: #f57c00;
}

/* Test Progress */
.test-progress {
  display: none;
}

.test-progress.active {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.85rem;
  color: #666;
  text-align: center;
  display: block;
}

/* Controls Section */
.controls-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.control-group h3 {
  margin-bottom: 20px;
  color: var(--text-color);
  font-size: 1.2rem;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.control-label {
  font-weight: 500;
  color: #666;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 25px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 500;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
  color: var(--primary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* History */
.history-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.form-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
}

.connection-history {
  max-height: 400px;
  overflow-y: auto;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-left: 4px solid #ddd;
  background: #f9f9f9;
  margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
}

.history-item.online {
  border-left-color: #00c853;
  background: #f1f8e9;
}

.history-item.offline {
  border-left-color: #f44336;
  background: #ffebee;
}

.history-event {
  font-weight: 500;
}

.history-time {
  font-size: 0.85rem;
  color: #666;
}

/* Statistics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

/* Chart */
.chart-container {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.connection-chart {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-placeholder {
  text-align: center;
  color: #666;
}

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.feature-item {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.feature-item h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--text-color);
  font-size: 1.1rem;
}

.feature-item p {
  margin: 0;
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Code Examples */
.code-example {
  margin: 20px 0;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
}

.code-example h4 {
  margin: 0;
  padding: 15px 20px;
  background: #e9ecef;
  color: var(--text-color);
  font-size: 1rem;
  border-bottom: 1px solid #dee2e6;
}

.code-example pre {
  margin: 0;
  padding: 20px;
  background: #2d3748;
  color: #e2e8f0;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

.code-example code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Button Styles */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn.primary {
  background: var(--primary-color);
  color: white;
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.secondary {
  background: #f8f9fa;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn.secondary:hover {
  background: #e9ecef;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Card Styles */
.card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.info-card {
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
  .status-dashboard {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .controls-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

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

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .status-card {
    padding: 20px;
  }

  .card {
    padding: 20px;
  }

  main.container {
    padding-top: 50px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .history-controls {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .action-buttons {
    gap: 8px;
  }

  .banner-content {
    font-size: 0.85rem;
  }

  .network-banner {
    padding: 10px 15px;
  }
}
