/* ============================================================
   PHANTOM MSG — UI Utilities & Redesigned Components
   Replaces inline styles with reusable classes.
   Includes: identity redesign, empty state, input simplification,
   security indicator.
   ============================================================ */

/* ---- UTILITY CLASSES (replacing inline styles) ---- */

/* ============================================================
   UNIVERSAL CLOSE BUTTON
   Reemplaza todas las "X" inconsistentes con un icono uniforme
   ============================================================ */
.close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--overlay-light);
    border-color: var(--border);
}

.close-btn:active {
    transform: scale(0.92);
}

/* Variante para close absolutamente posicionado */
.close-btn-abs {
    position: absolute;
    top: 8px;
    right: 8px;
}
.text-xs { font-size: 10px; }
.text-sm { font-size: 11px; }
.text-md { font-size: 12px; }
.text-base { font-size: 13px; }
.text-lg { font-size: 14px; }
.text-xl { font-size: 16px; }
.text-2xl { font-size: 20px; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-teal { color: var(--primary-400); }
.text-amber { color: var(--accent-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-break { word-break: break-all; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.hidden { display: none; }

.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.p-8 { padding: 8px; }
.p-10 { padding: 10px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.px-8 { padding-left: 8px; padding-right: 8px; }
.py-4 { padding-top: 4px; padding-bottom: 4px; }
.py-6 { padding-top: 6px; padding-bottom: 6px; }

.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 50%; }

.bg-body { background: var(--bg-body); }
.bg-surface { background: var(--bg-surface); }
.bg-card { background: var(--bg-card); }
.bg-elevated { background: var(--bg-elevated); }
.border-t { border-top: 1px solid var(--border-light); }
.border-b { border-bottom: 1px solid var(--border-light); }

.cursor-pointer { cursor: pointer; }
.relative { position: relative; }
.opacity-50 { opacity: 0.5; }

/* ============================================================
   REDESIGNED IDENTITY / LOGIN SECTION
   Cleaner layout, card-based, more breathable
   ============================================================ */
.identity-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
}

.identity-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.identity-header-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.identity-header-text {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-primary);
}

.identity-header-sub {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 400;
}

/* Login form */
.identity-login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.identity-input-row {
    display: flex;
    gap: 8px;
}

.identity-input-row .input {
    font-size: 13px;
    padding: 10px 12px;
}

.identity-input-row .input-id {
    flex: 1;
}

.identity-input-row .input-pin {
    width: 80px;
}

.identity-actions {
    display: flex;
    gap: 6px;
}

.identity-actions .btn {
    flex: 1;
}

/* Register form (expandable) */
.identity-register {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 200px; }
}

.identity-register .input {
    font-size: 12px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

/* Logged in state */
.identity-logged {
    display: none;
}

.identity-logged.active {
    display: block;
}

.identity-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.identity-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-300));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--border-focus);
    flex-shrink: 0;
    overflow: hidden;
}
.identity-avatar svg {
    width: 100%; height: 100%;
    display: block;
    border-radius: inherit;
}
}

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

.identity-alias {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-pid {
    font-size: 10px;
    color: var(--primary-400);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-logout-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-family: var(--font-display), var(--font-emoji);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.identity-logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Invite section */
.identity-invite-btn {
    width: 100%;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-400);
    background: var(--primary-100);
    border: 1px solid var(--primary-glow);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-display), var(--font-emoji);
    transition: var(--transition);
}

.identity-invite-btn:hover {
    background: var(--primary-glow);
    border-color: var(--primary-400);
}

.identity-invite-result {
    display: none;
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    position: relative;
    animation: slideDown 0.2s ease-out;
}

.identity-invite-result .close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    line-height: 1;
}

.identity-invite-link {
    font-family: var(--font-mono);
    font-size: 10px;
    word-break: break-all;
    color: var(--primary-400);
    padding: 6px 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    margin-top: 4px;
}

/* ============================================================
   EMPTY STATE — Onboarding
   ============================================================ */
.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    text-align: center;
    gap: 24px;
}

.empty-ghost {
    position: relative;
    width: 96px;
    height: 96px;
}

.empty-ghost-body {
    width: 96px;
    height: 96px;
    border-radius: 48px 48px 20px 20px;
    background: linear-gradient(180deg, var(--primary-100) 0%, var(--primary-100) 100%);
    border: 1.5px solid var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ghostFloat 3s ease-in-out infinite;
}

