/* ============================================
   Material Design CSS for MW Product Portal
   Color Theme: Natural Green/Cream
   ============================================ */

:root {
  /* Primary Colors */
  --color-primary: #356859;
  --color-primary-dark: #2a5447;
  --color-primary-light: #4a7c6c;

  /* Accent Colors */
  --color-accent: #fd5533;
  --color-accent-dark: #e04a2a;

  /* Status Colors */
  --color-error: #fd5533;
  --color-warning: #ff9800;
  --color-success: #4caf50;
  --color-info: #2196f3;

  /* Surface Colors */
  --color-background: #f9fff6;
  --color-surface: #f5f5f5;
  --color-surface-warm: #fffbe6;
  --color-surface-light: #e6f5df;

  /* Text Colors */
  --color-text-primary: #212121;
  --color-text-secondary: #757575;
  --color-text-disabled: #9e9e9e;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition-base: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--color-background);
  margin: 0;
  min-height: 100vh;
  color: var(--color-text-primary);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* ============================================
   Dashboard Container
   ============================================ */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ============================================
   Header Bar (Legacy - replaced by navbar)
   ============================================ */
.header-bar {
  background: var(--color-primary);
  color: white;
  padding: 16px 0;
  box-shadow: var(--shadow-md);
}

.header-signout {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.header-signout:hover {
  color: white;
}

.header-user {
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   Collection Header
   ============================================ */
.collection-header {
  background: var(--color-surface-warm);
  padding: 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-accent);
}

.collection-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0;
}

.collection-meta {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--color-surface-warm);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--transition-base);
  border: 1px solid rgba(53, 104, 89, 0.1);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--color-surface-light);
}

.stat-card-error {
  border-left-color: var(--color-error);
}

.stat-card-warning {
  border-left-color: var(--color-warning);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 4px;
}

.stat-value-error {
  color: var(--color-error);
}

.stat-value-warning {
  color: var(--color-warning);
}

/* ============================================
   Info Box
   ============================================ */
.info-box {
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 0.875rem;
  border-left: 4px solid;
}

.info-box ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.info-box li {
  margin: 4px 0;
}

.info-box-warning {
  background: #fff8e1;
  border-left-color: var(--color-warning);
  color: #5D4037;
}

.info-box-error {
  background: #ffebee;
  border-left-color: var(--color-error);
  color: #c62828;
}

.info-box-success {
  background: #e8f5e9;
  border-left-color: var(--color-success);
  color: #2e7d32;
}

.info-box-info {
  background: #e3f2fd;
  border-left-color: var(--color-info);
  color: #1565c0;
}

/* ============================================
   Action Buttons
   ============================================ */
.action-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--transition-base);
  text-decoration: none;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.action-button-primary {
  background: var(--color-primary);
  color: white;
}

.action-button-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.action-button-accent {
  background: var(--color-accent);
  color: white;
}

.action-button-accent:hover:not(:disabled) {
  background: var(--color-accent-dark);
}

.action-button-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.action-button-outline:hover:not(:disabled) {
  background: var(--color-surface-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================
   Variants Section
   ============================================ */
.variants-section {
  background: var(--color-surface-warm);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid rgba(53, 104, 89, 0.1);
}

.variants-header {
  padding: 20px;
  border-bottom: 1px solid var(--color-surface-light);
  background: var(--color-surface-warm);
}

.variants-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
}

.variants-header p {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin: 4px 0 0 0;
}

.variants-container {
  padding: 16px;
}

/* ============================================
   Product Card Layout
   ============================================ */
.product-card {
  background: var(--color-surface-warm);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid rgba(53, 104, 89, 0.1);
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-primary);
  color: white;
}

.product-card-title {
  font-weight: 600;
  color: white;
}

.product-card-id {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-left: 8px;
  font-family: monospace;
}

.product-card-link {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.product-card-link:hover {
  text-decoration: underline;
  color: white;
}

/* ============================================
   Variant Row
   ============================================ */
.variant-row {
  background: white;
  border-bottom: 1px solid var(--color-surface-light);
}

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

.variant-row-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.variant-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.variant-col-label {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  font-weight: 500;
}

.variant-col-value {
  font-size: 0.875rem;
  color: var(--color-text-primary);
}

.variant-col-value-mono {
  font-family: monospace;
  font-size: 0.8rem;
}

.variant-col-variant {
  flex: 2;
  min-width: 150px;
}

.variant-col-sku {
  flex: 1;
  min-width: 80px;
}

.variant-col-barcode {
  flex: 1.5;
  min-width: 120px;
}

.variant-col-price {
  flex: 0.8;
  min-width: 70px;
}

.variant-col-stock {
  flex: 0.6;
  min-width: 50px;
  text-align: center;
}

.variant-col-image {
  flex: 0.8;
  min-width: 60px;
}

.variant-col-issues {
  flex: 1.5;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

/* ============================================
   Value States
   ============================================ */
.value-error {
  color: var(--color-error) !important;
  font-weight: 600;
}

.value-success {
  color: var(--color-success) !important;
}

.value-warning {
  color: var(--color-warning) !important;
}

/* ============================================
   Add Button
   ============================================ */
.add-button {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s var(--transition-base);
}

.add-button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

/* ============================================
   Issue Badge
   ============================================ */
.issue-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  background: #ffebee;
  color: var(--color-error);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--color-success);
  margin-bottom: 16px;
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: white;
  font-weight: 600;
  margin-top: 16px;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 600;
  color: white;
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  animation: slideIn 0.3s var(--transition-base);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

/* ============================================
   Modal (Base styles for all modals)
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-container {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.modal-header {
  background: var(--color-primary);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  background: var(--color-surface-warm);
}

.modal-footer {
  padding: 16px 20px;
  background: var(--color-surface-light);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid rgba(53, 104, 89, 0.1);
}

/* Modal Info Section */
.modal-info {
  background: var(--color-surface-light);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-left: 3px solid var(--color-primary);
}

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

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

.modal-info-label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.modal-info-value {
  font-weight: 600;
  font-size: 0.85rem;
}

/* Modal Input Group */
.modal-input-group {
  margin-bottom: 16px;
}

.modal-input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 8px;
}

.modal-input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-surface-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: white;
}

.modal-input-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.modal-input-hint {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-surface-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-input-large {
  font-size: 1.25rem;
  padding: 16px;
}

/* ============================================
   Status Text
   ============================================ */
.status-text {
  font-size: 0.875rem;
}

.status-text-success {
  color: var(--color-success);
}

.status-text-error {
  color: var(--color-error);
}

.status-text-pending {
  color: var(--color-warning);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 16px 12px;
  }

  .variant-row-content {
    flex-wrap: wrap;
  }

  .variant-col {
    min-width: auto !important;
  }

  .variant-col-issues {
    width: 100%;
    justify-content: flex-start;
    margin-top: 8px;
  }

  .modal-container {
    max-height: 100vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }
}