/* ── Reset & variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #6C63FF;
  --primary-dark:  #574FD6;
  --surface:       #FFFFFF;
  --surface-2:     #F4F4F8;
  --surface-3:     #EEEEF5;
  --border:        #E0E0EA;
  --text:          #1A1A2E;
  --text-2:        #6B6B80;
  --text-3:        #9999AA;
  --sent-bg:       #6C63FF;
  --sent-text:     #FFFFFF;
  --recv-bg:       #EEEEF5;
  --recv-text:     #1A1A2E;
  --online:        #22C55E;
  --danger:        #EF4444;
  --radius:        14px;
  --sidebar-w:     300px;
  --header-h:      64px;
  --input-h:       68px;
  --shadow:        0 4px 24px rgba(108,99,255,.12);
}

html, body { height: 100%; font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; color: var(--text); background: var(--surface-2); }

/* ══════════════════════════════════════════════════════════════
   AUTH PAGE — Music theme
══════════════════════════════════════════════════════════════ */
body.auth-page {
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  background: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Grid de álbumes de fondo */
.albums-bg {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  z-index: 0;
  transform: rotate(-4deg) scale(1.12);
  transform-origin: center;
}
.album-tile {
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  transition: transform .6s;
}
.album-tile[data-ring]::after {
  content: '';
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  border: 8px solid rgba(255,255,255,.15);
}
.album-tile[data-ring]::before {
  content: '';
  position: absolute;
  inset: 40%;
  border-radius: 50%;
  background: rgba(0,0,0,.35);
}

/* Overlay oscuro sobre los álbumes */
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    135deg,
    rgba(10,10,15,.92) 0%,
    rgba(20,10,40,.88) 50%,
    rgba(10,10,15,.92) 100%
  );
  backdrop-filter: blur(2px);
}

/* Notas flotantes */
.notes-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.note {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0;
  animation: floatNote 8s ease-in-out infinite;
  color: rgba(255,255,255,.18);
}
.n1 { left:  8%; animation-delay: 0s;    font-size: 1.8rem; }
.n2 { left: 22%; animation-delay: 1.2s;  }
.n3 { left: 40%; animation-delay: 2.5s;  font-size: 1rem;  }
.n4 { left: 58%; animation-delay: 0.8s;  font-size: 2rem;  }
.n5 { left: 75%; animation-delay: 3.1s;  }
.n6 { left: 90%; animation-delay: 1.8s;  font-size: 1.2rem; }

@keyframes floatNote {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: .3; }
  90%  { opacity: .15; }
  100% { transform: translateY(-10vh) rotate(20deg);  opacity: 0; }
}

/* Wrapper central */
.auth-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 64px;
  padding: 32px 24px;
  width: 100%;
  max-width: 900px;
}

/* ── Branding izquierdo ─────────────────────────────────────── */
.auth-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  color: #fff;
}

/* Vinilo */
.vinyl-wrap {
  position: relative;
  width: 200px;
  height: 200px;
}
.vinyl {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    #1a1a2e 30%,
    #16213e 31%,
    #16213e 34%,
    #0f1117 35%,
    #0f1117 38%,
    #1a1a2e 39%,
    #1a1a2e 42%,
    #0f1117 43%,
    #0f1117 47%,
    #1a1a2e 48%,
    #1a1a2e 51%,
    #0f1117 52%,
    #0f1117 100%
  );
  box-shadow:
    0 0 0 3px rgba(255,255,255,.05),
    0 20px 60px rgba(0,0,0,.8),
    0 0 40px rgba(108,99,255,.3);
  animation: spin 4s linear infinite;
  position: relative;
}
.vinyl-label {
  position: absolute;
  inset: 35%;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C63FF, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(108,99,255,.6);
}
.vinyl-label span {
  font-weight: 800;
  font-size: .75rem;
  letter-spacing: .15em;
  color: #fff;
}
.vinyl-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
}
.vinyl-shadow {
  position: absolute;
  bottom: -12px;
  left: 10%;
  width: 80%;
  height: 20px;
  background: rgba(0,0,0,.5);
  border-radius: 50%;
  filter: blur(10px);
  animation: spin 4s linear infinite;
}

