*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:      #0f0f0f;
    --surface: #1a1a1a;
    --accent:  #ff6500;
    --text:    #ebebeb;
    --muted:   #888;
    --border:  #2a2a2a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
header {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    padding: 0 5%;
    border-bottom: 2px solid var(--accent);
    flex-shrink: 0;
}
#logo { font-size: 1.7em; font-weight: 900; letter-spacing: -1px; }
#logo a {
    color: #fff; text-decoration: none; display: block;
    font-size: inherit; font-weight: inherit; letter-spacing: inherit;
    flex-direction: unset; align-items: unset;
}
#logo a span  { color: var(--accent); }
#logo a:hover { color: #fff; }

#icons { display: flex; align-items: center; gap: 22px; }
a {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: var(--text); transition: color .2s;
}
a:hover { color: var(--accent); }
a:hover .icons { filter: brightness(0) saturate(100%) invert(45%) sepia(98%) saturate(600%) hue-rotate(2deg); }
.icons { height: 20px; width: 20px; filter: invert(1); }
.icons[alt="login"],
.icons[alt="register"] { filter: none; }
a p { font-size: 0.58em; margin-top: 3px; color: var(--muted); }

/* ── Main ── */
main { flex: 1; padding: 36px 5% 60px; max-width: 960px; margin: 0 auto; width: 100%; }

/* ══════════════════════════════
   PERFIL — cabeçalho
══════════════════════════════ */
.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 40px;
}

/* Avatar */
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--border);
}
.avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
}

/* Info */
.profile-info { flex: 1; min-width: 0; }

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.profile-name {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text);
}
.badge-admin {
    background: rgba(255,101,0,.18);
    color: var(--accent);
    border: 1px solid rgba(255,101,0,.4);
    font-size: 0.72em;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
}
.btn-follow {
    padding: 7px 20px;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.btn-follow:hover { background: #ff8533; }
.btn-follow.following {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
}
.btn-follow.following:hover { border-color: #e74c3c; color: #e74c3c; }
.btn-follow.requested {
    background: var(--surface);
    border: 1px solid var(--accent);
    color: var(--accent);
}
.btn-follow.requested:hover { border-color: #e74c3c; color: #e74c3c; }
.btn-follow:disabled { opacity: .6; cursor: default; }

.private-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    color: var(--muted);
    text-align: center;
}
.private-notice p { font-size: 1em; margin-bottom: 6px; }
.private-notice small { font-size: .82em; }

.btn-edit {
    padding: 6px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .2s, color .2s;
    flex-direction: row;
}
.btn-edit:hover { border-color: var(--accent); color: var(--accent); }

.profile-bio {
    font-size: 0.9em;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}
.profile-bio.empty a { color: var(--muted); text-decoration: none; flex-direction: row; }
.profile-bio.empty a:hover { color: var(--accent); }

.profile-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88em;
    color: var(--muted);
    flex-wrap: wrap;
}
.profile-stats strong { color: var(--text); }
.profile-stats .sep  { opacity: .4; }
.stat-since { font-size: 0.9em; }

/* ── Tabs publicações / curtidas ── */
.profile-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 18px;
}
.profile-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-direction: row;
    padding: 8px 18px;
    font-size: 0.88em;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    transition: color .2s;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active {
    color: var(--accent);
    background: var(--surface);
    border-color: var(--border);
    border-bottom: 2px solid var(--bg);
}
.tab-count {
    background: var(--border);
    color: var(--muted);
    font-size: 0.78em;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
}
.profile-tab.active .tab-count { background: rgba(255,101,0,.15); color: var(--accent); }

/* ── Profile search ── */
.profile-search {
    display: flex;
    margin-bottom: 6px;
}
.profile-search-wrap {
    position: relative;
    width: 100%;
    max-width: 360px;
}
.profile-search-wrap input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 36px 8px 36px;
    color: var(--text);
    font-size: 0.88em;
    font-family: inherit;
    transition: border-color .2s, background .2s;
    box-sizing: border-box;
}
.profile-search-wrap input:focus {
    outline: none;
    border-color: #444;
    background: #1f1f1f;
}
.profile-search-wrap input::placeholder { color: var(--muted); }
.profile-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
}
.profile-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--muted);
    transition: color .15s;
}
.profile-search-clear svg { width: 12px; height: 12px; }
.profile-search-clear:hover { color: var(--text); }

.profile-search-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82em;
    color: var(--muted);
    margin-bottom: 16px;
}
.profile-search-info strong { color: var(--text); font-weight: 600; }
.profile-search-reset {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    flex-direction: row;
}
.profile-search-reset:hover { opacity: .8; }

/* ── Posts grid ── */
.empty-posts {
    text-align: center;
    color: var(--muted);
    font-size: 0.92em;
    margin-top: 40px;
}
.empty-posts a { color: var(--accent); flex-direction: row; }

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.post-card { display: block; text-decoration: none; }

.post-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #111;
    overflow: hidden;
}
.post-thumb-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s, opacity .12s;
}
.post-card:hover .post-thumb-wrap img { transform: scale(1.05); }

.no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: var(--border);
}

