/* ------------------------------------------------------------------
   chat.css — Discord Dark Theme UI (Full Screen Edition)
   - Stretches to 100% width and full height
   - Escapes outer card max-width constraints
   - Responsive & scrollable
------------------------------------------------------------------- */

/* --- Custom Slim Discord Scrollbar --- */
.discord-channels::-webkit-scrollbar,
.discord-messages::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.discord-channels::-webkit-scrollbar-track,
.discord-messages::-webkit-scrollbar-track {
    background: #2b2d31;
}
.discord-channels::-webkit-scrollbar-thumb,
.discord-messages::-webkit-scrollbar-thumb {
    background: #1a1b1e;
    border-radius: 4px;
}
.discord-channels::-webkit-scrollbar-thumb:hover,
.discord-messages::-webkit-scrollbar-thumb:hover {
    background: #111214;
}

/* Break out of any parent max-width containers (e.g. .container, .card, etc.) */
#admin-chat-mount,
#client-chat-mount {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

#chat-page,
#admin-page {
    max-width: none;
}

#chat-page {
    padding: 0;
}

#chat-page .discord-card,
#admin-chat-mount .discord-card {
    border-radius: 0;
}

#admin-page {
    display: block;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
}

#admin-page > .admin-tabs {
    padding-right: 20px;
    padding-left: 20px;
}

#admin-tab-conversations {
    min-height: 0;
}

#admin-chat-mount {
    height: calc(100dvh - 113px);
}

#admin-chat-mount .discord-layout {
    height: calc(100dvh - 113px) !important;
    min-height: 0 !important;
    max-height: none !important;
}

.discord-friends-icon {
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}
.discord-friends-icon svg {
    width: 18px;
    height: 18px;
}


#admin-chat-mount p,
#admin-chat-mount span,
#client-chat-mount p,
#client-chat-mount span {
    color: #ffffff !important;
}

#admin-page > .admin-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    margin: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    background: #313338;
    border-top: 1px solid #202225;
    border-bottom: 1px solid #202225;
    box-sizing: border-box;
}

#admin-page > .admin-tabs .admin-tab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#admin-page > .admin-tabs .admin-tab:hover {
    background: #ffffff;
    border-color: #c5ceca;
}

#admin-page > .admin-tabs .admin-tab.active {
    background: #e11d48;
    border-color: #e11d48;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.22);
}

#admin-page > .admin-tabs .admin-tab:focus-visible {
    outline: 2px solid #004823 !important;
    outline-offset: 2px;
}

@media (max-width: 600px) {
    #admin-page > .admin-tabs {
        gap: 4px;
        padding-right: 10px;
        padding-left: 10px;
    }

    #admin-page > .admin-tabs .admin-tab {
        flex: 1;
        padding: 0 8px;
        font-size: 12px;
    }
}

/* --- Base Container (Full Bleed / Edge to Edge) --- */
.discord-card {
    background: #313338 !important;
    border: 1px solid #202225 !important;
    border-radius: 8px;
    overflow: hidden;
    color: #dbdee1;
    font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.discord-layout {
    display: flex;
    width: 100%;
    height: calc(100dvh - 57px);
    min-height: 0;
    max-height: none;
    background: #313338;
}

/* --- Left Sidebar (Direct Messages List) --- */
.discord-sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: #2b2d31;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #202225;
}

.discord-search-box {
    padding: 10px;
    border-bottom: 1px solid #202225;
}

.discord-search-box input {
    width: 100%;
    box-sizing: border-box;
    background: #1e1f22 !important;
    border: none !important;
    border-radius: 4px;
    color: #dbdee1 !important;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
}
.discord-search-box input::placeholder {
    color: #949ba4;
}

.discord-sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 8px 4px 8px;
    gap: 2px;
}

.discord-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    color: #949ba4;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}
.discord-nav-item:hover {
    background: #35373c;
    color: #dbdee1;
}
.discord-nav-item.active {
    background: #404249;
    color: #ffffff;
}

.discord-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 4px 14px;
    color: #949ba4;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.discord-section-header button {
    background: none;
    border: none;
    color: #949ba4;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
}
.discord-section-header button:hover {
    color: #dbdee1;
}

.discord-channels {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.discord-empty {
    color: #949ba4;
    font-size: 13px;
    padding: 20px 12px;
    text-align: center;
}

/* --- DM Channel Row --- */
.discord-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    color: #949ba4;
    transition: background 0.15s ease, color 0.15s ease;
}
.discord-channel:hover {
    background: #35373c;
    color: #dbdee1;
}
.discord-channel.active {
    background: #404249;
    color: #ffffff;
}

.discord-channel-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.discord-channel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.discord-channel-name {
    font-size: 14px;
    font-weight: 600;
    color: #f2f3f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.discord-channel.active .discord-channel-name {
    color: #ffffff;
}

.discord-channel-preview {
    font-size: 12px;
    color: #949ba4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Avatars with Status Indicators --- */
.discord-avatar-wrap {
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
}

.discord-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5865F2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    user-select: none;
}
.discord-avatar.admin-bot {
    background: #23a55a;
}
.discord-avatar.lg {
    width: 72px;
    height: 72px;
    font-size: 26px;
}

