/* ============================================
   CLARITYSEEK COMPONENT LIBRARY v2.0
   2025 Modern Components
   ============================================ */

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--duration-150) var(--ease-out);
}

.theme-toggle:hover {
  background-color: var(--surface-tertiary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  transition: color var(--duration-150) var(--ease-out),
              transform var(--duration-300) var(--ease-spring);
}

.theme-toggle:hover .icon-sun,
.theme-toggle:hover .icon-moon {
  color: var(--text-primary);
}

/* Sun shown in dark mode (click to go light) */
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Moon shown in light mode (click to go dark) */
[data-theme="light"] .theme-toggle .icon-sun,
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }

/* Animation on toggle */
.theme-toggle:active .icon-sun,
.theme-toggle:active .icon-moon {
  transform: rotate(30deg) scale(0.9);
}

/* ============================================
   BUTTON COMPONENTS
   ============================================ */

/* Base Button */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2-5) var(--space-4);
  height: var(--btn-height-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all var(--duration-150) var(--ease-out);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Button Sizes */
.btn-sm {
  height: var(--btn-height-sm);
  padding: var(--space-1-5) var(--space-3);
  font-size: var(--text-xs);
  gap: var(--space-1-5);
}

.btn-lg {
  height: var(--btn-height-lg);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  gap: var(--space-2-5);
}

/* Primary Button (Gradient) */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}

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

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-primary);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface-primary);
  color: var(--text-primary);
  border-color: var(--border-default);
}

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

.btn-secondary:active {
  background: var(--surface-tertiary);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--brand-primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--brand-primary-50);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(81, 104, 175, 0.15);
}

.btn-ghost:active {
  background: var(--brand-primary-100);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

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

/* Danger Button */
.btn-danger {
  background: var(--color-error);
  color: white;
  border-color: transparent;
}

.btn-danger:hover {
  background: var(--color-error-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.25);
}

/* Icon Button */
.btn-icon {
  width: var(--btn-height-md);
  padding: 0;
  gap: 0;
}

.btn-icon.btn-sm {
  width: var(--btn-height-sm);
}

.btn-icon.btn-lg {
  width: var(--btn-height-lg);
}

.btn-icon svg,
.btn-icon img {
  width: 20px;
  height: 20px;
}

.btn-icon.btn-sm svg,
.btn-icon.btn-sm img {
  width: 16px;
  height: 16px;
}

.btn-icon.btn-lg svg,
.btn-icon.btn-lg img {
  width: 24px;
  height: 24px;
}

/* Button with Icon */
.btn svg,
.btn img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-sm svg,
.btn-sm img {
  width: 14px;
  height: 14px;
}

.btn-lg svg,
.btn-lg img {
  width: 20px;
  height: 20px;
}

/* Loading State */
.btn-loading {
  color: transparent !important;
  pointer-events: none;
}

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

.btn-secondary.btn-loading::after,
.btn-ghost.btn-loading::after,
.btn-outline.btn-loading::after {
  border-color: var(--brand-primary) transparent var(--brand-primary) transparent;
}

@keyframes btn-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Button Group */
.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.btn-group .btn:not(:first-child) {
  margin-left: -1px;
}

.btn-group .btn:hover,
.btn-group .btn:focus {
  z-index: 1;
}

/* Full Width */
.btn-block {
  width: 100%;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

/* Form Group */
.form-group {
  position: relative;
  margin-bottom: var(--space-4);
}

/* Labels */
.form-label {
  display: block;
  margin-bottom: var(--space-1-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

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

/* Base Input */
.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  height: var(--input-height-md);
  padding: var(--space-2-5) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-150) var(--ease-out),
              box-shadow var(--duration-150) var(--ease-out),
              background-color var(--duration-150) var(--ease-out);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-100);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
  box-shadow: 0 0 0 3px rgba(81, 104, 175, 0.25);
}

/* Input Sizes */
.form-input-sm,
.form-select-sm {
  height: var(--input-height-sm);
  padding: var(--space-1-5) var(--space-2-5);
  font-size: var(--text-sm);
}

.form-input-lg,
.form-select-lg {
  height: var(--input-height-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-lg);
}

/* Textarea */
.form-textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 20px;
  padding-right: var(--space-10);
  cursor: pointer;
}

