/* ================================================================
   V43 — WHATSAPP SETTINGS IN-CHAT-AREA EXPERIENCE (PC & MOBILE)
   When Settings is selected in nav rail/sidebar:
   - Sidebar displays settings list (Trang cá nhân, Tài khoản, v.v.)
   - Chat Area displays the full interactive Setting Detail View
   ================================================================ */

/* --- 1. SETTINGS DETAIL VIEW CONTAINER IN CHAT AREA --- */
.wa-settings-detail-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--wa-bg-panel, #111b21);
  color: var(--wa-text-primary, #e9edef);
  z-index: 50;
  box-sizing: border-box;
  animation: waSettingsFadeIn 0.22s cubic-bezier(0.2, 0, 0, 1);
  overflow: hidden;
}

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

:root[data-theme="light"] .wa-settings-detail-view {
  background: #ffffff;
  color: #111b21;
}

/* Hide normal chat elements and welcome screen when in settings mode */
#chatMainContainer.in-settings-mode #waWelcomeScreen,
#chatMainContainer.in-settings-mode .chat-header,
#chatMainContainer.in-settings-mode #messageContainer,
#chatMainContainer.in-settings-mode .chat-input-zone,
#chatMainContainer.in-settings-mode .v35-chat-footer,
#chatMainContainer.in-settings-mode .chat-footer-wrapper,
#chatMainContainer.in-settings-mode .wa-expandable-search-bar,
#chatMainContainer.in-settings-mode #quoteSelectionBar,
#chatMainContainer.in-settings-mode #replyPreviewBar,
#chatMainContainer.in-settings-mode #imagePreviewContainer,
#chatMainContainer.in-settings-mode #attachmentPreviewContainer,
#chatMainContainer.in-settings-mode #composerLinkPreview,
#chatMainContainer.in-settings-mode .emoji-panel {
  display: none !important;
}

/* --- 2. SETTINGS DETAIL HEADER --- */
.wa-settings-detail-header {
  height: 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--wa-bg-header, #202c33);
  border-bottom: 1px solid var(--wa-border, rgba(134, 150, 160, 0.15));
  box-sizing: border-box;
  flex-shrink: 0;
  z-index: 2;
}

:root[data-theme="light"] .wa-settings-detail-header {
  background: #f0f2f5;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.wa-settings-back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--wa-text-secondary, #8696a0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.wa-settings-back-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--wa-text-primary, #e9edef);
}

:root[data-theme="light"] .wa-settings-back-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #111b21;
}

.wa-settings-detail-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.wa-settings-breadcrumb {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--wa-green, #00a884);
}

.wa-settings-detail-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--wa-text-primary, #e9edef);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root[data-theme="light"] .wa-settings-detail-title {
  color: #111b21;
}

/* --- 3. SETTINGS DETAIL BODY --- */
.wa-settings-detail-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px 60px;
  box-sizing: border-box;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 768px) {
  .wa-settings-detail-view {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100% !important;
    z-index: 99999 !important;
  }
  .wa-settings-detail-body {
    padding: 16px 16px 80px;
  }
}

/* --- 4. CARDS & SECTIONS --- */
.wa-sd-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.wa-sd-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--wa-green, #00a884);
  padding-left: 4px;
}

.wa-sd-card {
  background: var(--wa-bg-header, #202c33);
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.12));
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .wa-sd-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.wa-sd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 16px;
  border-bottom: 1px solid var(--wa-border, rgba(134, 150, 160, 0.1));
  transition: background 0.15s ease;
}

.wa-sd-row:last-child {
  border-bottom: none;
}

.wa-sd-row.clickable {
  cursor: pointer;
}

.wa-sd-row.clickable:hover {
  background: rgba(255, 255, 255, 0.04);
}

:root[data-theme="light"] .wa-sd-row.clickable:hover {
  background: rgba(0, 0, 0, 0.03);
}

.wa-sd-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.wa-sd-row-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--wa-text-primary, #e9edef);
}

