/* ============================================================
   ISKRA COMPONENT STYLES
   ============================================================ */

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  font-family: var(--font-display);
  flex-shrink: 0;
  position: relative;
  user-select: none;
  overflow: hidden;
}

.avatar-xs  { width: 28px; height: 28px; font-size: 11px; }
.avatar-sm  { width: 36px; height: 36px; font-size: 14px; }
.avatar-md  { width: 48px; height: 48px; font-size: 19px; }
.avatar-lg  { width: 64px; height: 64px; font-size: 26px; }
.avatar-xl  { width: 88px; height: 88px; font-size: 36px; }
.avatar-2xl { width: 112px; height: 112px; font-size: 44px; }

/* Online status dot */
.avatar .status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  background: var(--status-offline);
}

.avatar .status-dot.online  { background: var(--status-online); }
.avatar .status-dot.away    { background: var(--status-away); }

/* Avatar sizes for status dot */
.avatar-sm  .status-dot { width: 10px; height: 10px; }
.avatar-md  .status-dot { width: 12px; height: 12px; }
.avatar-lg  .status-dot { width: 14px; height: 14px; }
.avatar-xl  .status-dot { width: 16px; height: 16px; border-width: 3px; }
.avatar-2xl .status-dot { width: 20px; height: 20px; border-width: 3px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  animation: fadeIn var(--duration-base) var(--ease-out) forwards;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

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

.modal-overlay.closing {
  animation: fadeOut var(--duration-base) var(--ease-in-out) forwards;
}

@keyframes fadeOut {
  to { opacity: 0; }
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  animation: modalIn var(--duration-slow) var(--ease-spring) forwards;
}

@keyframes modalIn {
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal.closing {
  animation: modalOut var(--duration-base) var(--ease-in-out) forwards;
}

@keyframes modalOut {
  to { transform: scale(0.92) translateY(16px); opacity: 0; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  font-family: var(--font-display);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--duration-fast);
}

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

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

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Bottom sheet on mobile */
@media (max-width: 480px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    max-height: 92vh;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ── Drawer / Side Sheet ─────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-drawer);
  display: flex;
  opacity: 0;
  animation: fadeIn var(--duration-base) var(--ease-out) forwards;
  backdrop-filter: blur(2px);
}

.drawer {
  margin-left: auto;
  width: min(480px, 100%);
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  animation: drawerIn var(--duration-slow) var(--ease-out) forwards;
  overflow: hidden;
}

@keyframes drawerIn {
  to { transform: translateX(0); }
}

.drawer.closing {
  animation: drawerOut var(--duration-base) var(--ease-in-out) forwards;
}

@keyframes drawerOut {
  to { transform: translateX(100%); }
}

.drawer-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  min-height: var(--header-h);
}

.drawer-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  font-family: var(--font-display);
  flex: 1;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
  align-items: center;
  pointer-events: none;
  width: 100%;
  max-width: 400px;
  padding: 0 var(--space-4);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  pointer-events: all;
  width: 100%;
  max-width: 360px;
  animation: toastIn var(--duration-slow) var(--ease-spring) forwards;
}

@keyframes toastIn {
  from { transform: translateY(20px) scale(0.9); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.toast.removing {
  animation: toastOut var(--duration-base) var(--ease-in-out) forwards;
}

@keyframes toastOut {
  to { transform: translateY(10px) scale(0.92); opacity: 0; }
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.toast.success .toast-icon { background: var(--success-muted); color: var(--success); }
.toast.error   .toast-icon { background: var(--danger-muted);  color: var(--danger); }
.toast.info    .toast-icon { background: var(--info-muted);    color: var(--info); }
.toast.warning .toast-icon { background: var(--accent-muted);  color: var(--accent); }

.toast-text { flex: 1; line-height: var(--leading-snug); }

.toast-dismiss {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.toast-dismiss:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Skeleton Loader ─────────────────────────────────────── */
.skeleton {
  background: var(--skeleton-base);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--skeleton-shimmer) 50%,
    transparent 100%
  );
  animation: shimmer 1.6s ease-in-out infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
}

.skeleton-circle { border-radius: 50%; }

/* ── Settings Panel ──────────────────────────────────────── */
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-3);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--duration-fast);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

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

