/* ============================================
   AMD Dev Cloud - Main Stylesheet
   ============================================ */

/* CSS Variables for theming */
:root {
  /* Light theme (default) */
  --bg-primary: #f4f4f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fa;
  --text-primary: #20232a;
  --text-secondary: #333333;
  --text-muted: #666666;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --accent-primary: #5561FF;
  --accent-secondary: #34D1BF;
  --accent-gradient: linear-gradient(90deg, #5561FF, #34D1BF);
  --accent-gradient-hover: linear-gradient(90deg, #4450E0, #28B3A0);
  --error-color: #e53e3e;
  --success-color: #38a169;
  --warning-color: #d69e2e;
  --info-color: #3182ce;
}

[data-theme="dark"] {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #1f2937;
  --text-primary: #f0f0f0;
  --text-secondary: #e0e0e0;
  --text-muted: #a0a0a0;
  --border-color: #374151;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --accent-primary: #6b73ff;
  --accent-secondary: #4aedc4;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   Layout
   ============================================ */
.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* ============================================
   Header / Navbar
   ============================================ */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px var(--shadow-color);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.navbar-logo {
  height: 36px;
  width: auto;
}

.navbar-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--border-color);
  transform: rotate(15deg);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.user-menu:hover {
  background: var(--border-color);
}

.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
}

.user-menu-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-secondary);
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--shadow-color);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--shadow-color);
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-logo {
  width: 80px;
  margin-bottom: 16px;
  transition: transform 0.3s ease;
}

.card-logo:hover {
  transform: scale(1.1);
}

.card-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ============================================
   Dashboard
   ============================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 900px;
}

.dashboard-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px var(--shadow-color);
}

.dashboard-card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dashboard-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-running {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success-color);
}

.status-stopped {
  background: rgba(160, 160, 160, 0.1);
  color: var(--text-muted);
}

.status-launching {
  background: rgba(214, 158, 46, 0.1);
  color: var(--warning-color);
}

.status-warning {
  background: rgba(214, 158, 46, 0.1);
  color: var(--warning-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-running .status-dot {
  animation: pulse 2s infinite;
}

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

/* ============================================
   User Info Section
   ============================================ */
.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  margin-bottom: 24px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  transition: transform 0.3s ease;
}

.user-avatar:hover {
  transform: scale(1.05);
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-username {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(85, 97, 255, 0.3);
}

.btn-primary:disabled {
  background: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-github {
  background: #24292e;
  color: white;
  width: 100%;
}

.btn-github:hover {
  background: #1a1e22;
  transform: translateY(-2px);
}

[data-theme="dark"] .btn-github {
  background: #f0f0f0;
  color: #24292e;
}

[data-theme="dark"] .btn-github:hover {
  background: #ffffff;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

.btn-full-width {
  width: 100%;
}

/* ============================================
   Links
   ============================================ */
.link {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.link:hover {
  text-decoration: underline;
}

.link-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.link-muted:hover {
  color: var(--text-secondary);
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-container {
  display: none;
  margin-top: 24px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
  position: relative;
}

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

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  transition: width 0.4s ease;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-text {
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--border-color) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 20px var(--shadow-color);
  border-left: 4px solid var(--info-color);
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 400px;
}

.toast.show {
  transform: translateX(0);
}

.toast-success { border-left-color: var(--success-color); }
.toast-error { border-left-color: var(--error-color); }
.toast-warning { border-left-color: var(--warning-color); }
.toast-info { border-left-color: var(--info-color); }

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success-color); }
.toast-error .toast-icon { color: var(--error-color); }
.toast-warning .toast-icon { color: var(--warning-color); }
.toast-info .toast-icon { color: var(--info-color); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* ============================================
   Error Message
   ============================================ */
.error-message {
  background: rgba(229, 62, 62, 0.1);
  color: var(--error-color);
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  border: 1px solid rgba(229, 62, 62, 0.2);
}

/* ============================================
   Pod Info Card
   ============================================ */
.pod-info {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.pod-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.pod-info-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.pod-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.pod-info-row:last-child {
  border-bottom: none;
}

.pod-info-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pod-info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    padding: 10px 16px;
  }

  .navbar-title {
    display: none;
  }

  .user-menu-name {
    display: none;
  }

  .card {
    padding: 24px;
    margin: 10px;
    border-radius: 12px;
  }

  .card-title {
    font-size: 1.5rem;
  }

  .user-info {
    flex-direction: column;
    text-align: center;
  }

  .user-details {
    text-align: center;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    padding: 0 10px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 10px;
  }

  .card {
    padding: 20px;
  }

  .btn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .card-logo {
    width: 60px;
  }

  .card-title {
    font-size: 1.3rem;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ============================================
   Animations
   ============================================ */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