.discord-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 3px solid #2b2d31;
    background: #80848e;
}
.discord-channel.active .discord-status-dot {
    border-color: #404249;
}
.discord-status-dot.online { background: #23a55a; }
.discord-status-dot.idle   { background: #f0b232; }
.discord-status-dot.dnd    { background: #f23f43; }

/* Unread Badge */
.discord-badge {
    background: #f23f43;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 14px;
}

/* --- Main Chat Content Area --- */
.discord-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #313338;
}

.discord-main-header {
    height: 52px;
    border-bottom: 1px solid #202225;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: #313338;
}

.discord-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.discord-at-sign {
    color: #80848e;
    font-size: 24px;
    font-weight: 600;
}
.discord-header-name {
    font-size: 16px;
    font-weight: 700;
    color: #f2f3f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.discord-tag {
    background: #5865F2;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}
.discord-header-sub {
    font-size: 13px;
    color: #949ba4;
    margin-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discord-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.discord-header-search {
    background: #1e1f22;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 4px 10px;
    color: #949ba4;
    font-size: 13px;
}
.discord-header-search input {
    background: transparent;
    border: none;
    color: #dbdee1;
    font-size: 13px;
    outline: none;
    width: 140px;
}

/* --- Messages List --- */
.discord-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Initial DM greeting hero */
.discord-thread-start {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px 0 16px 0;
    border-bottom: 1px solid #3f4147;
    margin-bottom: 12px;
}
.discord-thread-start h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: #f2f3f5;
}
.discord-thread-start p {
    margin: 0;
    color: #949ba4;
    font-size: 14px;
}

/* Message item */
.discord-msg {
    display: flex;
    gap: 16px;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.1s ease;
}
.discord-msg:hover {
    background: #2e3035;
}

.discord-msg-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.discord-msg-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.discord-msg-author {
    font-size: 15px;
    font-weight: 700;
    color: #f2f3f5;
    cursor: pointer;
}
.discord-msg-author:hover {
    text-decoration: underline;
}
.discord-msg-time {
    font-size: 12px;
    color: #949ba4;
}
.discord-msg-body {
    font-size: 14px;
    color: #dbdee1;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.discord-msg-body a {
    color: #00a8fc;
    text-decoration: none;
    word-break: break-all;
}
.discord-msg-body a:hover {
    text-decoration: underline;
}

/* --- Chat Input Box --- */
.discord-input-container {
    padding: 0 20px 20px 20px;
}

.discord-input-box {
    background: #383a40;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 4px 14px;
    gap: 12px;
}

.discord-plus-btn {
    width: 26px;
    height: 26px;
    background: #4e5058;
    color: #dbdee1;
    border-radius: 50%;
    border: none;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.discord-plus-btn:hover {
    background: #6d6f78;
    color: #ffffff;
}

.discord-input-box input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #dbdee1 !important;
    font-size: 14px;
    padding: 10px 0;
}
.discord-input-box input::placeholder {
    color: #80848e;
}

.discord-send-btn {
    background: #5865F2;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.discord-send-btn:hover:not(:disabled) {
    background: #4752c4;
}
.discord-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Attachments (+ button uploads) --- */
.discord-pending {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    color: #dbdee1;
    font-size: 13px;
    padding: 8px 12px;
    margin-bottom: 8px;
}
.discord-pending.hidden { display: none; }
.discord-pending button {
    background: transparent;
    border: none;
    color: #949ba4;
    cursor: pointer;
    font-size: 14px;
}
.discord-pending button:hover { color: #fff; }

.discord-attach { margin-top: 8px; max-width: 420px; }
.discord-attach-img {
    display: block;
    max-width: 320px;
    max-height: 240px;
    width: auto;
    border-radius: 8px;
    border: 1px solid #1e1f22;
    object-fit: cover;
}
.discord-attach-name {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    color: #c4c9ce !important;
    word-break: break-all;
}
a.discord-attach-name:hover { color: #fff !important; }
.discord-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #dbdee1 !important;
    text-decoration: none;
    max-width: 100%;
}
.discord-file-chip:hover { background: #35373c; }
.discord-file-icon { font-size: 18px; }
.discord-attach-size { color: #949ba4; font-size: 12px; }

.hidden { display: none !important; }

/* Small utility buttons */
.discord-icon-btn {
    background: transparent;
    border: none;
    color: #b5bac1;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.discord-icon-btn:hover {
    background: #35373c;
    color: #dbdee1;
}

/* Backwards compatibility */
.chat-unread {
    background: #f23f43;
    color: #fff !important;
    font-size: 10px;
    font-weight: bold;
    border-radius: 999px;
    padding: 1px 7px;
}

@media (max-width: 768px) {
    .discord-layout {
        flex-direction: column;
        height: auto;
        min-height: 500px;
    }
    .discord-sidebar {
        width: 100%;
        flex: 0 0 220px;
    }
}

/* Account / affiliate filter dropdowns — white text */
.discord-account-filter select {
    color: #ffffff !important;
}
.discord-account-filter select option {
    background-color: #1e1f22;
    color: #ffffff;
}