/* DAC License Portal - Theme-aware Styles */
/* Supports multiple theme skins */

/* Import themes first */
@import url('themes.css');

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* Non-color CSS variables */
:root {
  /* Spacing & Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Courier New', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

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

/* ===== HEADER ===== */

.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header__brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.header__link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: 0.5rem 0;
  position: relative;
}

.header__link:hover {
  color: var(--color-text);
}

.header__link--active {
  color: var(--color-primary);
}

.header__link--active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
}

.header__user {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding: 0.375rem 0.75rem;
  background: var(--color-surface-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ===== MAIN CONTENT ===== */

.main {
  flex: 1;
  padding: 2.5rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* Auth Layout (centered) */
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--auth-gradient);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-card__logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card__subtitle {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ===== CARDS ===== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all var(--transition-fast);
}

.card:hover {
  border-color: var(--color-border-light);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.card__badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card__badge--active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.card__badge--inactive {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* ===== FORMS ===== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* ===== BUTTONS ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
}

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

.btn--primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

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

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

.btn--danger:hover {
  background: #dc2626;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.btn--small {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

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

.btn--loading {
  position: relative;
  color: transparent !important;
}

.btn--loading::after {
  content: '';
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== ALERTS ===== */

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid;
}

.alert--success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.3);
}

.alert--error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.3);
}

.alert--info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border-color: rgba(59, 130, 246, 0.3);
}

.alert--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

/* ===== LICENSE KEY DISPLAY ===== */

.license-key {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--color-surface-elevated);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  word-break: break-all;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.license-key__text {
  flex: 1;
  color: var(--color-primary);
}

.license-key__copy {
  flex-shrink: 0;
}

/* ===== ACTIVATION LIST ===== */

.activation-list {
  list-style: none;
}

.activation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--color-surface-elevated);
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

.activation-item:hover {
  border-color: var(--color-border-light);
}

.activation-item:last-child {
  margin-bottom: 0;
}

.activation-item__info {
  flex: 1;
}

.activation-item__name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.activation-item__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* ===== EMPTY STATE ===== */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.empty-state__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.empty-state__text {
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* ===== DOWNLOAD CARD ===== */

.download-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  background: var(--color-surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: 0.75rem;
  transition: all var(--transition-fast);
}

.download-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 15px var(--color-primary-muted);
}

.download-card:last-child {
  margin-bottom: 0;
}

.download-card__info {
  flex: 1;
}

.download-card__name {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.download-card__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ===== PAGE TITLE ===== */

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== SHOP BANNER ===== */

.shop-banner {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-elevated) 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.shop-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), transparent);
}

.shop-banner__content {
  flex: 1;
}

.shop-banner__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.shop-banner__text {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.shop-banner__action {
  flex-shrink: 0;
}

/* ===== PRODUCT GRID (Shop) ===== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.product-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), 0 0 20px var(--color-primary-muted);
}

.product-card__image {
  aspect-ratio: 16/10;
  background: var(--color-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-border);
}

.product-card__image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-card__body {
  padding: 1.25rem;
}

.product-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.product-card__price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
}

.product-card__price--sale {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-card__price--original {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: line-through;
}

/* ===== TOAST NOTIFICATIONS ===== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  background: var(--color-surface);
  border: 1px solid;
}

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

.toast.success {
  border-color: var(--color-success);
  color: var(--color-success);
}

.toast.error {
  border-color: var(--color-error);
  color: var(--color-error);
}

.toast.warning {
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.toast.info {
  border-color: var(--color-info);
  color: var(--color-info);
}

/* ===== UTILITIES ===== */

.hidden {
  display: none !important;
}

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

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

.text-small {
  font-size: 0.875rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .main {
    padding: 1.5rem 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .auth-card {
    padding: 1.5rem;
    margin: 1rem;
  }

  .header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .header__nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .shop-banner {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

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

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: unset;
  }
}

@media (max-width: 480px) {
  .license-key {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .activation-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