/* Validation States */
.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
  border-color: var(--color-success);
}

.form-input.is-valid:focus,
.form-select.is-valid:focus,
.form-textarea.is-valid:focus {
  box-shadow: 0 0 0 3px var(--color-success-light);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--color-error);
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--color-error-light);
}

/* Disabled State */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--surface-tertiary);
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* Help Text */
.form-help {
  margin-top: var(--space-1-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.form-error {
  margin-top: var(--space-1-5);
  font-size: var(--text-sm);
  color: var(--color-error);
}

/* Input with Icon */
.form-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input-icon {
  position: absolute;
  left: var(--space-3);
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.form-input-group .form-input {
  padding-left: var(--space-10);
}

.form-input-icon-right {
  left: auto;
  right: var(--space-3);
}

.form-input-group .form-input.has-icon-right {
  padding-left: var(--space-3);
  padding-right: var(--space-10);
}

/* Floating Label */
.form-floating {
  position: relative;
}

.form-floating .form-input,
.form-floating .form-textarea {
  height: 56px;
  padding-top: var(--space-6);
  padding-bottom: var(--space-2);
}

.form-floating .form-input::placeholder,
.form-floating .form-textarea::placeholder {
  color: transparent;
}

.form-floating .form-label {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  padding: var(--space-4) var(--space-3);
  margin-bottom: 0;
  pointer-events: none;
  transform-origin: 0 0;
  transition: opacity var(--duration-150) var(--ease-out),
              transform var(--duration-150) var(--ease-out);
  color: var(--text-tertiary);
  font-weight: var(--font-normal);
}

.form-floating .form-input:focus ~ .form-label,
.form-floating .form-input:not(:placeholder-shown) ~ .form-label,
.form-floating .form-textarea:focus ~ .form-label,
.form-floating .form-textarea:not(:placeholder-shown) ~ .form-label {
  opacity: 0.85;
  transform: scale(0.8) translateY(-0.75rem);
  color: var(--brand-primary);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2-5);
  min-height: var(--space-6);
}

.form-check-input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  appearance: none;
  background-color: var(--surface-primary);
  border: 2px solid var(--border-strong);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.form-check-input[type="checkbox"] {
  border-radius: var(--radius-sm);
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input:hover {
  border-color: var(--brand-primary);
}

.form-check-input:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.form-check-input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.form-check-input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px;
}

.form-check-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-primary-100);
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
}

/* Toggle/Switch */
.form-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
}

.form-switch-input {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  appearance: none;
  background-color: var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--duration-200) var(--ease-out);
}

.form-switch-input::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-200) var(--ease-spring);
}

.form-switch-input:checked {
  background-color: var(--brand-primary);
}

.form-switch-input:checked::before {
  transform: translateX(20px);
}

.form-switch-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-primary-100);
}

.form-switch-label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

/* Base Card */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: transform var(--duration-200) var(--ease-spring),
              box-shadow var(--duration-200) var(--ease-out),
              border-color var(--duration-200) var(--ease-out);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-default);
}

.card-interactive:active {
  transform: translateY(-2px);
}

/* Card Sections */
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card-body {
  flex: 1;
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.card-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* Card Image */
.card-img {
  width: 100%;
  object-fit: cover;
}

.card-img-top {
  border-top-left-radius: calc(var(--radius-xl) - 1px);
  border-top-right-radius: calc(var(--radius-xl) - 1px);
}

/* Compact Card */
.card-compact .card-header {
  padding: var(--space-3) var(--space-4);
}

.card-compact .card-body {
  padding: var(--space-4);
}

.card-compact .card-footer {
  padding: var(--space-3) var(--space-4);
}

/* Glass Card */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.card-glass:hover {
  background: var(--glass-bg-hover);
}

/* Gradient Border Card */
.card-gradient-border {
  background: var(--surface-primary);
  border: none;
  padding: 1px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-xl);
}