/* Brazo del tocadiscos */
.vinyl-arm {
  position: absolute;
  top: -10px;
  right: -20px;
  width: 4px;
  height: 90px;
  background: linear-gradient(to bottom, #888, #555);
  border-radius: 2px;
  transform-origin: top center;
  transform: rotate(28deg);
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.vinyl-arm::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) rotate(-28deg);
  width: 10px;
  height: 4px;
  background: #aaa;
  border-radius: 2px;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Ecualizador */
.eq {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 36px;
}
.bar {
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(to top, #6C63FF, #a855f7);
  animation: eqBounce .8s ease-in-out infinite alternate;
  box-shadow: 0 0 6px rgba(108,99,255,.5);
}
.b1 { height: 40%; animation-duration: .7s;  animation-delay: 0s;    }
.b2 { height: 80%; animation-duration: .5s;  animation-delay: .1s;   }
.b3 { height: 60%; animation-duration: .9s;  animation-delay: .2s;   }
.b4 { height: 100%;animation-duration: .6s;  animation-delay: .05s;  }
.b5 { height: 75%; animation-duration: .8s;  animation-delay: .15s;  }
.b6 { height: 50%; animation-duration: .55s; animation-delay: .3s;   }
.b7 { height: 90%; animation-duration: .75s; animation-delay: .08s;  }
.b8 { height: 35%; animation-duration: .65s; animation-delay: .25s;  }

@keyframes eqBounce {
  from { transform: scaleY(.3); opacity: .6; }
  to   { transform: scaleY(1);  opacity: 1;  }
}

.brand-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  color: #fff;
}
.brand-title em {
  font-style: normal;
  background: linear-gradient(90deg, #6C63FF, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub {
  color: rgba(255,255,255,.45);
  font-size: .95rem;
  text-align: center;
}

/* ── Tarjeta de login ───────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 40px 36px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 25px 60px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6C63FF, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(108,99,255,.4);
}
.auth-card-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.auth-card-header p {
  font-size: .82rem;
  color: rgba(255,255,255,.45);
  margin-top: 2px;
}

/* Inputs */
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label {
  font-size: .78rem;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  color: rgba(255,255,255,.3);
  pointer-events: none;
  flex-shrink: 0;
}
.input-wrap input {
  width: 100%;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 13px 14px 13px 40px;
  font-size: 1rem; /* ≥16px previene zoom automático en iOS Safari */
  color: #fff;
  outline: none;
  transition: border-color .2s, background .2s;
  font-family: inherit;
}
.input-wrap input::placeholder { color: rgba(255,255,255,.25); }
.input-wrap input:focus {
  border-color: rgba(108,99,255,.7);
  background: rgba(255,255,255,.1);
}

/* Botón mostrar contraseña */
.toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color .2s;
}
.toggle-pass:hover { color: rgba(255,255,255,.7); }

/* Botón submit */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #6C63FF, #a855f7);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(108,99,255,.4);
  font-family: inherit;
  letter-spacing: .02em;
}
.btn-primary:hover  { opacity: .9; box-shadow: 0 12px 32px rgba(108,99,255,.55); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rotateSpin .7s linear infinite;
}
@keyframes rotateSpin { to { transform: rotate(360deg); } }

/* Nota de acceso */
.auth-note {
  text-align: center;
  font-size: .78rem;
  color: rgba(255,255,255,.25);
  letter-spacing: .02em;
}

/* Error */
.error-msg {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .85rem;
  font-weight: 500;
}

.hidden { display: none !important; }

/* Responsive auth */
@media (max-width: 720px) {
  .auth-brand { display: none; }
  .auth-wrapper { justify-content: center; padding: 24px 16px; }
  .auth-card { max-width: 100%; }
  body.auth-page { overflow-y: auto; }
}
@media (max-width: 400px) {
  .auth-card { padding: 32px 24px; border-radius: 18px; }
}

