/**
 * VVP Vaktplan - Design System v5.0
 * Best-in-class UI/UX for Employee Scheduling
 * Inspired by: When I Work, Deputy, Humanity
 * 
 * Mobile-first, fully responsive, modern design
 */

/* ============================================
   EMOJI SUPPORT - Native emojis (no WordPress conversion)
   ============================================ */

/* Ensure WordPress emoji images display if they exist */
img.emoji,
img.wp-smiley {
  display: inline-block !important;
  height: 1em !important;
  width: 1em !important;
  margin: 0 0.07em !important;
  vertical-align: -0.1em !important;
  background: none !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

:root {
  /* Map to sentrale vvp tokens når tilgjengelig */
  --primary: var(--vvp-primary, #1a4d3e);
  --primary-dark: var(--vvp-primary-dark, #0f3328);
  --primary-light: var(--vvp-primary-light, #2d6a4f);
  --secondary: var(--vvp-secondary, #0f766e);
  --secondary-dark: var(--vvp-secondary-dark, #0d5d56);
  --accent: var(--vvp-accent, #c77b4a);
  --accent-dark: var(--vvp-accent-hover, #a66339);
  --bg-primary: var(--vvp-bg-primary, #ffffff);
  --bg-secondary: var(--vvp-bg-secondary, #faf9f7);
  --bg-tertiary: var(--vvp-bg-tertiary, #f5f4f0);
  --text-primary: var(--vvp-text-primary, #1e293b);
  --text-secondary: var(--vvp-text-secondary, #57534e);
  --text-tertiary: var(--vvp-text-tertiary, #78716c);
  --border-color: var(--vvp-border-color, #e7e5e0);
}

/* Base surfaces to unngå svart tekst på svart i mørk nettleser */
body,
.vvp-manager,
.vvp-employee,
.vvp-layout {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.card,
.vvp-modal-content,
.vvp-diagnostics,
.vvp-warnings,
.vvp-debug-banner {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

input,
select,
textarea,
.vvp-topbar-search,
.vvp-store-dropdown,
.vvp-topbar-btn {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

@media (prefers-color-scheme: dark) {
  body,
  .vvp-manager,
  .vvp-employee,
  .vvp-layout {
    background: var(--bg-primary, #0b1220);
    color: var(--text-primary, #e2e8f0);
  }

  .card,
  .vvp-modal-content,
  .vvp-diagnostics,
  .vvp-warnings,
  .vvp-debug-banner {
    background: var(--bg-secondary, #0f172a);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--border-color, #1f2937);
    box-shadow: var(--shadow-sm);
  }

  .vvp-topbar,
  .vvp-topbar-search,
  .vvp-store-dropdown,
  .vvp-topbar-btn {
    background: var(--bg-secondary, #0f172a);
    border-color: var(--border-color, #1f2937);
    color: var(--text-primary, #e2e8f0);
  }

  .vvp-topbar-nav-item {
    color: var(--text-secondary, #cbd5e1);
  }

  .vvp-topbar-nav-item.active,
  .vvp-topbar-nav-item:hover {
    color: #fff;
    background: var(--primary, #22c55e);
  }

  input,
  select,
  textarea {
    background: var(--bg-secondary, #0f172a);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--border-color, #1f2937);
  }

  .button.secondary {
    background: #1f2937;
    color: #e2e8f0;
  }
}

/* Ensure native emojis render with proper font */
body,
.vvp-modern-dashboard,
.vvp-topbar,
.vvp-stat-card,
.card,
button,
input,
select,
textarea {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
}

/* Specific emoji styling */
.emoji,
[role="img"],
span[aria-label] {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif !important;
  font-style: normal !important;
  font-weight: normal !important;
  line-height: 1 !important;
  display: inline-block !important;
}

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Colors - Deep Forest Green & Copper palette */
  --primary: #1a4d3e;
  --primary-dark: #0f3328;
  --primary-light: #2d6a4f;
  --secondary: #0f766e;
  --secondary-dark: #0d5d56;
  --accent: #c77b4a;
  --accent-dark: #a66339;
  
  /* Neutrals */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Status colors */
  --success: #2d6a4f;
  --warning: #b45309;
  --error: #b91c1c;
  --info: #0f766e;
  
  /* Semantic colors */
  --bg-primary: #ffffff;
  --bg-secondary: #faf9f7;
  --bg-tertiary: #f5f4f0;
  --text-primary: #1e293b;
  --text-secondary: #57534e;
  --text-tertiary: #78716c;
  --border-color: #e7e5e0;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Source Code Pro', monospace;
  
  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Layout */
  --topbar-height: 64px;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 80px;
  --container-max: 1600px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
  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);
  color: var(--text-primary);
  background: var(--bg-secondary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================
   TOP NAVIGATION BAR
   ============================================ */
.vvp-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

/* Adjust for WordPress admin bar */
body.admin-bar .vvp-topbar {
  top: 32px; /* WP admin bar height on desktop */
}

@media screen and (max-width: 782px) {
  body.admin-bar .vvp-topbar {
    top: 46px; /* WP admin bar height on mobile */
  }
}

.vvp-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.vvp-topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.vvp-topbar-logo-icon {
  font-size: 2rem;
}

.vvp-topbar-nav {
  display: flex;
  gap: var(--space-2);
}

.vvp-topbar-nav-item {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.vvp-topbar-nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.vvp-topbar-nav-item.active {
  background: var(--primary);
  color: white;
}

/* Highlight style for special nav items like AI Import */
.vvp-topbar-nav-item--highlight {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  position: relative;
}

.vvp-topbar-nav-item--highlight:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
}

.vvp-topbar-nav-item--highlight.active {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
}

/* "NY" badge for nav items */
.vvp-topbar-badge-new {
  font-size: 9px;
  font-weight: 700;
  background: #f59e0b;
  color: white;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vvp-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.vvp-topbar-search {
  position: relative;
  width: 300px;
}

.vvp-topbar-search input {
  width: 100%;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-10);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.vvp-topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.vvp-topbar-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.vvp-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.vvp-topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gray-300);
  background: #ffffff;
  color: var(--gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-size: 20px;
}

.vvp-topbar-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-900);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.vvp-topbar-btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--error);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  border: 2px solid #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Notifications Dropdown */
#vvp-notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 400px;
  max-height: 500px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-base);
  z-index: 1000;
  overflow: hidden;
}

#vvp-notifications-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notifications-dropdown-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.notifications-dropdown-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.notifications-dropdown-content {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.notification-item:hover {
  background: var(--gray-50);
}

.notification-item.unread {
  background: #eff6ff;
}

.notification-item.unread:hover {
  background: #dbeafe;
}

.notification-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notification-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notification-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.notification-unread-dot {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 8px;
  height: 8px;
  background: var(--info);
  border-radius: var(--radius-full);
}

.notifications-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  text-align: center;
}

.notifications-footer .btn-view-all {
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.notifications-footer .btn-view-all:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

@media (max-width: 768px) {
  #vvp-notifications-dropdown {
    width: calc(100vw - 32px);
    max-width: 400px;
    right: 16px;
  }
}

.vvp-topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.vvp-topbar-user:hover {
  background: var(--bg-secondary);
}

.vvp-topbar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.vvp-topbar-user-info {
  display: flex;
  flex-direction: column;
}

.vvp-topbar-user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.vvp-topbar-user-role {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.vvp-topbar-user-arrow {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
  margin-left: var(--space-1);
}

.vvp-topbar-user.active .vvp-topbar-user-arrow {
  transform: rotate(180deg);
}

/* User Dropdown Menu */
.vvp-user-dropdown,
.vvp-topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  z-index: 1000;
}

.vvp-user-dropdown.active,
.vvp-topbar-user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.vvp-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.vvp-dropdown-item:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

.vvp-dropdown-icon {
  font-size: 1.125rem;
  opacity: 0.8;
}

.vvp-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-2) 0;
}

/* Store dropdown in topbar */
.vvp-store-dropdown {
  padding: 8px 12px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vvp-store-dropdown:hover {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-dark);
}

.vvp-store-dropdown:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 77, 62, 0.2);
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.vvp-layout {
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* Adjust for WordPress admin bar */
body.admin-bar .vvp-layout {
  padding-top: calc(var(--topbar-height) + 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .vvp-layout {
    padding-top: calc(var(--topbar-height) + 46px);
  }
}

.vvp-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

/* Full width variant */
.vvp-container-fluid {
  width: 100%;
  padding: var(--space-8) var(--space-6);
}

/* ============================================
   PAGE HEADER
   ============================================ */
.vvp-page-header {
  margin-bottom: var(--space-8);
}

.vvp-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.vvp-page-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.vvp-page-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ============================================
   CARDS & SECTIONS
   ============================================ */
.vvp-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-6);
  transition: all var(--transition-base);
}

.vvp-card:hover {
  box-shadow: var(--shadow-md);
}

.vvp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.vvp-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.vvp-card-actions {
  display: flex;
  gap: var(--space-2);
}

.vvp-card-body {
  /* Body content */
}

.vvp-card-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================
   BUTTONS - Modern, consistent
   ============================================ */
.vvp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.vvp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary button */
.vvp-btn-primary {
  background: var(--primary);
  color: white;
}

.vvp-btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Secondary button */
.vvp-btn-secondary {
  background: var(--secondary);
  color: white;
}

.vvp-btn-secondary:hover:not(:disabled) {
  background: var(--secondary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Outline button */
.vvp-btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.vvp-btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

/* Ghost button */
.vvp-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.vvp-btn-ghost:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Danger button */
.vvp-btn-danger {
  background: var(--error);
  color: white;
}

.vvp-btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Button sizes */
.vvp-btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.75rem;
}

.vvp-btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1rem;
}

.vvp-btn-icon {
  padding: var(--space-3);
  width: 40px;
  height: 40px;
}

/* ============================================
   ADDITIONAL BUTTON STYLES (Standardized)
   ============================================ */

/* Base button styles - ensure consistency */
button, .button, a.button, input[type="button"], input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease-out;
  text-decoration: none;
  white-space: nowrap;
  outline: none;
  min-height: 44px; /* Touch-friendly */
}

/* Primary button variant - keep blue contrast with white text */
.button.primary,
button.primary,
a.button.primary,
input[type="button"].primary,
input[type="submit"].primary {
  color: #fff;
}

.button.primary:hover,
button.primary:hover,
a.button.primary:hover,
input[type="button"].primary:hover,
input[type="submit"].primary:hover,
.button.primary:visited,
a.button.primary:visited {
  color: #fff;
}

/* Success button alias */
.button.success,
button.btn-success {
  background-color: #2d6a4f;
  color: white;
  border-color: #1a4d3e;
}

.button.success:hover,
button.btn-success:hover {
  background-color: #1a4d3e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 77, 62, 0.3);
}

.button.success:active,
button.btn-success:active {
  background-color: #0f3328;
  transform: translateY(0);
}

/* Large buttons */
.button.large,
button.btn-large {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 700;
}

/* Small buttons */
.button.small,
button.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Full-width button */
.button.full-width,
button.btn-full-width {
  width: 100%;
}

/* Loading state */
button.loading,
button.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

button.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinButton 0.6s linear infinite;
}

@keyframes spinButton {
  to { transform: rotate(360deg); }
}

/* Icon buttons */
button.icon-only,
button.btn-icon {
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Button groups */
.button-group,
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-group.vertical,
.btn-group.vertical {
  flex-direction: column;
}

/* Button with icon and text */
button svg,
.button svg {
  width: 18px;
  height: 18px;
}

/* Form buttons */
form .button-group,
form .btn-group {
  margin-top: 20px;
  gap: 12px;
}

/* Link buttons (anchor tags styled as buttons) */
a.button {
  display: inline-flex;
  border: 1px solid transparent;
  margin: 0;
}

a.button:visited {
  color: inherit;
}

/* Accessibility */
button:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:disabled:focus-visible,
.button:disabled:focus-visible {
  outline: none;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --container-max: 100%;
  }
  
  .vvp-topbar-search {
    width: 200px;
  }
  
  .vvp-topbar-user-info {
    display: none;
  }
  
  .vvp-container {
    padding: var(--space-6) var(--space-4);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .vvp-topbar {
    padding: 0 var(--space-4);
  }
  
  .vvp-topbar-nav {
    display: none;
  }
  
  .vvp-topbar-search {
    display: none;
  }
  
  .vvp-page-title {
    font-size: 1.5rem;
  }
  
  .vvp-container {
    padding: var(--space-4) var(--space-3);
  }
  
  .vvp-card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }
  
  .vvp-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Touch-friendly buttons */
  button, .button, a.button, input[type="button"], input[type="submit"] {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 48px;
  }
  
  .button-group, .btn-group {
    flex-direction: column;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.ml-4 { margin-left: var(--space-4); }
.mr-4 { margin-right: var(--space-4); }

/* ============================================
   PREVENT TEXT CUTOFF & OVERFLOW
   ============================================ */

/* Ensure text doesn't overflow containers */
h1, h2, h3, h4, h5, h6,
.vvp-page-title,
.vvp-card-title,
.card h3 {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Tables - always scrollable horizontally */
.table-responsive,
.vvp-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  min-width: 100%;
}

table th,
table td {
  word-wrap: normal;
  white-space: nowrap;
}

/* Allow wrapping for specific content columns */
table td.wrap-content,
table th.wrap-content {
  white-space: normal;
  word-wrap: break-word;
  max-width: 200px;
}

/* Truncate long text with ellipsis */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   EXTRA MOBILE BREAKPOINTS
   ============================================ */
@media (max-width: 480px) {
  .vvp-page-title {
    font-size: 1.25rem;
  }
  
  .vvp-card-title {
    font-size: 1rem;
  }
  
  .vvp-card {
    padding: var(--space-3);
  }
  
  .vvp-btn {
    padding: var(--space-3) var(--space-4);
    font-size: 0.8125rem;
  }
}

/* ============================================
   DARK MODE - ADDITIONAL ELEMENTS
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* Ensure all text is readable */
  p, span, div, li, label {
    color: inherit;
  }
  
  /* Form elements */
  input,
  select,
  textarea {
    background: var(--bg-tertiary, #111827);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--border-color, #1f2937);
  }
  
  input::placeholder,
  textarea::placeholder {
    color: var(--text-tertiary, #6b7280);
  }
  
  /* Tables */
  table {
    background: var(--bg-secondary, #0f172a);
  }
  
  table th {
    background: var(--bg-tertiary, #111827);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--border-color, #1f2937);
  }
  
  table td {
    border-color: var(--border-color, #1f2937);
    color: var(--text-primary, #e2e8f0);
  }
  
  table tr:hover td {
    background: var(--bg-tertiary, #111827);
  }
  
  /* List items */
  li {
    border-color: var(--border-color, #1f2937);
  }
  
  /* Badges & tags */
  .badge,
  .tag,
  .label {
    background: var(--bg-tertiary, #111827);
    color: var(--text-secondary, #94a3b8);
    border-color: var(--border-color, #1f2937);
  }
  
  /* Tooltips */
  [data-tooltip]::after {
    background: var(--bg-primary, #0b1220);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--border-color, #1f2937);
  }
  
  /* Dropdowns */
  .dropdown-menu,
  .select-dropdown {
    background: var(--bg-secondary, #0f172a);
    border-color: var(--border-color, #1f2937);
  }
  
  .dropdown-item:hover {
    background: var(--bg-tertiary, #111827);
  }
  
  /* Alerts & notifications */
  .alert,
  .notification {
    border-color: var(--border-color, #1f2937);
  }
  
  .alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
  }
  
  .alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
  }
  
  .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
  }
  
  .alert-error,
  .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
  }
  
  /* Progress bars */
  .progress-bar {
    background: var(--bg-tertiary, #111827);
  }
  
  /* Shadows should be darker */
  .vvp-card,
  .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  .vvp-card:hover,
  .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

/* ============================================
   MODERN CONFIRMATION MODAL
   ============================================ */
.vvp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.vvp-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.vvp-confirm-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 420px;
  width: 90%;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-base);
  overflow: hidden;
}

.vvp-modal-overlay.visible .vvp-confirm-modal {
  transform: scale(1) translateY(0);
}

.vvp-confirm-header {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: var(--space-6);
  text-align: center;
  border-bottom: 1px solid #fcd34d;
}

.vvp-confirm-icon {
  font-size: 3rem;
  margin-bottom: var(--space-2);
}

.vvp-confirm-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #92400e;
}

.vvp-confirm-body {
  padding: var(--space-6);
}

.vvp-confirm-body > p {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-align: center;
}

.vvp-confirm-info {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.vvp-confirm-info-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.vvp-confirm-info-item .icon {
  color: var(--success);
  font-weight: 700;
}

.vvp-confirm-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
  color: #991b1b;
  font-size: 0.875rem;
}

.vvp-confirm-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.vvp-confirm-footer .vvp-btn {
  flex: 1;
}

/* ============================================
   DRAG AND DROP COMPONENTS
   ============================================ */

/* Draggable item */
.vvp-draggable {
  cursor: grab;
  user-select: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.vvp-draggable:active {
  cursor: grabbing;
}

.vvp-draggable.dragging {
  opacity: 0.8;
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

/* Drop zone */
.vvp-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
}

.vvp-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(26, 77, 62, 0.05);
}

.vvp-drop-zone.drag-over::after {
  content: 'Slipp her';
  display: block;
  color: var(--primary);
  font-weight: 600;
  margin-top: var(--space-2);
}

/* Dashboard widget grid with drag-and-drop */
.vvp-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.vvp-widget {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all var(--transition-base);
}

.vvp-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  cursor: grab;
}

.vvp-widget-header:active {
  cursor: grabbing;
}

.vvp-widget-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--text-primary);
}

.vvp-widget-actions {
  display: flex;
  gap: var(--space-2);
}

.vvp-widget-action {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vvp-widget-action:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.vvp-widget-body {
  padding: var(--space-5);
}

.vvp-widget.dragging {
  opacity: 0.6;
  transform: rotate(2deg);
}

.vvp-widget-placeholder {
  border: 2px dashed var(--primary);
  border-radius: var(--radius-xl);
  background: rgba(26, 77, 62, 0.05);
  min-height: 200px;
}

/* Sortable list */
.vvp-sortable-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vvp-sortable-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  cursor: grab;
  transition: all var(--transition-fast);
}

.vvp-sortable-item:active {
  cursor: grabbing;
}

.vvp-sortable-item.dragging {
  background: var(--primary-light);
  color: white;
  box-shadow: var(--shadow-lg);
}

.vvp-sortable-handle {
  color: var(--text-tertiary);
  cursor: grab;
}

.vvp-sortable-handle:active {
  cursor: grabbing;
}

/* ============================================
   RESPONSIVE DRAG & DROP
   ============================================ */
@media (max-width: 768px) {
  .vvp-widget-grid {
    grid-template-columns: 1fr;
  }

  .vvp-confirm-modal {
    width: 95%;
    margin: var(--space-4);
  }

  .vvp-confirm-footer {
    flex-direction: column;
  }
}

/* ============================================
   TOUCH DEVICE ENHANCEMENTS
   ============================================ */
@media (pointer: coarse) {
  .vvp-draggable,
  .vvp-sortable-item,
  .vvp-widget-header {
    /* Larger touch targets */
    min-height: 48px;
  }

  .vvp-sortable-handle {
    padding: var(--space-3);
    margin: calc(var(--space-3) * -1);
  }
}

