/* ==========================================================================
   Woofer Vouches — Discord-themed vouch viewer
   ========================================================================== */

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

:root {
    --bg-primary: #36393f;
    --bg-secondary: #2f3136;
    --bg-tertiary: #202225;
    --bg-hover: #32353b;
    --text-normal: #dcddde;
    --text-muted: #72767d;
    --text-link: #00aff4;
    --header-primary: #fff;
    --header-secondary: #b9bbbe;
    --brand-experiment: #5865f2;
    --brand-experiment-hover: #4752c4;
    --status-green: #3ba55d;
    --status-red: #ed4245;
    --status-yellow: #faa61a;
    --reaction-bg: rgba(79, 84, 92, 0.48);
    --reaction-border: rgba(255, 255, 255, 0.08);
    --scrollbar-thin-thumb: #202225;
    --scrollbar-thin-track: #2f3136;
    --font-primary: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'Consolas', 'Andale Mono WT', 'Andale Mono', 'Lucida Console', monospace;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg-primary);
    color: var(--text-normal);
    font-family: var(--font-primary);
    font-size: 15px;
    line-height: 1.375;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--text-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thin-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-thin-track);
}

/* --- Header --- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    padding: 12px 16px;
    backdrop-filter: blur(8px);
}

.header__inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-experiment);
    border-radius: 50%;
}

.header__icon svg {
    width: 22px;
    height: 22px;
}

.header__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--header-primary);
    line-height: 1.2;
}

.header__subtitle {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.2;
}

/* --- Search --- */
.search {
    flex: 1;
    max-width: 420px;
    min-width: 200px;
}

.search__wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search__icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.search__input {
    width: 100%;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    color: var(--text-normal);
    font-family: var(--font-primary);
    font-size: 14px;
    padding: 8px 36px 8px 36px;
    outline: none;
    transition: box-shadow 0.15s;
}

.search__input::placeholder {
    color: var(--text-muted);
}

.search__input:focus {
    box-shadow: 0 0 0 2px var(--brand-experiment);
}

.search__clear {
    position: absolute;
    right: 8px;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.search__clear:hover {
    color: var(--text-normal);
    text-decoration: none;
}

/* --- Search Results Info --- */
.search-results-info {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 16px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.search-results-info strong {
    color: var(--text-normal);
}

/* --- Chat Log --- */
.chatlog {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

/* --- Message Group --- */
.chatlog__message-group {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.1s;
}

.chatlog__message-group:hover {
    background: var(--bg-hover);
    border-radius: 4px;
}

.chatlog__message-group:first-child {
    border-top: none;
}

/* --- Avatar --- */
.chatlog__avatar-col {
    flex-shrink: 0;
    width: 40px;
    padding-top: 2px;
}

.chatlog__author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

/* --- Content Column --- */
.chatlog__content-col {
    flex: 1;
    min-width: 0;
}

/* --- Header Row --- */
.chatlog__header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.chatlog__author-name {
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    line-height: 1.2;
    padding: 4px 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.chatlog__author-name {
    cursor: pointer;
}

.chatlog__author-name:hover {
    text-decoration: underline;
}

.chatlog__author-name[data-status="active"] {
    text-decoration: underline;
    text-decoration-color: var(--status-green);
}

.chatlog__author-name[data-status="not_found"] {
    text-decoration: underline;
    text-decoration-color: var(--status-red);
}

/* --- Timestamp --- */
.chatlog__timestamp {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Message Content --- */
.chatlog__message-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.375;
}

.chatlog__message-content .mention {
    background: rgba(88, 101, 242, 0.3);
    color: #dee0fc;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 500;
}

.chatlog__message-content .emoji {
    width: 22px;
    height: 22px;
    vertical-align: -0.4em;
    object-fit: contain;
}

.chatlog__message-content .emoji--large {
    width: 48px;
    height: 48px;
}

/* --- Reactions --- */
.chatlog__reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.chatlog__reaction {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--reaction-bg);
    border: 1px solid var(--reaction-border);
    border-radius: 8px;
    padding: 2px 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.chatlog__reaction img {
    width: 16px;
    height: 16px;
}

/* --- Attachments --- */
.chatlog__attachments {
    margin-top: 8px;
}

.chatlog__attachment {
    display: inline-block;
    margin-top: 4px;
}

.chatlog__attachment-img {
    max-width: min(400px, 100%);
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 16px 32px;
    max-width: 960px;
    margin: 0 auto;
}

.pagination__btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    background: var(--brand-experiment);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
    min-height: 44px;
    line-height: 1.6;
}

.pagination__btn:hover {
    background: var(--brand-experiment-hover);
    text-decoration: none;
}

.pagination__btn--disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    pointer-events: none;
}

.pagination__info {
    font-size: 14px;
    color: var(--text-muted);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* --- Discord Popup --- */
.discord-popup {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.discord-popup[hidden] {
    display: none;
}

.discord-popup__content {
    background: var(--bg-secondary);
    border-radius: 8px;
    min-width: 340px;
    max-width: 420px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: popupIn 0.15s ease-out;
    overflow: hidden;
}

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

.discord-popup__close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(0,0,0,0.4);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.discord-popup__close:hover {
    background: rgba(0,0,0,0.6);
}

.discord-popup__body {
    /* no padding here — the profile card handles layout */
}

.discord-popup__loading {
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px 20px;
    text-align: center;
}

/* --- Profile Card --- */
.profile-card {
    display: flex;
    flex-direction: column;
}

.profile-banner {
    height: 100px;
    width: 100%;
    background-size: cover;
    background-position: center;
}

.profile-header {
    position: relative;
    padding: 0 16px;
    height: 36px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 5px solid var(--bg-secondary);
    position: absolute;
    top: -44px;
    left: 16px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.profile-status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--bg-secondary);
    position: absolute;
    top: -6px;
    left: 74px;
}

.profile-status-dot--online {
    background: var(--status-green);
}

.profile-status-dot--offline {
    background: #747f8d;
}

.profile-body {
    padding: 8px 16px 16px;
}

.profile-display-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--header-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-bot-tag {
    font-size: 10px;
    font-weight: 600;
    background: #5865F2;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.profile-username {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 12px 0;
}

.profile-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-field__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--header-primary);
}

.profile-field__value {
    font-size: 13px;
    color: var(--text-normal);
    word-break: break-all;
}

.profile-field__id {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.profile-field__empty {
    color: var(--text-muted);
    font-style: italic;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.profile-badge {
    font-size: 11px;
    font-weight: 600;
    background: rgba(88, 101, 242, 0.15);
    color: #818cf8;
    padding: 2px 8px;
    border-radius: 4px;
}

.profile-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.profile-status-tag--red {
    background: rgba(237, 66, 69, 0.15);
    color: var(--status-red);
}

@media (max-width: 480px) {
    .discord-popup__content {
        min-width: 0;
        max-width: 95vw;
        margin: 0 10px;
    }
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .header__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .search {
        max-width: none;
    }

    .chatlog {
        padding: 8px;
    }

    .chatlog__message-group {
        gap: 10px;
    }

    .chatlog__avatar-col {
        width: 32px;
    }

    .chatlog__author-avatar {
        width: 32px;
        height: 32px;
    }

    .chatlog__attachment-img {
        max-width: 100%;
    }

    .pagination {
        gap: 8px;
    }

    .pagination__btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}