/* ══════════════════════════════════════════════════════════════
   CHAT PAGE
══════════════════════════════════════════════════════════════ */
body.chat-page {
  display: flex;
  height: 100vh;
  height: 100dvh; /* teclado virtual recalcula en iOS/Android */
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}
/* iOS Safari: fill available height correctly */
@supports (-webkit-touch-callout: none) {
  body.chat-page { height: -webkit-fill-available; }
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.current-user-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

#current-user-name {
  font-weight: 600;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.sidebar-search { padding: 12px 16px; }
.sidebar-search input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .88rem;
  outline: none;
  background: var(--surface-2);
  transition: border-color .2s;
}
.sidebar-search input:focus { border-color: var(--primary); background: var(--surface); }

.contacts-label {
  padding: 4px 16px 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Botón icono genérico del sidebar */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-icon:hover  { background: var(--surface-2); color: var(--primary); }
.btn-icon.active { color: var(--primary); background: rgba(108,99,255,.1); }
#btn-logout:hover { color: var(--danger); }

#contacts-list { flex: 1; overflow-y: auto; list-style: none; }
#contacts-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 12px;
  margin: 2px 8px;
  transition: background .15s;
  position: relative;
}
#contacts-list li:hover { background: var(--surface-2); }
#contacts-list li.active { background: var(--primary)10; }
#contacts-list li.active .contact-item-name { color: var(--primary); }

.contact-item-info { flex: 1; overflow: hidden; }
.contact-item-name { font-size: .9rem; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-item-preview { font-size: .8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.contact-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.contact-time { font-size: .72rem; color: var(--text-3); }
.unread-badge {
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* Main chat panel */
#chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-2);
}

/* Estados de carga y vacío en sidebar */
.contacts-state { padding: 16px; }

.skeleton-contact {
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.contacts-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  margin: 0 auto 12px;
}
.contacts-empty-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 6px;
}
.contacts-empty-sub {
  font-size: .78rem;
  color: var(--text-3);
  text-align: center;
  line-height: 1.5;
}

/* Estado vacío del panel de chat */
#empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 260px;
  text-align: center;
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 4px;
}
.empty-state-inner h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.empty-state-inner p {
  font-size: .85rem;
  color: var(--text-3);
  line-height: 1.5;
}

/* Botón volver (móvil) */
.btn-back {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  padding: 6px;
  border-radius: 8px;
  transition: background .15s;
  margin-right: 4px;
}
.btn-back:hover { background: var(--surface-2); }

/* Texto del header del chat */
.chat-header-text { display: flex; flex-direction: column; }
.chat-header-text > span:first-child { font-weight: 600; font-size: .95rem; }

/* Subiendo archivo */
.msg-uploading {
  font-size: .82rem;
  opacity: .6;
  font-style: italic;
}

/* Chat header */
#chat-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.chat-header-info { display: flex; align-items: center; gap: 12px; }
.chat-header-info > div > span:first-child { display: block; font-weight: 600; font-size: .95rem; }
.contact-status { font-size: .78rem; color: var(--text-3); }
.contact-status.online { color: var(--online); }

/* Avatar */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.status-dot.online { background: var(--online); }

/* Messages */
#messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

#messages-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

#messages-list li {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}
#messages-list li.sent { align-self: flex-end; align-items: flex-end; }
#messages-list li.received { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: .92rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}
.sent .msg-bubble {
  background: var(--sent-bg);
  color: var(--sent-text);
  border-bottom-right-radius: 4px;
}
.received .msg-bubble {
  background: var(--recv-bg);
  color: var(--recv-text);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: .7rem;
  color: var(--text-3);
  margin-top: 3px;
  padding: 0 4px;
}
.sent .msg-time { color: var(--text-3); }

.msg-status {
  font-size: .68rem;
  margin-left: 4px;
}
.msg-status.read { color: var(--primary); }

/* Date separator */
.date-separator {
  text-align: center;
  font-size: .75rem;
  color: var(--text-3);
  margin: 12px 0;
  position: relative;
}
.date-separator::before, .date-separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border);
}
.date-separator::before { left: 0; }
.date-separator::after { right: 0; }