.card-gradient-border > .card-inner {
  background: var(--surface-primary);
  border-radius: calc(var(--radius-xl) - 1px);
  height: 100%;
}

/* Stat Card */
.card-stat {
  padding: var(--space-5);
}

.card-stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary-50);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

[data-theme="dark"] .card-stat-icon {
  background: rgba(81, 104, 175, 0.15);
}

.card-stat-icon svg {
  width: 24px;
  height: 24px;
  color: var(--brand-primary);
}

.card-stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-1);
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.card-stat-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.card-stat-trend.up {
  color: var(--color-success-dark);
  background: var(--color-success-light);
}

.card-stat-trend.down {
  color: var(--color-error-dark);
  background: var(--color-error-light);
}

.card-stat-trend.neutral {
  color: var(--text-secondary);
  background: var(--surface-tertiary);
}

.card-stat-trend svg {
  width: 12px;
  height: 12px;
}

/* Profile Card */
.card-profile {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.card-profile-emoji {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  line-height: 1;
}

.card-profile-name {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.card-profile-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* Feature Card */
.card-feature {
  padding: var(--space-6);
}

.card-feature-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary-50), var(--brand-accent-50));
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

[data-theme="dark"] .card-feature-icon {
  background: linear-gradient(135deg, rgba(81, 104, 175, 0.15), rgba(110, 65, 150, 0.15));
}

.card-feature-icon svg {
  width: 28px;
  height: 28px;
  color: var(--brand-primary);
}

.card-feature-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.card-feature-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* Pricing Card */
.card-pricing {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.card-pricing.featured {
  border: 2px solid var(--brand-primary);
  box-shadow: var(--shadow-primary-lg);
}

.card-pricing-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: white;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}

.card-pricing-name {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.card-pricing-price {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.card-pricing-price span {
  font-size: var(--text-lg);
  font-weight: var(--font-normal);
  color: var(--text-secondary);
}

.card-pricing-period {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.card-pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6) 0;
  text-align: left;
}

.card-pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.card-pricing-features li svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-success);
}

/* ============================================
   NAVIGATION COMPONENTS
   ============================================ */

/* Glass Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-height);
  padding: 0 var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  border-bottom: 1px solid var(--glass-border);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand img,
.navbar-brand svg {
  height: 32px;
  width: auto;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--duration-150) var(--ease-out),
              background-color var(--duration-150) var(--ease-out);
}

.navbar-link:hover {
  color: var(--text-primary);
  background-color: var(--surface-tertiary);
}

.navbar-link.active {
  color: var(--brand-primary);
}

.navbar-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: var(--space-3);
  right: var(--space-3);
  height: 2px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Mobile Menu Toggle */
.navbar-toggle {
  display: none;
  padding: var(--space-2);
  background: transparent;
  border: none;
  cursor: pointer;
}

.navbar-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .navbar-toggle {
    display: flex;
  }

  .navbar-nav {
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-4);
    background: var(--surface-primary);
    border-bottom: 1px solid var(--border-default);
    display: none;
  }

  .navbar-nav.open {
    display: flex;
  }

  .navbar-link {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }

  .navbar-link.active::after {
    display: none;
  }
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-fixed);
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface-secondary);
  border-right: 1px solid var(--border-subtle);
  transition: width var(--duration-300) var(--ease-out);
}

.sidebar-header {
  display: flex;
  align-items: center;
  height: var(--navbar-height);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-brand img,
.sidebar-brand svg {
  height: 28px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--space-6);
}

