/* ========================================
   ADMIN VM SHOW PAGE
   Admin-specific styles only. Shared components (detail cards,
   resource bars, host keys, copyable regions) reuse vm-* classes
   from virtual_machines.css.
   ======================================== */

/* ─── Hero Banner ─── */
/* Admin hero extends the customer vm-hero pattern with
   destroyed/deleted states and admin-specific actions */

.avm-hero {
  border-radius: 12px;
  padding: 1.75rem 2rem;
  color: white;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.avm-hero.is-active,
.avm-hero.is-running {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.avm-hero.is-shutoff {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  box-shadow: 0 4px 12px rgba(156, 163, 175, 0.25);
}

.avm-hero.is-paused {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.avm-hero.is-crashed {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.avm-hero.is-provisioning {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.avm-hero.is-pending {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.avm-hero.is-destroyed {
  background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
  box-shadow: 0 4px 12px rgba(153, 27, 27, 0.25);
}

.avm-hero.is-deleted {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.25);
}

[data-theme="dark"] .avm-hero.is-active,
[data-theme="dark"] .avm-hero.is-running {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-shutoff {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border: 1px solid rgba(156, 163, 175, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-paused {
  background: linear-gradient(135deg, #1e3a5f 0%, #172554 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-crashed {
  background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-provisioning {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  border: 1px solid rgba(102, 126, 234, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-pending {
  background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-destroyed {
  background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
  border: 1px solid rgba(153, 27, 27, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .avm-hero.is-deleted {
  background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
  border: 1px solid rgba(180, 83, 9, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.avm-hero-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.avm-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bulma-size-large);
  flex-shrink: 0;
}

.avm-hero-text h2 {
  font-size: var(--bulma-size-large);
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: white;
}

.avm-hero-subtitle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  opacity: 0.9;
  font-size: var(--bulma-size-normal);
  flex-wrap: wrap;
}

.avm-hero-subtitle code {
  background: rgba(0, 0, 0, 0.2);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: var(--bulma-size-small);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

[data-theme="dark"] .avm-hero-subtitle code {
  background: rgba(255, 255, 255, 0.15);
}

.avm-hero-subtitle .hero-sep {
  opacity: 0.5;
}

.avm-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.avm-hero-actions .button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.avm-hero-actions .button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.avm-hero-actions .button.is-danger-hero {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  opacity: 0.85;
}

.avm-hero-actions .button.is-danger-hero:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  opacity: 1;
}

/* ─── Card Stack ─── */
/* All cards are full-width stacked, like Billing Breakdown.
   Works at every viewport width without breakpoint issues. */

.avm-cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.avm-cards > .vm-detail-card {
  margin-bottom: 0;
}

/* ─── Resource Stats Bar (CSS Grid Override) ─── */
/* auto-fit so stat boxes always stretch to fill the full width.
   !important to override virtual_machines.css mobile flex-direction rule. */

.avm-resource-bar {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  flex-direction: unset !important;
}

/* ─── Admin Detail Grid Override ─── */
/* auto-fill with minmax for natural responsive columns.
   !important to override virtual_machines.css 768px rule that sets 1fr. */

.avm-detail-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 1.25rem;
}

/* Links inside detail values get a subtle weight boost */
.avm-detail-grid .vm-detail-value a {
  font-weight: 500;
}

/* Extra resource indicator (customer view uses tags instead) */
.vm-resource-stat-extra {
  font-size: var(--bulma-size-small);
  color: #3b82f6;
  font-weight: 500;
}

[data-theme="dark"] .vm-resource-stat-extra {
  color: #60a5fa;
}

/* ─── Billing Breakdown (Manifesting/Spreadsheet Style) ─── */

.avm-billing-spreadsheet {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow-x: auto;
}

[data-theme="dark"] .avm-billing-spreadsheet {
  background: #1f2937;
  border-color: #374151;
}

.avm-billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--bulma-size-normal);
}

.avm-billing-table thead th {
  background: #f9fafb;
  border-bottom: 2px solid #d1d5db;
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: var(--bulma-size-small);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  white-space: nowrap;
}

[data-theme="dark"] .avm-billing-table thead th {
  background: #1a2332;
  border-bottom-color: #4b5563;
  color: #9ca3af;
}

.avm-billing-table tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

[data-theme="dark"] .avm-billing-table tbody td {
  border-bottom-color: #2d3748;
}

.avm-billing-table tbody tr:last-child td {
  border-bottom: none;
}

/* Alternating row colors with subtle blue tint */
.avm-billing-row:nth-child(even) td {
  background: #f0f4ff;
}

[data-theme="dark"] .avm-billing-row:nth-child(even) td {
  background: #1a2744;
}

/* Column alignment */
.avm-billing-col-qty,
.avm-billing-col-price,
.avm-billing-col-amount {
  text-align: right;
}

/* Cell styles */
.avm-billing-cell-code {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: var(--bulma-size-normal);
  color: #6b7280;
}

[data-theme="dark"] .avm-billing-cell-code {
  color: #9ca3af;
}

.avm-billing-cell-currency {
  text-align: right;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-weight: 500;
  white-space: nowrap;
}

/* Total row */
.avm-billing-total td {
  background: #eff6ff !important;
  font-weight: 700;
  border-top: 2px solid #3b82f6;
  border-bottom: 3px double #3b82f6;
  color: #1e3a5f;
  padding: 0.75rem;
}

[data-theme="dark"] .avm-billing-total td {
  background: #1e3a5f !important;
  border-top-color: #60a5fa;
  border-bottom-color: #60a5fa;
  color: #bfdbfe;
}

/* Supplementary rows (est. monthly, accrued) */
.avm-billing-supplementary td {
  background: #f9fafb !important;
  color: #6b7280;
  font-size: var(--bulma-size-normal);
  border-bottom: 1px solid #f3f4f6;
}

[data-theme="dark"] .avm-billing-supplementary td {
  background: #1a2332 !important;
  color: #9ca3af;
  border-bottom-color: #2d3748;
}

/* Pricing tier footer */
.avm-billing-tier {
  padding: 0.625rem 0.75rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
  font-size: var(--bulma-size-normal);
  color: #6b7280;
}

[data-theme="dark"] .avm-billing-tier {
  border-color: #374151;
  background: #1a1f2e;
  color: #6b7280;
}

/* Price override notices */
.avm-billing-notice {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avm-billing-notice-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bulma-size-medium);
  flex-shrink: 0;
}

.avm-billing-notice-icon.is-free {
  background: #ecfdf5;
  color: #10b981;
}

.avm-billing-notice-icon.is-override {
  background: #fef3c7;
  color: #d97706;
}

[data-theme="dark"] .avm-billing-notice-icon.is-free {
  background: #064e3b;
  color: #34d399;
}

[data-theme="dark"] .avm-billing-notice-icon.is-override {
  background: #78350f;
  color: #fcd34d;
}

.avm-billing-notice-text {
  color: #374151;
}

.avm-billing-notice-text strong {
  font-weight: 700;
}

[data-theme="dark"] .avm-billing-notice-text {
  color: #d1d5db;
}

/* ─── Billing Mode Badge ─── */

.avm-billing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: var(--bulma-size-small);
  font-weight: 600;
}

.avm-billing-badge.is-on-demand {
  background: #dbeafe;
  color: #1d4ed8;
}

.avm-billing-badge.is-reserved {
  background: #f3f4f6;
  color: #374151;
}

[data-theme="dark"] .avm-billing-badge.is-on-demand {
  background: #1e3a5f;
  color: #93c5fd;
}

[data-theme="dark"] .avm-billing-badge.is-reserved {
  background: #374151;
  color: #d1d5db;
}

/* ─── Infrastructure Card Grid ─── */
/* auto-fill with 200px min keeps columns at 3-5 across viewports.
   auto-fill (not auto-fit) avoids stretching items on very wide screens. */

.avm-infra-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 0.75rem 1.25rem;
}

/* ─── Networking Table ─── */

.avm-network-table {
  font-size: var(--bulma-size-normal);
  margin-bottom: 0 !important;
}

.avm-network-table thead th {
  font-size: var(--bulma-size-normal);
  letter-spacing: 0.03em;
  color: #6b7280;
  white-space: nowrap;
}

[data-theme="dark"] .avm-network-table thead th {
  color: #9ca3af;
}

.avm-network-table code {
  font-size: var(--bulma-size-normal);
}

/* ─── Responsive ─── */
/* Cards are always full-width stacked, so no grid breakpoints needed.
   Inner grids use auto-fit and collapse naturally. Only hero needs help. */

@media screen and (max-width: 768px) {
  .avm-hero {
    flex-direction: column;
    text-align: center;
  }

  .avm-hero-content {
    flex-direction: column;
  }

  .avm-hero-subtitle {
    justify-content: center;
  }

  .avm-hero-actions {
    justify-content: center;
    width: 100%;
  }
}
