/**
 * Frontend Persona Switcher Styles
 * Highly customizable with CSS variables and semantic class names
 * Theme CSS can easily override these styles
 */

/* CSS Variables for easy customization */
.kp-frontend-switcher {
  --kp-button-bg: #333333;
  --kp-button-text: #ffffff;
  --kp-button-size: 56px;
  --kp-panel-bg: #ffffff;
  --kp-panel-text: #333333;
  --kp-panel-width: 280px;
  --kp-panel-border-radius: 8px;
  --kp-panel-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  --kp-transition-speed: 0.3s;
  --kp-z-index: 9998;
}

/* Base switcher container */
.kp-frontend-switcher {
  position: fixed;
  z-index: var(--kp-z-index);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Position classes */
.kp-frontend-switcher.kp-switcher-position-bottom-left {
  bottom: 20px;
  left: 20px;
}

.kp-frontend-switcher.kp-switcher-position-bottom-right {
  bottom: 20px;
  right: 20px;
}

.kp-frontend-switcher.kp-switcher-position-top-left {
  top: 20px;
  left: 20px;
}

.kp-frontend-switcher.kp-switcher-position-top-right {
  top: 20px;
  right: 20px;
}

/* Switcher button */
.kp-switcher-button {
  width: var(--kp-button-size);
  height: var(--kp-button-size);
  border-radius: 50%;
  border: none;
  background-color: var(--kp-button-bg);
  color: var(--kp-button-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform var(--kp-transition-speed) ease, box-shadow var(--kp-transition-speed) ease;
  padding: 0;
  position: relative;
  z-index: 1;
}

.kp-switcher-button:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.kp-switcher-button:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.kp-switcher-button[aria-expanded="true"] {
  transform: scale(1.1);
}

.kp-switcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.kp-switcher-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.kp-switcher-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Switcher panel */
.kp-switcher-panel {
  position: absolute;
  background-color: var(--kp-panel-bg);
  color: var(--kp-panel-text);
  border-radius: var(--kp-panel-border-radius);
  box-shadow: var(--kp-panel-shadow);
  width: var(--kp-panel-width);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.9);
  transition: max-height var(--kp-transition-speed) ease,
              opacity var(--kp-transition-speed) ease,
              transform var(--kp-transition-speed) ease;
  pointer-events: none;
}

.kp-switcher-panel[aria-hidden="false"] {
  max-height: 600px;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Panel positioning based on switcher position */
.kp-switcher-position-bottom-left .kp-switcher-panel,
.kp-switcher-position-top-left .kp-switcher-panel {
  bottom: calc(var(--kp-button-size) + 10px);
  left: 0;
}

.kp-switcher-position-bottom-right .kp-switcher-panel,
.kp-switcher-position-top-right .kp-switcher-panel {
  bottom: calc(var(--kp-button-size) + 10px);
  right: 0;
}

.kp-switcher-position-top-left .kp-switcher-panel,
.kp-switcher-position-top-right .kp-switcher-panel {
  bottom: auto;
  top: calc(var(--kp-button-size) + 10px);
}

/* Panel header */
.kp-switcher-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.kp-switcher-title {
  font-weight: 600;
  font-size: 16px;
  color: inherit;
}

/* Panel body */
.kp-switcher-panel-body {
  padding: 6px;
  max-height: 500px;
  overflow-y: auto;
}

/* Persona buttons */
.kp-switcher-persona-btn {
  width: 100%;
  padding: 10px 14px;
  margin: 2px 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background-color: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-family: inherit;
}

.kp-switcher-persona-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
}

.kp-switcher-persona-btn:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.kp-switcher-persona-btn.kp-switcher-active {
  background-color: rgba(0, 0, 0, 0.08);
  border-color: var(--persona-color, #0073aa);
  font-weight: 600;
}

.kp-switcher-persona-btn[style*="--persona-color"] {
  border-left: 3px solid var(--persona-color);
}

.kp-switcher-persona-title {
  flex: 1;
}

.kp-switcher-checkmark {
  margin-left: 8px;
  color: var(--persona-color, #0073aa);
  font-weight: bold;
}

/* Reset button */
.kp-switcher-reset-btn {
  width: 100%;
  padding: 10px 14px;
  margin-top: 6px;
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 6px;
  background-color: transparent;
  color: #dc3545;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
}

.kp-switcher-reset-btn:hover {
  background-color: #dc3545;
  color: #ffffff;
}

.kp-switcher-reset-btn:focus {
  outline: 2px solid #dc3545;
  outline-offset: 2px;
}

/* Expanded state */
.kp-frontend-switcher.kp-switcher-expanded .kp-switcher-button {
  background-color: var(--kp-button-bg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .kp-frontend-switcher {
    --kp-button-size: 48px;
    --kp-panel-width: calc(100vw - 40px);
    max-width: 320px;
  }

  .kp-frontend-switcher.kp-switcher-position-bottom-left,
  .kp-frontend-switcher.kp-switcher-position-bottom-right {
    bottom: 10px;
  }

  .kp-frontend-switcher.kp-switcher-position-top-left,
  .kp-frontend-switcher.kp-switcher-position-top-right {
    top: 10px;
  }

  .kp-frontend-switcher.kp-switcher-position-bottom-left,
  .kp-frontend-switcher.kp-switcher-position-top-left {
    left: 10px;
  }

  .kp-frontend-switcher.kp-switcher-position-bottom-right,
  .kp-frontend-switcher.kp-switcher-position-top-right {
    right: 10px;
  }
}

/* Print styles - hide switcher when printing */
@media print {
  .kp-frontend-switcher {
    display: none !important;
  }
}