.sidebar-section-title {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2-5) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--duration-150) var(--ease-out);
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
}

.sidebar-item.active {
  color: var(--brand-primary);
  background: var(--brand-primary-50);
  font-weight: var(--font-semibold);
}

[data-theme="dark"] .sidebar-item.active {
  background: rgba(81, 104, 175, 0.15);
}

.sidebar-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-item-badge {
  margin-left: auto;
  padding: var(--space-0-5) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: white;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-item-badge {
  display: none;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: var(--space-2-5);
}

/* Main content offset */
.main-with-sidebar {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--duration-300) var(--ease-out);
}

.sidebar.collapsed + .main-with-sidebar {
  margin-left: var(--sidebar-width-collapsed);
}

/* Horizontal Tabs */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-default);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--duration-150) var(--ease-out);
}

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

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

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

.tab svg {
  width: 18px;
  height: 18px;
}

.tab-badge {
  padding: var(--space-0-5) var(--space-1-5);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--brand-primary);
  background: var(--brand-primary-50);
  border-radius: var(--radius-full);
}

[data-theme="dark"] .tab-badge {
  background: rgba(81, 104, 175, 0.2);
}

/* Tabs Variants */
.tabs-pill {
  border-bottom: none;
  background: var(--surface-tertiary);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  gap: var(--space-0-5);
}

.tabs-pill .tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
}

.tabs-pill .tab.active {
  color: var(--text-primary);
  background: var(--surface-primary);
  box-shadow: var(--shadow-sm);
}

.tabs-pill .tab.active::after {
  display: none;
}

/* Tab Panels */
.tab-panel {
  display: none;
  padding: var(--space-6) 0;
}

.tab-panel.active {
  display: block;
  animation: fadeIn var(--duration-200) var(--ease-out);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb-item:hover {
  color: var(--brand-primary);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: var(--font-medium);
  pointer-events: none;
}

.breadcrumb-separator {
  color: var(--text-tertiary);
}

.breadcrumb-separator svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   MODAL COMPONENT
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-200) var(--ease-out),
              visibility var(--duration-200) var(--ease-out);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 32rem;
  max-height: calc(100vh - var(--space-8));
  background: var(--surface-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  transition: transform var(--duration-300) var(--ease-spring),
              opacity var(--duration-200) var(--ease-out);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Modal Sizes */
.modal-sm { max-width: 24rem; }
.modal-lg { max-width: 48rem; }
.modal-xl { max-width: 64rem; }
.modal-full {
  max-width: calc(100vw - var(--space-8));
  max-height: calc(100vh - var(--space-8));
}

/* Modal Sections */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

/* Modal with Image Header */
.modal-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.modal-image + .modal-header {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Confirmation Modal */
.modal-confirm .modal-body {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.modal-confirm-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-confirm-icon.warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.modal-confirm-icon.danger {
  background: var(--color-error-light);
  color: var(--color-error);
}

.modal-confirm-icon.success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.modal-confirm-icon svg {
  width: 32px;
  height: 32px;
}

.modal-confirm-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.modal-confirm-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.modal-confirm .modal-footer {
  justify-content: center;
}

/* ============================================
   DATA TABLE COMPONENT
   ============================================ */

.table-container {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

/* Table Header Bar */
.table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.table-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.table-search-input {
  width: 100%;
  height: 40px;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-10);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--duration-150) var(--ease-out);
}

.table-search-input:focus {
  outline: none;
  background: var(--surface-primary);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-100);
}

.table-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: middle;
}

.table th {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-150) var(--ease-out);
}

.table th.sortable:hover {
  color: var(--brand-primary);
}

.table td {
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background-color var(--duration-100) var(--ease-out);
}

.table tbody tr:hover {
  background: var(--surface-secondary);
}

/* Row Selection */
.table tbody tr.selected {
  background: var(--brand-primary-50);
}

[data-theme="dark"] .table tbody tr.selected {
  background: rgba(81, 104, 175, 0.15);
}

