/**
 * Account Styles - Subscription & Billing Management
 *
 * For logged-in users to manage their subscription plan,
 * payment method, and view invoice history.
 */

/* ===========================================
   SECTION STYLING
   =========================================== */
swp-account-section {
  display: block;
  margin-bottom: var(--section-gap);
}

swp-account-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--section-gap);
}

swp-account-section-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

swp-account-section-title i {
  font-size: 22px;
  color: var(--color-teal);
}

/* ===========================================
   PLAN GRID
   =========================================== */
swp-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--card-gap);
}

@media (max-width: 1024px) {
  swp-plan-grid {
    grid-template-columns: 1fr;
  }
}

/* Plan card current state (extends auth.css) */
swp-plan-card.current {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-teal) 15%, transparent);
}

swp-plan-badge.current {
  background: color-mix(in srgb, var(--color-teal) 15%, transparent);
  color: var(--color-teal);
}

/* Disabled button for current plan */
swp-plan-card.current swp-btn.secondary {
  background: var(--color-background-alt);
  color: var(--color-text-secondary);
  cursor: default;
  pointer-events: none;
}

/* Enterprise plan styling */
swp-plan-card.enterprise {
  background: linear-gradient(135deg, var(--color-surface) 0%, color-mix(in srgb, var(--color-purple) 5%, var(--color-surface)) 100%);
  border-color: var(--color-purple);
}

swp-plan-badge.popular {
  background: color-mix(in srgb, var(--color-amber) 15%, transparent);
  color: var(--color-amber);
}

/* Plan action buttons */
swp-plan-action {
  margin-top: auto;
  padding-top: var(--card-padding);
}

swp-plan-action swp-btn {
  width: 100%;
  justify-content: center;
}

/* ===========================================
   BILLING GRID (2 columns)
   =========================================== */
swp-billing-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--card-gap);
}

@media (max-width: 1024px) {
  swp-billing-grid {
    grid-template-columns: 1fr;
  }
}

/* ===========================================
   PAYMENT CARD
   =========================================== */
swp-payment-card {
  display: flex;
  flex-direction: column;
  gap: var(--card-padding);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: var(--card-padding);
}

swp-payment-method {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
  padding: var(--card-padding);
  background: var(--color-background-alt);
  border-radius: var(--radius-md);
}

swp-payment-icon {
  width: 48px;
  height: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

swp-payment-icon i {
  font-size: 24px;
  color: var(--color-blue);
}

swp-payment-info {
  flex: 1;
  min-width: 0;
}

swp-payment-type {
  display: block;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: 2px;
}

swp-payment-number {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

swp-payment-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-4) 0;
  border-bottom: 1px solid var(--color-border);
}

swp-payment-detail:last-of-type {
  border-bottom: none;
}

swp-payment-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

swp-payment-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

swp-payment-value.highlight {
  color: var(--color-teal);
}

/* ===========================================
   INVOICES CARD
   =========================================== */
swp-invoices-card {
  display: block;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

swp-invoices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--card-padding);
  border-bottom: 1px solid var(--color-border);
}

swp-invoices-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* ===========================================
   INVOICE TABLE (Grid + Subgrid)
   =========================================== */
swp-invoice-table {
  display: grid;
  grid-template-columns: 100px minmax(120px, 1fr) 100px 100px 80px;
}

swp-invoice-table-header {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  background: var(--color-background-alt);
}

swp-invoice-table-body {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

swp-invoice-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

swp-invoice-table-body swp-invoice-row:hover {
  background: var(--color-background-hover);
}

swp-invoice-row:last-child {
  border-bottom: none;
}

swp-invoice-cell {
  padding: var(--spacing-4) var(--spacing-4);
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

swp-invoice-cell:first-child {
  padding-left: var(--card-padding);
}

swp-invoice-cell:last-child {
  padding-right: var(--card-padding);
}

/* Header cells */
swp-invoice-table-header swp-invoice-cell {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  padding-top: var(--spacing-4);
  padding-bottom: var(--spacing-4);
}

/* Invoice number mono font */
swp-invoice-cell.mono {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
}

/* ===========================================
   INVOICE STATUS BADGES
   =========================================== */
swp-invoice-status {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-1) var(--spacing-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-sm);
}

swp-invoice-status.paid {
  background: color-mix(in srgb, var(--color-green) 15%, transparent);
  color: var(--color-green);
}

swp-invoice-status.pending {
  background: color-mix(in srgb, var(--color-amber) 15%, transparent);
  color: var(--color-amber);
}

swp-invoice-status.overdue {
  background: color-mix(in srgb, var(--color-red) 15%, transparent);
  color: var(--color-red);
}

swp-invoice-status i {
  font-size: 14px;
}

/* ===========================================
   DOWNLOAD BUTTON
   =========================================== */
swp-download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-teal);
  background: transparent;
  border: 1px solid var(--color-teal);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

swp-download-btn:hover {
  background: color-mix(in srgb, var(--color-teal) 10%, transparent);
}

swp-download-btn i {
  font-size: 14px;
}

/* ===========================================
   BUTTONS (account-specific)
   =========================================== */
swp-btn.secondary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

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

swp-btn.outline {
  background: transparent;
  border: 1px solid var(--color-teal);
  color: var(--color-teal);
}

swp-btn.outline:hover {
  background: color-mix(in srgb, var(--color-teal) 10%, transparent);
}

swp-btn.sm {
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-xs);
}

swp-btn.sm i {
  font-size: 14px;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
  swp-invoice-table {
    grid-template-columns: 80px minmax(100px, 1fr) 80px 80px 70px;
  }

  swp-invoice-cell {
    padding: var(--spacing-3) var(--spacing-3);
  }

  swp-invoice-cell:first-child {
    padding-left: var(--spacing-5);
  }

  swp-invoice-cell:last-child {
    padding-right: var(--spacing-5);
  }

  swp-payment-card {
    padding: var(--spacing-5);
  }
}
