/**
 * Sandbox Tab Styles
 * Clean, modern UI for sandbox deployment management
 */

/* Main Container */
.sandbox-tab-container {
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  background-color: #f8f9fa;
}

/* Header Section */
.sandbox-header {
  margin-bottom: 25px;
}

.sandbox-header h4 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sandbox-header p {
  color: #6c757d;
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* Status Cards Grid */
.sandbox-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.sandbox-status-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #0d6efd;
}

.sandbox-status-card.deployed {
  border-left-color: #198754;
}

.sandbox-status-card.not-deployed {
  border-left-color: #6c757d;
}

.sandbox-status-card.error {
  border-left-color: #dc3545;
}

.sandbox-status-card h5 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  margin-bottom: 10px;
}

.sandbox-status-card .status-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #212529;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sandbox-status-card .status-badge {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* Sandbox URL Section */
.sandbox-url-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.sandbox-url-section h5 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #6c757d;
  margin-bottom: 12px;
}

.sandbox-url-display {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sandbox-url-input {
  flex: 1;
  min-width: 300px;
  padding: 10px 15px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background-color: #f8f9fa;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.875rem;
  color: #0d6efd;
  cursor: pointer;
  transition: all 0.2s;
}

.sandbox-url-input:hover {
  background-color: #e9ecef;
  border-color: #0d6efd;
}

.sandbox-url-display .btn-group {
  display: flex;
  gap: 8px;
}

/* Action Buttons Section */
.sandbox-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.sandbox-actions .btn {
  padding: 10px 20px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s;
}

.sandbox-actions .btn i {
  margin-right: 6px;
}

/* Version History Section */
.sandbox-version-history {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.sandbox-version-history h5 {
  font-size: 1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 15px;
}

.version-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.version-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.version-history-item:hover {
  background-color: #f8f9fa;
  border-color: #0d6efd;
}

.version-history-item.current {
  background-color: #d1e7dd;
  border-color: #198754;
}

.version-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.version-history-item.current .version-icon {
  background-color: #198754;
  color: white;
}

.version-details h6 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: #212529;
}

.version-details p {
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 0;
}

.version-actions .btn {
  font-size: 0.8rem;
  padding: 4px 12px;
}

/* Environment Variables Section */
.sandbox-environment-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.sandbox-environment-section h5 {
  font-size: 1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 15px;
}

.env-var-list {
  list-style: none;
  padding: 0;
  margin-bottom: 15px;
}

.env-var-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 8px;
}

.env-var-item code {
  font-size: 0.875rem;
  color: #0d6efd;
}

/* Deployment Logs Section */
.sandbox-logs-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.sandbox-logs-section h5 {
  font-size: 1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 15px;
}

.logs-viewer {
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 15px;
  border-radius: 6px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.8rem;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-entry {
  margin-bottom: 4px;
  display: flex;
  gap: 10px;
}

.log-timestamp {
  color: #858585;
  flex-shrink: 0;
}

.log-message {
  flex: 1;
}

.log-entry.success .log-message {
  color: #4ec9b0;
}

.log-entry.error .log-message {
  color: #f48771;
}

.log-entry.warning .log-message {
  color: #dcdcaa;
}

.log-entry.info .log-message {
  color: #9cdcfe;
}

/* Metrics Dashboard */
.sandbox-metrics-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.sandbox-metrics-section h5 {
  font-size: 1rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 15px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.metric-card {
  text-align: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 6px;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0d6efd;
  margin-bottom: 5px;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
}

/* Empty State */
.sandbox-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sandbox-empty-state i {
  font-size: 4rem;
  color: #dee2e6;
  margin-bottom: 20px;
}

.sandbox-empty-state h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 10px;
}

.sandbox-empty-state p {
  color: #6c757d;
  margin-bottom: 25px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Loading State */
.sandbox-loading {
  text-align: center;
  padding: 40px;
}

.sandbox-loading .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Toast Notifications */
.sandbox-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 300px;
  animation: slideInRight 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sandbox-tab-container {
    padding: 15px;
  }

  .sandbox-status-grid {
    grid-template-columns: 1fr;
  }

  .sandbox-url-display {
    flex-direction: column;
    align-items: stretch;
  }

  .sandbox-url-input {
    min-width: 100%;
  }

  .sandbox-actions {
    flex-direction: column;
  }

  .sandbox-actions .btn {
    width: 100%;
  }

  .version-history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .version-actions {
    width: 100%;
  }

  .version-actions .btn {
    width: 100%;
  }

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

/* Utility Classes */
.text-muted-light {
  color: #adb5bd;
}

.badge-sandbox {
  background-color: #0d6efd;
  color: white;
}

.badge-deployed {
  background-color: #198754;
  color: white;
}

.badge-not-deployed {
  background-color: #6c757d;
  color: white;
}

.badge-error {
  background-color: #dc3545;
  color: white;
}

/* Scrollbar Styling */
.logs-viewer::-webkit-scrollbar {
  width: 8px;
}

.logs-viewer::-webkit-scrollbar-track {
  background: #2d2d2d;
  border-radius: 4px;
}

.logs-viewer::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.logs-viewer::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* ============ Dark Mode ============ */
body[data-theme="dark"] .sandbox-tab-container {
  background-color: var(--bg-primary, #0a0a0a);
}

body[data-theme="dark"] .sandbox-header h4 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .sandbox-header p {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .sandbox-status-card {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-status-card h5 {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .sandbox-status-card .status-value {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .sandbox-url-section {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-url-section h5 {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .sandbox-url-input {
  border-color: var(--border, #2a2a2a);
  background-color: var(--bg-tertiary, #1f1f1f);
  color: #6db3f2;
}

body[data-theme="dark"] .sandbox-url-input:hover {
  background-color: var(--hover-bg, #252525);
  border-color: #6db3f2;
}

body[data-theme="dark"] .sandbox-version-history {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-version-history h5 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .version-history-item {
  border-color: var(--border, #2a2a2a);
}

body[data-theme="dark"] .version-history-item:hover {
  background-color: var(--hover-bg, #252525);
}

body[data-theme="dark"] .version-history-item.current {
  background-color: rgba(25, 135, 84, 0.1);
  border-color: #198754;
}

body[data-theme="dark"] .version-icon {
  background-color: var(--bg-tertiary, #1f1f1f);
}

body[data-theme="dark"] .version-details h6 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .version-details p {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .sandbox-environment-section {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-environment-section h5 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .env-var-item {
  background-color: var(--bg-tertiary, #1f1f1f);
}

body[data-theme="dark"] .sandbox-logs-section {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-logs-section h5 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .sandbox-metrics-section {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-metrics-section h5 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .metric-card {
  background-color: var(--bg-tertiary, #1f1f1f);
}

body[data-theme="dark"] .metric-label {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .sandbox-empty-state {
  background: var(--bg-secondary, #151515);
  box-shadow: var(--shadow-sm);
}

body[data-theme="dark"] .sandbox-empty-state i {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .sandbox-empty-state h4 {
  color: var(--text-primary, #f5f5f5);
}

body[data-theme="dark"] .sandbox-empty-state p {
  color: var(--text-muted, #737373);
}

body[data-theme="dark"] .text-muted-light {
  color: var(--text-muted, #737373);
}