.badge-count {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,.75);
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}
.badge-dur {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,.8);
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

.post-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: flex-end;
    padding: 8px;
    opacity: 0;
    transition: opacity .2s;
}
.post-card:hover .post-overlay { opacity: 1; }
.post-overlay span {
    font-size: 0.78em;
    color: #fff;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ══════════════════════════════
   EDITAR PERFIL
══════════════════════════════ */
main.edit-main {
    padding: 40px 16px 60px;
    display: flex;
    justify-content: center;
    max-width: 100%;
}

.edit-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 36px 32px;
    width: 100%;
    max-width: 480px;
}

.edit-title {
    font-size: 1.4em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
}

.flash {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.88em;
    margin-bottom: 20px;
}
.flash.ok  { background: rgba(39,174,96,.12); border: 1px solid rgba(39,174,96,.3); color: #2ecc71; }
.flash.err { background: rgba(255,50,50,.1);  border: 1px solid rgba(255,50,50,.35); color: #ff6b6b; }

/* Avatar edit */
.avatar-edit-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}
.edit-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}
.avatar-change-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 6px;
    padding: 5px 16px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.avatar-change-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Info form */
.info-form { display: flex; flex-direction: column; }
.info-form label {
    font-size: 0.83em;
    color: var(--muted);
    margin-bottom: 5px;
}
.label-hint { font-weight: 400; opacity: .7; }

.campo {
    width: 100%;
    padding: 10px 12px;
    background: #111;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95em;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
    margin-bottom: 16px;
}
.campo:focus { border-color: var(--accent); }

textarea.campo {
    resize: vertical;
    min-height: 80px;
    margin-bottom: 4px;
}
.bio-counter {
    font-size: 0.75em;
    color: var(--muted);
    text-align: right;
    margin-bottom: 16px;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0 20px;
}

.btn-save {
    width: 100%;
    height: 44px;
    background: var(--accent);
    color: #fff;
    font-size: 1em;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s;
    margin-top: 4px;
}
.btn-save:hover { background: #ff8533; }

.back-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 0.85em;
    color: var(--muted);
    text-decoration: none;
    flex-direction: row;
}
.back-link:hover { color: var(--accent); }

/* ── Owner card (div wrapper + delete btn) ── */
div.post-card { position: relative; }

.post-card-link { display: block; text-decoration: none; }
div.post-card:hover .post-thumb-wrap img { transform: scale(1.05); }
div.post-card:hover .post-overlay { opacity: 1; }

.post-edit-btn {
    position: absolute;
    top: 7px;
    left: 7px;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,.72);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82em;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    flex-direction: row;
    opacity: 0;
    transition: opacity .2s, background .2s;
    z-index: 3;
}
div.post-card:hover .post-edit-btn { opacity: 1; }
.post-edit-btn:hover { background: rgba(255,101,0,.85); color: #fff; }

.post-delete-btn {
    position: absolute;
    top: 7px;
    left: 40px;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,.72);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78em;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    flex-direction: row;
    opacity: 0;
    transition: opacity .2s, background .2s;
    z-index: 3;
}
div.post-card:hover .post-delete-btn { opacity: 1; }
.post-delete-btn:hover { background: rgba(231,76,60,.9); color: #fff; }

/* ── Modal (delete confirmation) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 24px;
    max-width: 380px;
    width: 90%;
    text-align: center;
}
.modal h2 { font-size: 1.1em; margin-bottom: 10px; color: var(--text); }
.modal p  { font-size: 0.88em; color: var(--muted); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal button {
    padding: 10px 28px;
    border: none;
    border-radius: 6px;
    font-size: 0.88em;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
}
.modal button:hover { opacity: .85; }
.modal button.confirm { background: var(--danger, #e74c3c); color: #fff; }
.modal button.cancel  { background: var(--border); color: var(--text); }

/* ── Flash ── */
.flash {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.88em;
    margin-bottom: 18px;
}
.flash.ok  { background: rgba(39,174,96,.12); border: 1px solid rgba(39,174,96,.35); color: #2ecc71; }
.flash.err { background: rgba(231,76,60,.12); border: 1px solid rgba(231,76,60,.35); color: #e74c3c; }

/* ── Paginação ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 32px;
    padding-bottom: 24px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.88em;
    font-weight: 600;
    text-decoration: none;
    flex-direction: row;
    transition: background .2s, border-color .2s;
}
.page-btn:hover        { background: var(--surface2); border-color: #444; color: var(--text); }
.page-btn.active       { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn.active:hover { background: var(--accent); color: #fff; }
.page-btn.disabled     { opacity: .35; pointer-events: none; }
.page-ellipsis         { color: var(--muted); font-size: 0.88em; padding: 0 2px; }

/* ── Responsivo ── */
@media (max-width: 640px) {
    main          { padding: 24px 4% 40px; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
    .profile-name-row { justify-content: center; }
    .profile-stats { justify-content: center; }
    .posts-grid   { grid-template-columns: repeat(2, 1fr); }
    header        { padding: 0 3%; }
    .icons        { height: 17px; width: 17px; }
    .edit-card    { padding: 24px 18px; }
}