:root[data-theme="light"] .wa-sd-row-title {
  color: #111b21;
}

.wa-sd-row-desc {
  font-size: 12.5px;
  color: var(--wa-text-secondary, #8696a0);
  line-height: 1.4;
}

.wa-sd-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(0, 168, 132, 0.15);
  color: var(--wa-green, #00a884);
  font-weight: 600;
  white-space: nowrap;
}

/* --- 5. PROFILE SECTION SPECIFICS --- */
.wa-sd-profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 20px;
  text-align: center;
}

.wa-sd-avatar-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 18px;
  cursor: pointer;
}

.wa-sd-avatar-lg {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #005c4b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  font-weight: 700;
  color: #ffffff;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
  overflow: hidden;
}

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

.wa-sd-avatar-wrap:hover .wa-sd-avatar-lg {
  transform: scale(1.02);
}

.wa-sd-avatar-camera-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wa-green, #00a884);
  color: #111b21;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  border: 3px solid var(--wa-bg-panel, #111b21);
  transition: all 0.2s ease;
}

.wa-sd-avatar-wrap:hover .wa-sd-avatar-camera-btn {
  transform: scale(1.1);
  background: #06cf9c;
}

.wa-sd-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--wa-bg-input, #2a3942);
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.2));
  border-radius: 10px;
  padding: 8px 14px;
  margin-top: 6px;
  transition: border-color 0.2s ease;
}

:root[data-theme="light"] .wa-sd-input-group {
  background: #f0f2f5;
  border-color: rgba(0, 0, 0, 0.1);
}

.wa-sd-input-group:focus-within {
  border-color: var(--wa-green, #00a884);
}

.wa-sd-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 15px;
  color: var(--wa-text-primary, #e9edef);
}

:root[data-theme="light"] .wa-sd-input {
  color: #111b21;
}

.wa-sd-btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wa-sd-btn-primary {
  background: var(--wa-green, #00a884);
  color: #111b21;
}

.wa-sd-btn-primary:hover {
  background: #06cf9c;
}

.wa-sd-btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.wa-sd-btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
}

/* --- 6. SWITCH TOGGLE (WHATSAPP GREEN) --- */
.wa-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.wa-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.wa-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(134, 150, 160, 0.3);
  transition: .24s;
  border-radius: 24px;
}

.wa-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .24s cubic-bezier(0.2, 0, 0, 1);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.wa-switch input:checked + .wa-slider {
  background-color: var(--wa-green, #00a884);
}

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

/* --- 7. WALLPAPER COLOR CHIPS --- */
.wa-wallpaper-chips {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.wa-wp-chip {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.wa-wp-chip:hover {
  transform: scale(1.1);
}

.wa-wp-chip.active {
  border-color: var(--wa-green, #00a884);
  transform: scale(1.08);
}

/* --- 8. KEYBOARD SHORTCUTS TABLE --- */
.wa-shortcut-table {
  width: 100%;
  border-collapse: collapse;
}

.wa-shortcut-table tr {
  border-bottom: 1px solid var(--wa-border, rgba(134, 150, 160, 0.1));
}

.wa-shortcut-table tr:last-child {
  border-bottom: none;
}

.wa-shortcut-table td {
  padding: 12px 16px;
  font-size: 14px;
}

.wa-shortcut-table td:last-child {
  text-align: right;
}

.wa-shortcut-table kbd {
  display: inline-block;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--wa-text-primary, #e9edef);
  background: var(--wa-bg-input, #2a3942);
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.25));
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .wa-shortcut-table kbd {
  background: #e9edef;
  color: #111b21;
}

/* Sidebar Item Active Highlight */
.wa-setting-item.active {
  background: rgba(0, 168, 132, 0.16) !important;
}

.wa-setting-item.active .wa-setting-icon {
  color: var(--wa-green, #00a884) !important;
}

.wa-setting-item.active .wa-setting-title {
  color: var(--wa-green, #00a884) !important;
  font-weight: 600 !important;
}
