/* ═══════════ DESIGN SYSTEM & VARIABLES ═══════════ */
:root {
  /* Common variables */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --accent-glow: 0 0 15px rgba(0, 242, 254, 0.3);

  /* Default Theme: Dark */
  --bg-primary: hsl(224, 25%, 12%);
  --bg-secondary: hsl(224, 25%, 16%);
  --bg-tertiary: hsl(224, 25%, 20%);
  --bg-card: hsl(224, 25%, 16%);
  --modal-overlay-bg: rgba(12, 16, 26, 0.75);
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 75%);
  --text-muted: hsl(215, 15%, 50%);
  --accent: hsl(180, 100%, 45%);
  --accent-hover: hsl(180, 100%, 38%);
  --accent-rgb: 0, 242, 254;
  --border: hsl(224, 20%, 24%);
  
  --glass-bg: rgba(22, 28, 45, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --input-bg: hsl(224, 20%, 10%);
  
  --color-success: hsl(145, 80%, 45%);
  --color-danger: hsl(355, 85%, 55%);
  --color-warning: hsl(40, 95%, 50%);
}

/* Light Theme Variables Override */
.theme-light, 
#app.theme-light {
  --bg-primary: hsl(210, 40%, 98%);
  --bg-secondary: hsl(0, 0%, 100%);
  --bg-tertiary: hsl(210, 30%, 94%);
  --bg-card: hsl(0, 0%, 100%);
  --modal-overlay-bg: rgba(0, 0, 0, 0.45);
  --text-primary: hsl(224, 25%, 12%);
  --text-secondary: hsl(224, 15%, 35%);
  --text-muted: hsl(224, 10%, 55%);
  --accent: hsl(182, 100%, 33%);
  --accent-hover: hsl(182, 100%, 26%);
  --accent-rgb: 0, 168, 181;
  --border: hsl(210, 20%, 88%);
  
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
  --input-bg: hsl(210, 20%, 95%);
  
  --accent-glow: 0 0 15px rgba(0, 168, 181, 0.2);
}

/* Explicit Dark Theme Wrapper (if set via select) */
.theme-dark,
#app.theme-dark {
  --bg-primary: hsl(224, 25%, 12%);
  --bg-secondary: hsl(224, 25%, 16%);
  --bg-tertiary: hsl(224, 25%, 20%);
  --bg-card: hsl(224, 25%, 16%);
  --modal-overlay-bg: rgba(12, 16, 26, 0.75);
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 75%);
  --text-muted: hsl(215, 15%, 50%);
  --accent: hsl(180, 100%, 45%);
  --accent-hover: hsl(180, 100%, 38%);
  --accent-rgb: 0, 242, 254;
  --border: hsl(224, 20%, 24%);
  
  --glass-bg: rgba(22, 28, 45, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --input-bg: hsl(224, 20%, 10%);
}

/* System Preference Theme */
@media (prefers-color-scheme: light) {
  .theme-system,
  #app.theme-system {
    --bg-primary: hsl(210, 40%, 98%);
    --bg-secondary: hsl(0, 0%, 100%);
    --bg-tertiary: hsl(210, 30%, 94%);
    --text-primary: hsl(224, 25%, 12%);
    --text-secondary: hsl(224, 15%, 35%);
    --text-muted: hsl(224, 10%, 55%);
    --accent: hsl(182, 100%, 33%);
    --accent-hover: hsl(182, 100%, 26%);
    --accent-rgb: 0, 168, 181;
    --border: hsl(210, 20%, 88%);
    
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.06);
    --card-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
    --input-bg: hsl(210, 20%, 95%);
    
    --accent-glow: 0 0 15px rgba(0, 168, 181, 0.2);
  }
}

/* ═══════════ GLOBAL RESETS ═══════════ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ═══════════ SCROLLBAR STYLING ═══════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ═══════════ TYPOGRAPHY ═══════════ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ═══════════ BUTTONS ═══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  box-shadow: var(--accent-glow);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-primary svg {
  stroke: hsl(224, 25%, 12%);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
}
.btn-danger:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
  display: flex;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ═══════════ FORM CONTROLS ═══════════ */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  transition: var(--transition);
}
.input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
}

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.input-prefix {
  position: absolute;
  left: 16px;
  color: var(--accent);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 18px;
  pointer-events: none;
}

#usernameInput {
  padding-left: 36px;
}

