/**
 * Customer Pages Common Styles
 * Shared styles for all customer-facing pages
 * Provides consistent design language across the platform
 */

/* ========== CSS VARIABLES ========== */

:root {
  /* Primära färger */
  --primary: #1e293b;
  --primary-hover: #0f172a;
  --secondary: #334155;
  
  /* Bakgrunder */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  
  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  /* Accenter */
  --accent-success: #059669;
  --accent-warning: #d97706;
  --accent-info: #0284c7;
  --accent-error: #dc2626;
  
  /* Borders & Shadows */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgba(30, 41, 59, 0.05);
  --shadow-md: 0 2px 8px rgba(30, 41, 59, 0.08);
  --shadow-lg: 0 4px 12px rgba(30, 41, 59, 0.12);
  
  /* Safe area insets */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

/* ========== PAGE CONTAINER ========== */

.page-container-v2 {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 3rem;
  margin-top: calc(100px + var(--safe-area-inset-top));
  padding-bottom: calc(2rem + var(--safe-area-inset-bottom));
}

/* ========== PAGE HEADERS ========== */

.page-header {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border-radius: 16px;
  padding: 3rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.page-header-content {
  flex: 1;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0;
}

.page-header-actions {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 1rem;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid var(--primary);
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.9375rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

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

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--border-light);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.9375rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.9375rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--accent-error);
  color: white;
  border: 1px solid var(--accent-error);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.9375rem;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: var(--shadow-lg);
}

/* ========== TABS ========== */

.tabs-navigation {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.tab {
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content {
  animation: fadeIn 0.3s ease;
}

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

/* ========== STATUS BADGES ========== */

.badge {
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-block;
}

.badge-success {
  background: #dcfce7;
  color: var(--accent-success);
}

.badge-warning {
  background: #fef3c7;
  color: var(--accent-warning);
}

.badge-info {
  background: #dbeafe;
  color: var(--accent-info);
}

.badge-error {
  background: #fee2e2;
  color: var(--accent-error);
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

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

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

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

.form-label-required::after {
  content: " *";
  color: var(--accent-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s;
  background: white;
  color: var(--text-primary);
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

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

.form-error {
  font-size: 0.875rem;
  color: var(--accent-error);
  margin-top: 0.5rem;
}

/* ========== FILTERS ========== */

.filters-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-button {
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9375rem;
}

.filter-button:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.filter-button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ========== SEARCH BAR ========== */

.search-bar {
  position: relative;
  max-width: 600px;
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ========== LISTS ========== */

.list-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.2s;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--bg-subtle);
}

/* ========== EMPTY STATES ========== */

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

.empty-state-icon {
  font-size: 4rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ========== LOADING STATES ========== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 0px, #f8f8f8 40px, #f0f0f0 80px);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

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

.alert {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.alert-success {
  background: #dcfce7;
  color: var(--accent-success);
  border: 1px solid var(--accent-success);
}

.alert-warning {
  background: #fef3c7;
  color: var(--accent-warning);
  border: 1px solid var(--accent-warning);
}

.alert-info {
  background: #dbeafe;
  color: var(--accent-info);
  border: 1px solid var(--accent-info);
}

.alert-error {
  background: #fee2e2;
  color: var(--accent-error);
  border: 1px solid var(--accent-error);
}

.alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

/* ========== MODALS ========== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* ========== TABLET RESPONSIVENESS ========== */

@media (max-width: 1024px) {
  .page-container-v2 {
    padding: 1.5rem;
  }
  
  .page-header {
    padding: 2rem;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .page-header-actions {
    width: 100%;
  }
  
  .page-header-actions .btn-primary,
  .page-header-actions .btn-secondary {
    flex: 1;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .filters-bar {
    gap: 0.75rem;
  }
  
  .tab {
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
  }
}

/* ========== MOBILE (UNCHANGED) ========== */

@media (max-width: 768px) {
  /* Mobilvyn använder sina egna styles - ingen ändring */
  /* Denna CSS fil påverkar INTE mobil */
}