/* Table Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.table-pagination-info {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.table-pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.table-pagination-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--surface-primary);
  border-color: var(--border-default);
}

.table-pagination-btn.active {
  color: var(--brand-primary);
  background: var(--brand-primary-50);
  border-color: var(--brand-primary);
}

/* ============================================
   BADGE & TAG COMPONENTS
   ============================================ */

/* Base Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-0-5) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Badge Variants */
.badge-default {
  color: var(--text-secondary);
  background: var(--surface-tertiary);
}

.badge-primary {
  color: var(--brand-primary);
  background: var(--brand-primary-50);
}

[data-theme="dark"] .badge-primary {
  background: rgba(81, 104, 175, 0.2);
}

.badge-accent {
  color: var(--brand-accent);
  background: var(--brand-accent-50);
}

[data-theme="dark"] .badge-accent {
  background: rgba(110, 65, 150, 0.2);
}

.badge-success {
  color: var(--color-success-dark);
  background: var(--color-success-light);
}

.badge-warning {
  color: var(--color-warning-dark);
  background: var(--color-warning-light);
}

.badge-error {
  color: var(--color-error-dark);
  background: var(--color-error-light);
}

.badge-info {
  color: var(--color-info-dark);
  background: var(--color-info-light);
}

/* Solid Badges */
.badge-solid-primary {
  color: white;
  background: var(--brand-primary);
}

.badge-solid-success {
  color: white;
  background: var(--color-success);
}

.badge-solid-error {
  color: white;
  background: var(--color-error);
}

/* Badge Sizes */
.badge-sm {
  padding: var(--space-0-5) var(--space-1-5);
  font-size: 0.625rem;
}

.badge-lg {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

/* Badge with Dot */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Tags (Interactive Badges) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: var(--surface-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
}

.tag:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
  border-color: var(--border-strong);
}

.tag.active {
  color: var(--brand-primary);
  background: var(--brand-primary-50);
  border-color: var(--brand-primary);
}

/* Status Indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-online .status-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 2px var(--color-success-light);
}

.status-offline .status-dot {
  background: var(--brand-neutral);
}

.status-busy .status-dot {
  background: var(--color-error);
}

/* ============================================
   AVATAR COMPONENT
   ============================================ */

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-primary-100);
  color: var(--brand-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-base); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-lg); }

.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface-primary);
  border-radius: 50%;
}

.avatar-status.online { background: var(--color-success); }
.avatar-status.offline { background: var(--brand-neutral); }
.avatar-status.busy { background: var(--color-error); }

/* Avatar Group */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--surface-primary);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   LOGO PLACEHOLDER
   ============================================ */

.logo-placeholder {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.logo-text {
  font-family: var(--font-sans);
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Logo in auth brand panel (white text) */
.auth-brand .logo-text {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: white;
}

/* Size variants */
.logo-sm .logo-text { font-size: var(--text-base); }
.logo-lg .logo-text { font-size: var(--text-2xl); }
.logo-xl .logo-text { font-size: var(--text-3xl); }

/* Logo with icon */
.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
  border-radius: var(--radius-md);
  color: white;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
}

.logo-sm .logo-icon { width: 24px; height: 24px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.logo-lg .logo-icon { width: 40px; height: 40px; font-size: var(--text-base); }
.logo-xl .logo-icon { width: 48px; height: 48px; font-size: var(--text-lg); }

/* Navbar logo adjustments */
.navbar-brand .logo-text {
  font-size: var(--text-lg);
}

/* Sidebar logo - compact */
.sidebar-header .logo-text {
  font-size: var(--text-xl);
}

/* Footer logo */
.footer-brand .logo-text {
  font-size: var(--text-lg);
}

/* Dark mode adjustments */
[data-theme="dark"] .logo-text {
  background: linear-gradient(135deg, var(--brand-primary-light) 0%, var(--brand-accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
