/* ========== Shared Character Left Panel (info card + portrait + settings) ========== */

.clp-panel {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.clp-panel .clp-expression-area,
.clp-panel .clp-settings-btn,
.clp-panel .clp-settings-modal,
.clp-panel .clp-interaction-area {
  display: none !important;
}

/* Info card */
.clp-info-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  padding: var(--card-padding);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.clp-info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.clp-info-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.clp-info-title {
  flex: 1;
  min-width: 0;
}

.clp-info-name {
  font-size: 17px;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-weight: 600;
}

.clp-settings-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.clp-settings-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: rotate(30deg);
}

/* Switch Character Button */
.clp-switch-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
  color: var(--text-light);
}

.clp-switch-btn:hover {
  background: rgba(77, 182, 232, 0.15);
  color: var(--primary);
  transform: rotate(180deg);
}

/* Switch Dropdown */
.clp-switch-wrap {
  position: relative;
}

.clp-switch-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 200px;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease;
  margin-top: 0;
}

.clp-switch-dropdown.visible {
  max-height: 400px;
  overflow-y: auto;
  opacity: 1;
  margin-top: 8px;
}

.clp-switch-list {
  padding: 6px;
}

.clp-switch-loading,
.clp-switch-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--text-light);
  font-size: 14px;
}

.clp-switch-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  width: 320px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  animation: clp-modalPop 0.25s ease-out;
  overflow: hidden;
}

.clp-switch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.clp-switch-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

.clp-switch-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.clp-switch-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.clp-switch-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.clp-switch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.clp-switch-item:hover {
  background: rgba(77, 182, 232, 0.08);
}

.clp-switch-item.active {
  background: rgba(77, 182, 232, 0.12);
}

.clp-switch-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(77, 182, 232, 0.2);
  flex-shrink: 0;
}

.clp-switch-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clp-switch-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clp-switch-current {
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
  flex-shrink: 0;
}

.clp-switch-loading,
.clp-switch-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-light);
  font-size: 16px;
}

.clp-interaction-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.clp-action-btn {
  flex: 1;
  min-width: 60px;
  padding: 8px 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.clp-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
}

.clp-expression-area {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  z-index: 5;
  flex-shrink: 0;
}

.clp-expression-area .clp-expr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.clp-expression-area .clp-expr-grid button {
  padding: 7px 6px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.clp-expression-area .clp-expr-grid button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px var(--primary-glow);
}

/* Portrait wrapper */
.clp-portrait-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Affection bar */
.clp-affection-bar {
  margin: 0;
  padding: 6px 8px;
  background: linear-gradient(135deg, rgba(77, 182, 232, 0.1), rgba(124, 158, 255, 0.08));
  border-radius: 10px;
}

.clp-affection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  font-size: 16px;
}

.clp-affection-header span:first-child {
  font-weight: 600;
  color: var(--text);
}

.clp-affection-level {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 16px;
}

.clp-affection-progress {
  height: 8px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.clp-affection-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.clp-affection-exp {
  text-align: center;
  font-size: 16px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Like row */
.clp-like-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 16px;
  color: var(--text-light);
}

.clp-likes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--primary-dark);
  transition: transform 0.15s;
  user-select: none;
}

.clp-likes[style*="cursor:pointer"]:hover {
  transform: scale(1.05);
  color: #e74c3c;
}

.clp-msg-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
}

.clp-fav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s;
  user-select: none;
}

.clp-fav:hover {
  transform: scale(1.1);
}

/* Settings Modal */
.clp-settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.clp-settings-modal.visible {
  display: flex;
}

.clp-settings-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: var(--card-padding);
  width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  animation: clp-modalPop 0.25s ease-out;
}

.clp-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.clp-settings-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

.clp-settings-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-light);
  transition: background 0.2s;
}

.clp-settings-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.clp-settings-section {
  margin-bottom: 16px;
}

.clp-settings-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.clp-settings-section-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--primary);
  border-radius: 2px;
}

.clp-expr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.clp-expr-grid button {
  padding: 7px 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.clp-expr-grid button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px var(--primary-glow);
}

@keyframes clp-modalPop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.clp-factor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 16px;
  color: var(--text);
}

.clp-factor-row label {
  flex-shrink: 0;
}

.clp-eye-track-factor {
  width: 70px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  text-align: center;
  transition: border-color 0.2s;
}

.clp-eye-track-factor:focus {
  outline: none;
  border-color: var(--primary);
}

/* Toggle switch */
.clp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  color: var(--text);
  padding: 6px 0;
}

.clp-toggle-switch {
  width: 38px;
  height: 20px;
  border-radius: 10px;
  background: #ddd;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.clp-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left 0.2s;
}

.clp-toggle-switch.on {
  background: var(--primary);
}

.clp-toggle-switch.on::after {
  left: 20px;
}