/* Typing indicator */
#typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 0;
  margin-left: 4px;
}
#typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: bounce .9s infinite;
}
#typing-indicator span:nth-child(2) { animation-delay: .15s; }
#typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* Message form */
#message-form {
  min-height: var(--input-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  padding-bottom: max(0px, env(safe-area-inset-bottom)); /* notch/home indicator iOS */
  flex-shrink: 0;
}

#message-form button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  transition: background .15s, color .15s;
}
#message-form button:hover { background: var(--surface-2); color: var(--primary); }

#btn-send {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
#btn-send:hover { background: var(--primary-dark) !important; }

#message-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 1rem; /* ≥16px previene zoom automático en iOS Safari */
  outline: none;
  background: var(--surface-2);
  transition: border-color .2s, background .2s;
}
#message-input:focus { border-color: var(--primary); background: var(--surface); }

/* Image message */
.msg-image {
  max-width: 220px;
  border-radius: 12px;
  display: block;
  margin-bottom: 4px;
  cursor: pointer;
}

/* File attachment */
.msg-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,.06);
  border-radius: 10px;
  font-size: .85rem;
  text-decoration: none;
  color: inherit;
}

/* ── Music Player ────────────────────────────────────────────── */
.music-player {
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.music-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}
.music-player-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.btn-icon-sm:hover { background: var(--surface-2); color: var(--text); }

/* Iframe del widget (Spotify compact embed mínimo 152px) */
.music-widget-wrap {
  width: 100%;
  height: 152px;
  overflow: hidden;
  background: #121212;
}
.music-widget-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Controles */
.music-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 4px;
}
.mc-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 8px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.mc-btn:hover { background: var(--surface-2); color: var(--primary); }

.mc-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(108,99,255,.35);
  transition: transform .15s, box-shadow .15s !important;
}
.mc-play-btn:hover  { transform: scale(1.08); box-shadow: 0 6px 18px rgba(108,99,255,.45) !important; }
.mc-play-btn:active { transform: scale(.95); }
.mc-play-btn.playing { background: var(--primary-dark) !important; }

.mc-volume {
  flex: 1;
  height: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Track info */
.mc-track-info {
  padding: 2px 14px 6px;
  overflow: hidden;
}
#mc-track-title {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#mc-track-artist {
  display: block;
  font-size: .72rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buscador del player */
.music-search-wrap {
  padding: 6px 14px 12px;
  position: relative;
}
.music-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 8px 0 10px;
  transition: border-color .2s;
}
.music-search-row:focus-within { border-color: var(--primary); background: var(--surface); }
.search-icon { color: var(--text-3); flex-shrink: 0; }
#sp-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 1rem; /* ≥16px previene zoom en iOS */
  outline: none;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
}
#sp-search-input::placeholder { color: var(--text-3); }

.mc-load-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.mc-load-btn:hover { background: var(--primary-dark); }

/* Sugerencias rápidas */
.sc-suggestions {
  position: absolute;
  left: 14px;
  right: 14px;
  top: calc(100% - 10px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  list-style: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  z-index: 20;
  overflow: hidden;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.sc-suggestions li {
  padding: 9px 14px;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-2);
  transition: background .1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc-suggestions li::before {
  content: '♪';
  font-size: .7rem;
  color: var(--primary);
}
.sc-suggestions li:hover { background: var(--surface-2); color: var(--primary); }

/* Hint de búsqueda del player */
.sc-hint {
  font-size: .7rem;
  color: var(--text-3);
  text-align: center;
  padding: 6px 4px 0;
  line-height: 1.4;
}

/* PIN step */
#pin-step .btn-primary { margin-top: 8px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* Responsive */
@media (max-width: 640px) {
  #sidebar {
    width: 100%;
    position: absolute;
    z-index: 10;
    transform: translateX(0);
    transition: transform .3s;
    height: 100%;
  }
  #sidebar.hidden-mobile { transform: translateX(-100%); }
  body.chat-page { position: relative; }
  .btn-back { display: flex; }
  .contacts-label { padding-top: 12px; }
}