@keyframes ghostFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.empty-ghost-body svg {
    width: 48px;
    height: 48px;
    color: var(--primary-400);
    opacity: 0.6;
}

.empty-ghost-shadow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 8px;
    background: radial-gradient(ellipse, var(--primary-glow) 0%, transparent 70%);
    animation: ghostShadow 3s ease-in-out infinite;
}

@keyframes ghostShadow {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    50% { transform: translateX(-50%) scale(0.8); opacity: 0.3; }
}

.empty-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.3;
}

.empty-title span {
    background: linear-gradient(135deg, var(--primary-400), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.6;
}

/* Feature highlights */
.empty-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 380px;
    width: 100%;
    margin-top: 8px;
}

.empty-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--overlay-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.empty-feature:hover {
    background: var(--primary-100);
    border-color: var(--primary-glow);
}

.empty-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.empty-feature-icon.teal { background: var(--primary-100); color: var(--primary-400); }
.empty-feature-icon.amber { background: var(--accent-100); color: var(--accent-light); }
.empty-feature-icon.purple { background: var(--primary-100); color: var(--primary-400); }
.empty-feature-icon.green { background: var(--primary-100); color: var(--success); }

.empty-feature-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
}

.empty-cta {
    margin-top: 8px;
}

.empty-cta .btn {
    padding: 12px 32px;
    font-size: 14px;
    border-radius: 24px;
}

/* ============================================================
   SIMPLIFIED INPUT — Expandable extras
   ============================================================ */
.input-extras-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-extras-toggle:hover {
    color: var(--primary-400);
    background: var(--primary-100);
}

.input-extras-toggle.active {
    color: var(--primary-400);
    background: var(--primary-100);
    transform: rotate(45deg);
}

.chat-input-extras {
    display: none;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    animation: slideDown 0.15s ease-out;
}

.chat-input-extras.show {
    display: flex;
}

.chat-input-extras label {
    font-size: 11px;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================================
   SECURITY SHIELD INDICATOR
   Persistent badge showing active protection layers
   ============================================================ */
.security-shield {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary-100);
    border: 1px solid var(--primary-glow);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.security-shield:hover {
    background: var(--primary-glow);
    border-color: var(--border-focus);
}

.security-shield-icon {
    color: var(--success);
    display: flex;
    align-items: center;
}

.security-shield-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--success);
    letter-spacing: 0.03em;
}

.security-shield-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--success);
    color: var(--bg-body);
    font-size: 9px;
    font-weight: 800;
}

/* Shield level colors */
.security-shield.shield-max {
    background: var(--primary-100);
    border-color: var(--border-focus);
}
.security-shield.shield-max .security-shield-icon,
.security-shield.shield-max .security-shield-text { color: #34D399; }
.security-shield.shield-max .security-shield-count { background: #34D399; }

.security-shield.shield-good {
    background: var(--primary-100);
    border-color: var(--primary-glow);
}
.security-shield.shield-good .security-shield-icon,
.security-shield.shield-good .security-shield-text { color: var(--primary-500); }
.security-shield.shield-good .security-shield-count { background: var(--primary-500); }

.security-shield.shield-mid {
    background: var(--accent-100);
    border-color: var(--accent-100);
}
.security-shield.shield-mid .security-shield-icon,
.security-shield.shield-mid .security-shield-text { color: var(--accent-light); }
.security-shield.shield-mid .security-shield-count { background: var(--accent-light); }

.security-shield.shield-basic {
    background: rgba(248,113,113,0.08);
    border-color: rgba(248,113,113,0.18);
}
.security-shield.shield-basic .security-shield-icon,
.security-shield.shield-basic .security-shield-text { color: #F87171; }
.security-shield.shield-basic .security-shield-count { background: #F87171; }

/* Security detail panel (dropdown) */
.security-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: modalPop 0.2s ease-out;
}

.security-panel.show {
    display: block;
}

.security-panel-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.security-panel-title svg {
    color: var(--success);
}

.security-layer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.security-layer:last-child {
    border-bottom: none;
}

.security-layer-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}

.security-layer-icon.active {
    background: var(--primary-100);
    color: var(--success);
}

.security-layer-icon.inactive {
    background: rgba(90,106,128,0.12);
    color: var(--text-dim);
}

.security-layer-info {
    flex: 1;
    min-width: 0;
}

.security-layer-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.security-layer-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.security-layer-status {
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.security-layer-status.on { color: var(--success); }
.security-layer-status.off { color: var(--text-dim); }

/* Panel transitions are handled in layout.css via .tool-panel.active and .chat-layout.active */

/* ============================================================
   CHAT SEARCH — Search in message history
   ============================================================ */
.chat-search-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-search-btn:hover {
    color: var(--primary-400);
    background: var(--primary-100);
}

.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 60px; }
}

.chat-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 6px 14px;
    transition: border-color 0.15s ease;
}