.settings-nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.settings-nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  flex-shrink: 0;
}

.settings-section {
  padding: var(--space-4) var(--space-5);
}

.settings-section + .settings-section {
  border-top: 1px solid var(--border-subtle);
}

.settings-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-4);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

.settings-row + .settings-row {
  border-top: 1px solid var(--border-subtle);
}

.settings-row-info {
  flex: 1;
  min-width: 0;
}

.settings-row-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.settings-row-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
  line-height: var(--leading-relaxed);
}

/* ── Toggle Switch ───────────────────────────────────────── */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-soft);
  border-radius: var(--radius-full);
  transition: background var(--duration-base);
  cursor: pointer;
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-spring);
}

.toggle input:checked + .toggle-track::before {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Select ──────────────────────────────────────────────── */
.select-input {
  appearance: none;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--duration-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8fa8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
}

.select-input:focus {
  border-color: var(--accent);
  outline: none;
}

/* ── Color Swatch Picker ─────────────────────────────────── */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring);
  position: relative;
  border: 3px solid transparent;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); }

.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ── Profile View ────────────────────────────────────────── */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-6) var(--space-6);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}

.profile-hero-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  font-family: var(--font-display);
  text-align: center;
}

.profile-hero-username {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.profile-hero-bio {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
  line-height: var(--leading-relaxed);
  max-width: 280px;
}

.profile-hero-status {
  font-size: var(--text-xs);
  color: var(--status-online);
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-hero-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.profile-hero-status.offline { color: var(--text-muted); }
.profile-hero-status.offline::before { background: var(--text-muted); }

.profile-actions {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.profile-action-btn {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  transition: all var(--duration-fast);
  border: 1.5px solid var(--border-soft);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.profile-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.profile-action-btn.primary {
  background: var(--accent);
  color: #0a0b0f;
  border-color: transparent;
}

.profile-action-btn.primary:hover {
  opacity: 0.9;
}

.profile-action-btn.danger {
  color: var(--danger);
  border-color: rgba(239,68,68,0.2);
}

.profile-action-btn.danger:hover {
  background: var(--danger-muted);
}

.profile-action-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── User Search Result ──────────────────────────────────── */
.user-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background var(--duration-fast);
  border-bottom: 1px solid var(--border-subtle);
}

.user-result:hover { background: var(--bg-hover); }

.user-result-info {
  flex: 1;
  min-width: 0;
}

.user-result-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-result-username {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Blocked Users List ──────────────────────────────────── */
.blocked-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

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

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) 0;
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-accent { background: var(--accent-muted); color: var(--accent); }
.badge-success { background: var(--success-muted); color: var(--success); }
.badge-danger { background: var(--danger-muted); color: var(--danger); }

/* ── Emoji Avatar Picker ─────────────────────────────────── */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--space-1);
  max-height: 240px;
  overflow-y: auto;
}

.emoji-option {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  border: 2px solid transparent;
}

.emoji-option:hover { transform: scale(1.2); background: var(--bg-hover); }
.emoji-option.selected { border-color: var(--accent); background: var(--accent-muted); }

.gradient-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2);
}

.gradient-option {
  height: 40px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring);
  border: 2px solid transparent;
}

.gradient-option:hover { transform: scale(1.08); }
.gradient-option.selected { border-color: var(--text-primary); }

/* ── Loading Overlay ─────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(2px);
}

/* ── Confirm Dialog ──────────────────────────────────────── */
.confirm-dialog {
  text-align: center;
  padding: var(--space-2) 0;
}

.confirm-dialog p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin-top: var(--space-3);
}

.confirm-icon {
  font-size: 40px;
  margin-bottom: var(--space-3);
}