.form-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-select, .form-control {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition);
}
.form-select:focus, .form-control:focus {
  border-color: var(--accent);
}

/* Margin utilities */
.margin-top-xs { margin-top: 8px; }

/* ═══════════ SCREENS & SLIDES ═══════════ */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 10;
  background-color: var(--bg-primary);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.screen.active {
  display: block;
  opacity: 1;
  z-index: 20;
}

/* ═══════════ ONBOARDING (AUTH & USERNAME) ═══════════ */
.auth-blur-bg {
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.15) 0%, rgba(var(--accent-rgb), 0) 70%);
  top: -15%;
  left: -15%;
  pointer-events: none;
  animation: float 20s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(50px) scale(1.1); }
}

.auth-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 440px;
  padding: 40px;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  z-index: 30;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon-wrapper {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  margin-bottom: 16px;
  box-shadow: var(--accent-glow);
}

.logo-icon {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
}

.auth-header h1 {
  font-size: 32px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-muted);
}

.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  margin-bottom: 16px;
  transition: var(--transition);
}
.auth-back-btn:hover {
  transform: translateX(-2px);
}
.auth-back-btn svg {
  width: 14px;
  height: 14px;
}

.auth-footer {
  text-align: center;
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-footer svg {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ═══════════ MAIN DASHBOARD LAYOUT ═══════════ */
.dashboard-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  width: 380px;
  height: 100%;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  transition: var(--transition);
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-wrapper {
  position: relative;
}

.user-avatar, .chat-avatar, .call-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, hsl(190, 100%, 40%) 100%);
  color: hsl(224, 25%, 12%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.user-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}
.user-status-dot.online {
  background-color: var(--color-success);
}
.user-status-dot.offline {
  background-color: var(--text-muted);
}

.user-info h4 {
  font-size: 15px;
  color: var(--text-primary);
}
.user-info p {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.header-actions {
  display: flex;
  gap: 4px;
}

/* Sidebar Search Box */
.sidebar-search {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper input {
  width: 100%;
  padding: 10px 44px 10px 38px;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition);
}
.search-input-wrapper input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-btn {
  position: absolute;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.search-btn:hover {
  filter: brightness(0.9);
}
.search-btn svg {
  width: 16px;
  height: 16px;
  stroke: hsl(224, 25%, 12%);
}

/* Search Dropdown Panel */
.search-results-dropdown {
  position: absolute;
  top: calc(100% - 6px);
  left: 20px;
  right: 20px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}
.search-results-dropdown.active {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background-color: var(--bg-secondary);
}
.search-result-item h5 {
  font-size: 14px;
  color: var(--text-primary);
}
.search-result-item p {
  font-size: 11px;
  color: var(--text-muted);
}
.search-result-item .add-btn {
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}

/* Chat List Panel */
.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-list-empty {
  padding: 60px 40px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.chat-list-empty p {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.chat-list-empty span {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-list-item {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.chat-list-item:hover {
  background-color: var(--bg-tertiary);
}
.chat-list-item.active {
  background-color: rgba(var(--accent-rgb), 0.08);
  border-left: 3px solid var(--accent);
}

.chat-item-avatar-wrapper {
  position: relative;
}

.chat-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 16px;
}
.chat-list-item.active .chat-item-avatar {
  background: linear-gradient(135deg, var(--accent) 0%, hsl(190, 100%, 40%) 100%);
  color: hsl(224, 25%, 12%);
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chat-item-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-time {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-item-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chat-item-lastmsg {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-list-item.active .chat-item-lastmsg {
  color: var(--text-primary);
}

.chat-item-badge {
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ═══════════ MAIN WINDOW ═══════════ */
.chat-window {
  flex: 1;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Chat Pane Empty State */
.chat-pane-empty {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background-color: var(--bg-primary);
}
.chat-pane-empty.active {
  display: flex;
}

.empty-illustration {
  text-align: center;
  max-width: 480px;
  padding: 40px;
}

.shield-halo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.05);
  border: 1px solid rgba(var(--accent-rgb), 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.empty-shield {
  width: 48px;
  height: 48px;
  stroke: var(--accent);
}

.empty-illustration h2 {
  font-size: 26px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.empty-illustration p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.security-badges {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.security-badges span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}
.security-badges span svg {
  width: 12px;
  height: 12px;
  stroke: var(--accent);
}

/* Active Conversation Pane Layout */
.chat-pane {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-header {
  height: 80px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-secondary);
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.back-btn {
  display: none; /* Responsive */
}

.chat-title-info {
  min-width: 0;
}

.chat-title-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-online {
  color: var(--color-success);
  font-weight: 600;
}
.status-offline {
  color: var(--text-muted);
}

.typing-text {
  color: var(--accent);
  font-weight: 600;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.call-btn {
  background-color: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}
.call-btn:hover {
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  box-shadow: var(--accent-glow);
}

/* Message History Scroll Area */
.message-history {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message-wrapper.outgoing {
  align-self: flex-end;
  align-items: flex-end;
}

.message-wrapper.incoming {
  align-self: flex-start;
  align-items: flex-start;
}

.message-bubble {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}

.message-wrapper.outgoing .message-bubble {
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  border-bottom-right-radius: 4px;
}

.message-wrapper.incoming .message-bubble {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* Media/Shared File inside Message Bubble */
.message-media {
  margin-bottom: 8px;
  max-width: 100%;
}

.message-media img {
  max-width: 100%;
  max-height: 250px;
  border-radius: var(--radius-sm);
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.message-media img:hover {
  opacity: 0.9;
}

.message-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

.message-wrapper.incoming .message-file-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.file-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: rgba(var(--accent-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-icon-wrapper svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
}

.file-info {
  flex: 1;
  min-width: 0;
}
.file-info h5 {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info p {
  font-size: 11px;
  opacity: 0.7;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
}

.message-wrapper.outgoing .message-meta {
  color: var(--text-muted);
}
.message-wrapper.incoming .message-meta {
  color: var(--text-muted);
}

/* E2EE Tag inside Chat Bubble */
.e2ee-tag {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.7;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Checkmarks (Sent / Delivered / Read Status Ticks) */
.tick-wrapper {
  display: inline-flex;
  align-items: center;
}

.tick-wrapper svg {
  width: 13px;
  height: 13px;
  stroke: var(--text-muted);
  transition: stroke 0.2s ease;
}

.tick-wrapper.pending svg {
  stroke: var(--text-muted);
  opacity: 0.6;
}

.tick-wrapper.sent svg {
  stroke: var(--text-muted);
}

.tick-wrapper.delivered svg {
  stroke: var(--text-secondary);
}

.tick-wrapper.read svg {
  stroke: #38BDF8 !important; /* Electric Blue Read Status */
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.4));
}

/* High-contrast checkmarks inside Outgoing Accent Message Bubbles */
.message-wrapper.outgoing .tick-wrapper svg {
  stroke: rgba(15, 23, 42, 0.55);
}

.message-wrapper.outgoing .tick-wrapper.sent svg {
  stroke: rgba(15, 23, 42, 0.7);
}

.message-wrapper.outgoing .tick-wrapper.delivered svg {
  stroke: rgba(15, 23, 42, 0.85);
}

.message-wrapper.outgoing .tick-wrapper.read svg {
  stroke: #1D4ED8 !important; /* Deep Cobalt Blue Read Status on Teal Accent */
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.7));
}

/* Light Mode Overrides for Outgoing Checkmarks */
.theme-light .message-wrapper.outgoing .tick-wrapper.read svg {
  stroke: #0284C7 !important;
}

/* Input Bar Layout */
.chat-input-bar {
  padding: 16px 24px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat-attachment-wrapper {
  position: relative;
}

.attach-btn {
  background-color: var(--bg-tertiary);
}

.text-input-wrapper {
  flex: 1;
  position: relative;
}

.text-input-wrapper textarea {
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 12px 16px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.text-input-wrapper textarea:focus {
  border-color: var(--accent);
}

.send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  transition: var(--transition);
  flex-shrink: 0;
}
.send-btn:hover {
  background-color: var(--accent-hover);
  transform: scale(1.05);
}
.send-btn svg {
  width: 18px;
  height: 18px;
  stroke: hsl(224, 25%, 12%);
}

/* ═══════════ MODALS ═══════════ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-overlay-bg);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  width: 100%;
  max-width: 600px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-modal-btn {
  width: 36px;
  height: 36px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Settings Sections */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section h3 {
  font-size: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.settings-section h3 svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
}

.section-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Storage usage visual card */
.storage-usage-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.storage-breakdown {
  margin-bottom: 16px;
}

.storage-bar {
  width: 100%;
  height: 10px;
  background-color: var(--border);
  border-radius: 5px;
  display: flex;
  overflow: hidden;
  margin-bottom: 10px;
}

.storage-fill {
  height: 100%;
}
.storage-fill.text-fill {
  background-color: var(--accent);
}
.storage-fill.media-fill {
  background: linear-gradient(90deg, hsl(190, 100%, 45%), hsl(220, 100%, 55%));
}

.storage-labels {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.storage-labels .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.storage-labels .text-dot { background-color: var(--accent); }
.storage-labels .media-dot { background-color: hsl(190, 100%, 45%); }

.storage-actions {
  display: flex;
  gap: 10px;
}

.btn-danger.btn-sm {
  background-color: rgba(255, 68, 68, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(255, 68, 68, 0.2);
}
.btn-danger.btn-sm:hover {
  background-color: var(--color-danger);
  color: #fff;
}

/* Backup Config Panels */
.backup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.backup-action-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backup-action-card h4 {
  font-size: 14px;
  color: var(--text-primary);
}

.backup-action-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.backup-status {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Danger Zone Settings */
.danger-zone {
  border: 1px dashed rgba(255, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  background-color: rgba(255, 68, 68, 0.02);
}
.danger-zone h3 {
  border-bottom: none;
  padding-bottom: 0;
}
.danger-zone h3 svg {
  stroke: var(--color-danger);
}

.danger-zone-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.danger-zone-actions button {
  flex: 1;
  padding: 10px 14px;
  white-space: nowrap;
}

/* Conflict resolution modal overlay inner card */
.conflict-resolver {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: none;
  flex-direction: column;
  justify-content: center;
  z-index: 200;
}
.conflict-resolver.active {
  display: flex;
}
.conflict-resolver h3 {
  color: var(--color-warning);
  font-size: 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.conflict-resolver p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.4;
}

.device-replace-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.device-replace-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.device-replace-item:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent);
}
.device-replace-item h5 {
  font-size: 13.5px;
  color: var(--text-primary);
}
.device-replace-item span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════ CALL SIGNALLING OVERLAY ═══════════ */
.call-overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(12, 16, 26, 0.95);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.call-overlay-container.active {
  display: flex;
  opacity: 1;
}

.call-overlay-card {
  text-align: center;
  padding: 40px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.call-avatar {
  width: 100px;
  height: 100px;
  font-size: 36px;
  margin-bottom: 12px;
  box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.2);
}

.call-overlay-card h2 {
  font-size: 24px;
}

.call-overlay-card p {
  color: var(--text-secondary);
  font-size: 14px;
}

.call-actions {
  display: flex;
  gap: 20px;
  margin-top: 24px;
}

.btn-call-action {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-call-action svg {
  width: 24px;
  height: 24px;
  stroke: #ffffff;
}
.btn-call-action:hover {
  transform: scale(1.1);
}

.btn-accept {
  background-color: var(--color-success);
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
}
.btn-decline {
  background-color: var(--color-danger);
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}
.btn-mute {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.btn-mute.active {
  background-color: var(--color-warning);
  box-shadow: 0 0 15px rgba(243, 156, 18, 0.4);
}
.btn-hangup {
  background-color: var(--color-danger);
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

/* Display rules for call actions based on states (Incoming, Outgoing, Active) */
.call-overlay-container.incoming .btn-accept { display: flex; }
.call-overlay-container.incoming .btn-decline { display: flex; }
.call-overlay-container.incoming .btn-mute { display: none; }
.call-overlay-container.incoming .btn-hangup { display: none; }

.call-overlay-container.outgoing .btn-accept { display: none; }
.call-overlay-container.outgoing .btn-decline { display: none; }
.call-overlay-container.outgoing .btn-mute { display: none; }
.call-overlay-container.outgoing .btn-hangup { display: flex; }

.call-overlay-container.active-call .btn-accept { display: none; }
.call-overlay-container.active-call .btn-decline { display: none; }
.call-overlay-container.active-call .btn-mute { display: flex; }
.call-overlay-container.active-call .btn-hangup { display: flex; }

/* ═══════════ PULSE ANIMATIONS ═══════════ */
.animate-pulse {
  animation: pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(0.96); }
}

/* Responsive UI Breakpoints */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: absolute;
    height: 100%;
    left: 0;
    top: 0;
    transform: translateX(0);
  }
  .sidebar.inactive {
    transform: translateX(-100%);
  }

  .chat-window {
    width: 100%;
    position: absolute;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 60;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  .chat-window.active {
    transform: translateX(0);
  }

  .back-btn {
    display: inline-flex;
  }
}

/* ═══════════ PER-CHAT STORAGE EXPLORER STYLING ═══════════ */
.storage-chats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.storage-chat-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.storage-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.storage-chat-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.storage-chat-user h5 {
  font-size: 13.5px;
  color: var(--text-primary);
}

.storage-chat-user span {
  font-size: 11px;
  color: var(--text-muted);
}

.storage-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.storage-media-list {
  display: none;
  flex-direction: column;
  gap: 6px;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 4px;
}

.storage-media-list.active {
  display: flex;
}

.storage-media-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.storage-media-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.storage-media-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 75%;
}

.storage-media-item-name {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.storage-media-item-size {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-delete-file {
  background: transparent;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-delete-file:hover {
  background-color: rgba(255, 68, 68, 0.15);
}

/* ═══════════ SIDEBAR VIEWS & TAB SWITCHING ═══════════ */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.sidebar-views-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.sidebar-tab-view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-tab-view.active {
  display: flex;
}

/* SIDEBAR BOTTOM NAV TABS */
.sidebar-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 6px 8px;
  min-height: 56px;
  z-index: 10;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

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

.nav-tab.active {
  color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.1);
}

.nav-tab-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-tab i {
  width: 20px;
  height: 20px;
}

.nav-tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background-color: var(--accent);
  color: hsl(224, 25%, 12%);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 1.2;
}

.requests-nav-badge {
  background-color: #ffaa00;
  color: #000000;
}

/* ═══════════ REQUESTS VIEW (100+ SCALABLE) ═══════════ */
.requests-view-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-secondary);
}

.requests-view-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.requests-view-title h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.requests-view-title i {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
}

.requests-badge {
  background-color: #ffaa00;
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

.requests-filter-wrapper {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-primary);
  position: relative;
  display: flex;
  align-items: center;
}

.requests-filter-wrapper i {
  position: absolute;
  left: 26px;
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
}

.requests-filter-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  transition: var(--transition);
}

.requests-filter-wrapper input:focus {
  border-color: var(--accent);
}

.requests-list-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.request-item:hover {
  background-color: var(--hover-bg);
}

.request-item.active {
  background-color: var(--active-bg);
  border-left: 3px solid var(--accent);
}

.request-item-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.request-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.request-user-info h5 {
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 600;
}

.request-user-info p {
  font-size: 11.5px;
  color: var(--text-muted);
}

.request-tag {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: rgba(255, 170, 0, 0.15);
  color: #ffaa00;
  font-weight: 600;
}

.pending-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: rgba(255, 170, 0, 0.15);
  color: #ffaa00;
  font-weight: 600;
  margin-left: 6px;
}

/* Request Action Banner in Chat Pane */
.request-action-banner {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.request-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.request-banner-icon {
  width: 24px;
  height: 24px;
  stroke: var(--accent);
}

.request-banner-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.request-banner-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.request-banner-actions {
  display: flex;
  gap: 10px;
}

.request-notice-bar {
  background-color: rgba(255, 170, 0, 0.1);
  border-top: 1px solid rgba(255, 170, 0, 0.2);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffaa00;
  font-size: 12.5px;
  font-weight: 500;
}

.request-notice-bar i {
  width: 16px;
  height: 16px;
  stroke: #ffaa00;
}

.chat-input-bar.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ═══════════ FLOATING TOAST NOTIFICATIONS ═══════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - 40px);
}

.toast-notification {
  pointer-events: auto;
  background: var(--bg-secondary);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  animation: toastSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-15px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-notification.success {
  border-left: 4px solid var(--color-success);
}

.toast-notification.error {
  border-left: 4px solid var(--color-danger);
}

.toast-notification.info {
  border-left: 4px solid var(--accent);
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast-notification.success .toast-icon { stroke: var(--color-success); }
.toast-notification.error .toast-icon { stroke: var(--color-danger); }
.toast-notification.info .toast-icon { stroke: var(--accent); }

/* ═══════════ CUSTOM CONFIRMATION MODAL ═══════════ */
.confirm-modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--card-shadow);
  animation: modalScaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.confirm-modal-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: rgba(255, 170, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}

.confirm-modal-icon-wrapper i {
  width: 26px;
  height: 26px;
  stroke: #ffaa00;
}

.confirm-modal-icon-wrapper.danger {
  background-color: rgba(255, 68, 68, 0.15);
}

.confirm-modal-icon-wrapper.danger i {
  stroke: var(--color-danger);
}

.confirm-modal-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-modal-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
}

.confirm-modal-actions button {
  flex: 1;
}

.confirm-modal-actions .btn-outline {
  border-color: var(--border);
  color: var(--text-primary);
}

.confirm-modal-actions .btn-outline:hover {
  background-color: var(--hover-bg);
}

/* ═══════════ MOBILE VIEW OPTIMIZATIONS ═══════════ */
@media (max-width: 640px) {
  .request-action-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  
  .request-banner-info {
    width: 100%;
  }

  .request-banner-actions {
    width: 100%;
    display: flex;
    gap: 10px;
  }

  .request-banner-actions button {
    flex: 1;
    justify-content: center;
  }

  .backup-grid {
    grid-template-columns: 1fr;
  }

  .storage-actions {
    flex-direction: column;
  }

  .storage-actions button {
    width: 100%;
  }

  .danger-zone-actions {
    flex-direction: column;
  }

  .danger-zone-actions button {
    width: 100%;
  }
}

/* ═══════════ MULTI-SELECT & BULK ACTIONS ═══════════ */
.selection-action-bar {
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
}

.selection-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  transition: var(--transition);
}

.custom-checkbox i {
  width: 12px;
  height: 12px;
  stroke: #ffffff;
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition);
}

.chat-item.selected,
.request-item.selected {
  background-color: rgba(var(--accent-rgb), 0.12);
  border-left: 3px solid var(--accent);
}

.chat-item.selected .custom-checkbox,
.request-item.selected .custom-checkbox {
  background-color: var(--accent);
  border-color: var(--accent);
}

.chat-item.selected .custom-checkbox i,
.request-item.selected .custom-checkbox i {
  opacity: 1;
  transform: scale(1);
}

.chat-item, .request-item {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ═══════════ NARROW MOBILE DEVICE RESPONSIVENESS (320px - 480px) ═══════════ */
@media (max-width: 480px) {
  .chat-header {
    padding: 10px 12px;
  }
  
  .chat-header-user {
    gap: 8px;
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .chat-title-info h3 {
    font-size: 14.5px;
    max-width: 150px;
  }

  .chat-subtitle {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .call-btn {
    width: 36px;
    height: 36px;
  }

  .chat-input-bar {
    padding: 8px 10px;
    gap: 8px;
  }

  .attach-btn {
    width: 36px;
    height: 36px;
  }

  .send-btn {
    width: 38px;
    height: 38px;
  }

  .send-btn svg {
    width: 16px;
    height: 16px;
  }

  .text-input-wrapper textarea {
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.3;
  }

  .text-input-wrapper textarea::placeholder {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-input-bar.disabled textarea {
    height: 38px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .user-avatar-wrapper .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .user-info h4 {
    font-size: 13px;
  }

  .user-info p {
    font-size: 10.5px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .selection-action-bar {
    padding: 8px 10px;
    gap: 6px;
  }

  .selection-info {
    gap: 6px;
    font-size: 12px;
  }

  .selection-actions {
    gap: 4px;
  }

  .selection-actions .btn-xs {
    padding: 4px 6px;
    font-size: 10.5px;
  }

  .requests-view-header {
    padding: 10px 12px;
  }

  .requests-view-title h4 {
    font-size: 13px;
  }

  .request-item {
    padding: 10px 12px;
  }

  .request-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .request-user-info h5 {
    font-size: 12.5px;
  }

  .request-user-info p {
    font-size: 11px;
    max-width: 110px;
  }
}

/* ═══════════ ULTRA-NARROW MOBILE SCREENS (<= 360px) ═══════════ */
@media (max-width: 360px) {
  .selection-action-bar {
    padding: 6px 8px;
    gap: 4px;
  }

  .selection-info {
    gap: 4px;
    font-size: 11px;
  }

  .selection-info .icon-btn {
    width: 24px;
    height: 24px;
  }

  .selection-actions {
    gap: 3px;
  }

  .selection-actions .btn-xs {
    padding: 4px 6px;
    font-size: 10px;
  }

  .selection-actions .btn-text {
    display: none;
  }
}