.chat-search-input-wrap:focus-within {
    border-color: var(--primary-500);
}

.chat-search-icon {
    color: var(--text-dim);
    flex-shrink: 0;
}

.chat-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-display), var(--font-emoji);
    min-width: 0;
}

.chat-search-input::placeholder {
    color: var(--text-dim);
}

.chat-search-count {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-search-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-search-nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.chat-search-nav-btn:hover {
    color: var(--primary-400);
    background: var(--primary-100);
}

.chat-search-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: var(--transition);
}

.chat-search-close-btn:hover {
    color: var(--text-primary);
    background: var(--overlay-light);
}

/* Highlighted text in messages */
.search-highlight {
    background: var(--accent-100);
    color: var(--text-primary);
    border-radius: 2px;
    padding: 0 1px;
}

.search-highlight.active {
    background: var(--accent);
    outline: 2px solid var(--accent-light);
    outline-offset: 1px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .chat-search-bar {
        padding: 6px 12px;
    }
    .chat-search-input {
        font-size: 16px;
    }
}

/* ============================================================
   FORM SECTION (sidebar create/join forms)
   ============================================================ */
.sidebar-form-section {
    padding: 14px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-elevated);
    animation: slideDown 0.2s ease-out;
}

.sidebar-form-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sidebar-form-title strong {
    font-size: 13px;
    font-weight: 700;
}

.sidebar-form-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 10px;
    line-height: 1.5;
}

.sidebar-form-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-form-close-btn:hover {
    color: var(--text-primary);
    background: var(--overlay-light);
}

/* Info badge (ECDH, FS, etc) */
.info-badge {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 10px;
}

.info-badge.purple {
    background: var(--primary-100);
    border: 1px solid var(--primary-glow);
    color: var(--primary-400);
}

.info-badge.teal {
    background: var(--primary-100);
    border: 1px solid var(--primary-glow);
    color: var(--primary-400);
}

.info-badge strong {
    font-weight: 700;
}

/* Checkbox group */
.check-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 12px;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
}

.check-label:hover {
    color: var(--text-secondary);
}

.check-label.dimmed {
    color: var(--text-dim);
    font-size: 11px;
}

/* Result card (sala creada, invite, etc) */
.result-card {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    font-size: 11px;
    position: relative;
    animation: slideDown 0.2s ease-out;
}

.result-card.show {
    display: block;
}

.result-card-title {
    color: var(--success);
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 12px;
}

.result-card-hint {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.result-card-mono {
    font-family: var(--font-mono);
    font-size: 10px;
    word-break: break-all;
    color: var(--primary-400);
    padding: 6px 8px;
    background: var(--bg-surface);
    border-radius: 4px;
}

.result-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.result-card-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    line-height: 1;
}

/* ============================================================
   CHAT SEARCH BAR
   ============================================================ */
.chat-search-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    animation: slideDown 0.2s ease-out;
}

.chat-search-bar.show {
    display: flex;
}

.chat-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    transition: border-color 0.15s ease;
}

.chat-search-input-wrap:focus-within {
    border-color: var(--primary-400);
}

.chat-search-icon {
    color: var(--text-dim);
    flex-shrink: 0;
}

.chat-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-display), var(--font-emoji);
    min-width: 0;
}

.chat-search-input::placeholder {
    color: var(--text-dim);
}

.chat-search-count {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-search-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-search-nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
}

.chat-search-nav-btn:hover {
    color: var(--primary-400);
    background: var(--primary-100);
}

/* Highlight en mensajes encontrados */
.msg-search-highlight {
    background: var(--accent-100);
    border-radius: 2px;
    padding: 0 1px;
}

