/* Amigos, notificações e perfil de um amigo. Usa as variáveis e os componentes de app.css. */

/* ---------- Sino de notificações ---------- */
.notif-btn { position: relative; width: var(--touch-target); height: var(--touch-target); display: grid; place-items: center; border: none; background: none; border-radius: 10px; color: var(--text-secondary); cursor: pointer; transition: all var(--transition-fast); -webkit-tap-highlight-color: transparent; flex-shrink: 0; }
.notif-btn:hover, .notif-btn[aria-expanded="true"] { background: var(--bg-tertiary); color: var(--accent); }
.notif-btn svg { width: 20px; height: 20px; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--accent-danger); color: #fff; font-size: 0.66rem; font-weight: 700; line-height: 14px; text-align: center; border: 2px solid var(--bg-primary); box-sizing: border-box; }

.notif-panel { position: fixed; top: calc(var(--header-height) + 8px); right: 16px; width: 380px; max-width: calc(100vw - 16px); max-height: min(72vh, 540px); display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 130; overflow: hidden; }
.notif-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border-color); }
.notif-panel-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; }
.notif-panel-body { overflow-y: auto; overscroll-behavior: contain; }
.notif-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 18px; border: none; border-bottom: 1px solid var(--border-color); background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; position: relative; min-height: var(--touch-target); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-tertiary); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.notif-avatar { width: 36px; height: 36px; font-size: 0.9rem; }
.notif-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.notif-line { font-size: 0.86rem; line-height: 1.4; overflow-wrap: anywhere; }
.notif-line em { font-style: italic; font-family: var(--font-display); }
.notif-time { font-size: 0.72rem; color: var(--text-muted); }

/* ---------- Peças comuns ---------- */
.friend-avatar { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, var(--accent), #c97a7a); color: #14141c; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; overflow: hidden; }
.friend-avatar img, .friend-hero-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.social-message { font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary); margin-top: 10px; }
.social-message:empty { display: none; }
.social-message.error { color: #e08a8a; }
.social-message.ok { color: var(--accent-secondary); }
html[data-theme="light"] .social-message.error { color: #a13b3b; }
.social-subtitle { font-size: 0.72rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; margin: 14px 0 8px; }
.social-subtitle:first-child { margin-top: 0; }
.social-count { font-family: var(--font-body); font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.social-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 22px 16px; color: var(--text-secondary); font-size: 0.88rem; line-height: 1.45; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); }
.social-empty strong { color: var(--text-primary); font-weight: 600; }
.social-empty .btn { margin-top: 6px; }
.notif-panel-body .social-empty { border: none; padding: 30px 20px; }
.social-loading { padding: 22px 16px; text-align: center; color: var(--text-muted); font-size: 0.88rem; font-style: italic; }
.social-gate { text-align: center; padding: 34px 20px; margin-bottom: 20px; background: var(--bg-card); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.social-gate-text { color: var(--text-secondary); max-width: 440px; line-height: 1.5; font-size: 0.92rem; }
.social-notice, .social-status { padding: 12px 14px; margin-bottom: 16px; border: 1px solid var(--border-color); border-left: 3px solid var(--accent-warning); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-secondary); font-size: 0.88rem; line-height: 1.45; }
.social-status.error { border-left-color: var(--accent-danger); }
.social-status .social-empty { border: none; padding: 6px; }

/* ---------- Página Amigos ---------- */
.amigos-container, .friend-profile-container { max-width: 760px; margin: 0 auto; }
.amigos-page-header { margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid rgba(212,165,116,0.1); }
.amigos-page-title { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; display: flex; align-items: center; gap: 10px; letter-spacing: -0.02em; }
.amigos-page-title svg { width: 24px; height: 24px; color: var(--accent); }
.amigos-page-subtitle { color: var(--text-secondary); font-size: 0.88rem; margin-top: 4px; font-style: italic; }

.friend-request-form .form-label { display: block; margin-bottom: 8px; }
.friend-request-row { display: flex; gap: 10px; align-items: stretch; }
.friend-input-wrap { position: relative; flex: 1; min-width: 0; }
.friend-input-wrap .form-input { width: 100%; padding-left: 32px; }
.friend-input-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; pointer-events: none; }
.friend-request-row .btn { flex-shrink: 0; }

.friend-list { display: flex; flex-direction: column; gap: 8px; }
.friend-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-secondary); transition: border-color var(--transition-fast), background var(--transition-fast); }
.friend-row:hover { border-color: var(--border-strong); }
.friend-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: none; background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; min-height: 60px; border-radius: var(--radius-md); }
button.friend-row-main:hover { background: var(--accent-soft); }
.friend-row-static { cursor: default; }
.friend-row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.friend-row-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row-handle { font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row-meta { font-size: 0.76rem; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
.friend-row-actions { display: flex; gap: 8px; padding-right: 10px; flex-shrink: 0; }
.friend-request-item { flex-wrap: wrap; }
.friend-request-item .friend-row-actions { padding: 0 12px 10px; width: 100%; justify-content: flex-end; }
@media (min-width: 560px) {
    .friend-request-item { flex-wrap: nowrap; }
    .friend-request-item .friend-row-actions { padding: 0 10px 0 0; width: auto; }
}

/* ---------- Perfil de um amigo ---------- */
.friend-back { margin-bottom: 16px; }
.friend-hero { padding: 26px 20px 22px; }
.friend-hero > * { position: relative; z-index: 1; }
.friend-hero-avatar { width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #c97a7a); color: #14141c; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 700; font-family: var(--font-display); overflow: hidden; border: 3px solid var(--bg-card); box-shadow: var(--shadow-md); }
.friend-handle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 4px; }
.friend-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-top: 18px; }
.friend-stats .profile-stat { padding: 12px 6px; }
.friend-stats .profile-stat:hover { transform: none; }
.friend-remove { margin-top: 18px; }
.friend-section { margin-bottom: 30px; }
.friend-section-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; letter-spacing: -0.01em; }
.friend-recent { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.friend-recent > .book-card { flex: 0 0 118px; scroll-snap-align: start; }
.friend-recent > .social-empty { flex: 1; }
.friend-search { min-width: 0; margin-bottom: 16px; }
.cover-fallback { font-size: 2rem; }
.friend-book:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Detalhe do livro ---------- */
.friend-book-modal { max-width: 520px; }
.friend-book-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.friend-book-cover { width: 112px; flex-shrink: 0; aspect-ratio: 2 / 3; border-radius: var(--radius-sm); overflow: hidden; background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary)); border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.friend-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.friend-book-head { min-width: 0; }
.friend-book-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.friend-book-author { color: var(--text-secondary); font-style: italic; margin-top: 4px; overflow-wrap: anywhere; }
.friend-book-owner { color: var(--text-muted); font-size: 0.8rem; margin-top: 10px; }
.friend-book-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.friend-book-fact dt { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.friend-book-fact dd { font-size: 0.92rem; margin-top: 2px; overflow-wrap: anywhere; }

@media (max-width: 480px) {
    .notif-panel { left: 8px; right: 8px; width: auto; max-height: calc(100dvh - var(--header-height) - var(--bottom-nav-height) - 24px); }
    .friend-request-row .btn { padding-left: 14px; padding-right: 14px; }
    .friend-book-top { gap: 12px; }
    .friend-book-cover { width: 92px; }
    .friend-book-facts { grid-template-columns: 1fr 1fr; }
    .friend-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .friend-stats .profile-stat { grid-column: span 2; }
    .friend-stats .profile-stat:nth-child(n+4) { grid-column: span 3; }
}