.msg-search-highlight.active {
    background: var(--accent);
    outline: 1px solid var(--accent-light);
}

/* Mensajes que NO coinciden con la busqueda */
.msg.search-hidden {
    opacity: 0.2;
    transition: opacity 0.15s ease;
}

/* Separadores de fecha tambien se atenuan */
[data-date-sep].search-hidden {
    opacity: 0.2;
    transition: opacity 0.15s ease;
}

/* Mobile: search bar compact */
@media (max-width: 768px) {
    .chat-search-bar {
        padding: 6px 10px;
        gap: 6px;
    }
    .chat-search-input-wrap {
        padding: 6px 10px;
    }
    .chat-search-input {
        font-size: 14px;
    }
}

/* ============================================================
   MOBILE ADJUSTMENTS for new components
   ============================================================ */

/* ============================================================
   INFO PANEL — Classes replacing inline styles
   ============================================================ */
.info-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.info-capacity {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 2;
}

/* ============================================================
   CONTEXT MENU — Right click (desktop) + Long press (mobile)
   ============================================================ */
.ctx-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    animation: ctxFade 0.15s ease-out;
}

@keyframes ctxFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ctx-menu {
    position: fixed;
    z-index: 9501;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 0;
    min-width: 200px;
    max-width: 260px;
    box-shadow: var(--shadow-lg);
    animation: ctxPop 0.15s ease-out;
}

@keyframes ctxPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-display), var(--font-emoji);
    transition: background 0.12s ease, color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.ctx-menu-item:hover {
    background: var(--overlay-light);
    color: var(--text-primary);
}

.ctx-menu-item:active {
    background: var(--overlay-light);
}

.ctx-menu-item-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.ctx-menu-item:hover .ctx-menu-item-icon {
    color: var(--primary-400);
}

.ctx-menu-item.danger {
    color: var(--danger);
}

.ctx-menu-item.danger .ctx-menu-item-icon {
    color: var(--danger);
}

.ctx-menu-item.danger:hover {
    background: rgba(248,113,113,0.08);
}

.ctx-menu-sep {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* Chat item indicators for pinned/muted/archived */
.chat-item-pin-icon {
    color: var(--primary-400);
    font-size: 12px;
    margin-left: 4px;
}

.chat-item-mute-icon {
    color: var(--text-dim);
    font-size: 12px;
    margin-left: 4px;
}

.chat-item.chat-muted .chat-item-name {
    color: var(--text-muted);
}

.chat-item.chat-muted .chat-item-preview {
    color: var(--text-dim);
}

/* Pinned section divider */
.chat-section-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Archived section */
.chat-archived-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-400);
    cursor: pointer;
    border-top: 1px solid var(--border-light);
    transition: background 0.15s ease;
}

.chat-archived-toggle:hover {
    background: var(--overlay-subtle);
}

.chat-archived-toggle-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-400);
}

/* Long press visual feedback */
.chat-item.long-pressing {
    background: var(--primary-100) !important;
    transition: background 0.3s ease;
}
@media (max-width: 768px) {
    .empty-features {
        grid-template-columns: 1fr;
        max-width: 280px;
    }
    
    .empty-ghost-body {
        width: 72px;
        height: 72px;
    }
    
    .empty-ghost-body svg {
        width: 36px;
        height: 36px;
    }
    
    .empty-ghost {
        width: 72px;
        height: 72px;
    }
    
    .empty-title {
        font-size: 18px;
    }
    
    .security-panel {
        right: -20px;
        width: calc(100vw - 32px);
        max-width: 300px;
    }
    
    .identity-profile {
        padding: 8px 10px;
    }
    
    .identity-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
        border-radius: 10px;
    }

    /* Context menu: bottom sheet on mobile */
    .ctx-menu {
        left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
        transform: none;
        max-width: 100vw;
        min-width: 100vw;
        border-radius: 16px 16px 0 0;
        border: none;
        border-top: 1px solid var(--border);
        padding: 8px 0 env(safe-area-inset-bottom, 12px);
        animation: ctxSlideUp 0.2s ease-out;
    }
    @keyframes ctxSlideUp {
        from { opacity: 0; transform: translateY(100%); }
        to { opacity: 1; transform: translateY(0); }
    }
    .ctx-menu-item { padding: 15px 20px; font-size: 15px; min-height: 48px; }
}
