/* ===================================================================
   Discord Bridge — Page Styles
   Matches Askcraft dark theme (#181818 bg, #b1afac text, #ff9800 accent)
   =================================================================== */

.discord-container {
    display: flex;
    max-width: 1400px;
    margin: 30px auto;
    height: calc(100vh - 200px);
    min-height: 500px;
    border-radius: 12px;
    overflow: hidden;
    background: #1e1e1e;
    border: 1px solid rgba(177, 175, 172, 0.15);
}

/* ---- Sidebar (channel list) ---- */

.discord-sidebar {
    width: 260px;
    min-width: 260px;
    background: #1a1a1a;
    border-right: 1px solid rgba(177, 175, 172, 0.1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.discord-sidebar-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(177, 175, 172, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.discord-sidebar-header i {
    font-size: 22px;
    color: #7289da;
}

.discord-sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-family: 'JL', sans-serif;
    color: #fff;
    letter-spacing: 0.02em;
}

.discord-sidebar-channels {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.discord-category {
    margin-top: 8px;
}

.discord-category-name {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(177, 175, 172, 0.5);
    cursor: default;
    user-select: none;
}

.discord-category-name i {
    font-size: 9px;
    margin-right: 4px;
    transition: transform 0.2s;
}

.discord-channel {
    display: flex;
    align-items: center;
    padding: 7px 16px 7px 24px;
    cursor: pointer;
    color: rgba(177, 175, 172, 0.6);
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    border-radius: 4px;
    margin: 1px 8px;
}

.discord-channel:hover {
    background: rgba(177, 175, 172, 0.08);
    color: #b1afac;
}

.discord-channel.active {
    background: rgba(255, 152, 0, 0.12);
    color: #fff;
}

.discord-channel i {
    margin-right: 8px;
    font-size: 16px;
    opacity: 0.6;
}

.discord-channel.active i {
    opacity: 1;
    color: #ff9800;
}

/* ---- Main chat area ---- */

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

.discord-chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(177, 175, 172, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1e1e1e;
}

.discord-chat-header .channel-icon {
    color: rgba(177, 175, 172, 0.4);
    font-size: 20px;
}

.discord-chat-header .channel-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.discord-chat-header .channel-topic {
    font-size: 13px;
    color: rgba(177, 175, 172, 0.5);
    margin-left: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Messages area ---- */

.discord-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.discord-messages-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(177, 175, 172, 0.3);
    font-size: 15px;
}

.discord-load-more {
    text-align: center;
    padding: 10px;
}

.discord-load-more button {
    background: none;
    border: 1px solid rgba(177, 175, 172, 0.2);
    color: rgba(177, 175, 172, 0.5);
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: border-color 0.2s, color 0.2s;
}

.discord-load-more button:hover {
    border-color: #ff9800;
    color: #ff9800;
}

/* ---- Message row ---- */

.discord-msg {
    display: flex;
    padding: 4px 0;
    position: relative;
    border-radius: 4px;
}

.discord-msg:hover {
    background: rgba(177, 175, 172, 0.03);
}

.discord-msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.discord-msg-compact .discord-msg-avatar {
    visibility: hidden;
    width: 40px;
    margin-right: 12px;
}

.discord-msg-body {
    flex: 1;
    min-width: 0;
}

.discord-msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.discord-msg-author {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.discord-msg-author.bot {
    color: #7289da;
}

.discord-msg-bot-tag {
    background: #7289da;
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.discord-msg-time {
    font-size: 11px;
    color: rgba(177, 175, 172, 0.35);
}

.discord-msg-compact .discord-msg-header {
    display: none;
}

.discord-msg-content {
    color: #b1afac;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.discord-msg-reply-ref {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(177, 175, 172, 0.4);
    margin-bottom: 4px;
    padding-left: 2px;
}

.discord-msg-reply-ref i {
    font-size: 10px;
}

.discord-msg-reply-ref .reply-author {
    font-weight: 600;
    color: rgba(177, 175, 172, 0.6);
}

.discord-msg-attachments {
    margin-top: 6px;
}

.discord-msg-attachments img {
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
}

.discord-msg-attachments a {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(177, 175, 172, 0.08);
    border-radius: 4px;
    color: #7289da;
    font-size: 13px;
    text-decoration: none;
    margin-top: 4px;
}

.discord-msg-attachments a:hover {
    background: rgba(177, 175, 172, 0.15);
}

/* ---- Message actions (delete, reply) ---- */

.discord-msg-actions {
    position: absolute;
    top: -8px;
    right: 8px;
    display: none;
    gap: 4px;
    background: #2a2a2a;
    border: 1px solid rgba(177, 175, 172, 0.15);
    border-radius: 4px;
    padding: 2px;
}

.discord-msg:hover .discord-msg-actions {
    display: flex;
}

.discord-msg-actions button {
    background: none;
    border: none;
    color: rgba(177, 175, 172, 0.5);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.discord-msg-actions button:hover {
    background: rgba(177, 175, 172, 0.1);
    color: #fff;
}

.discord-msg-actions button.btn-delete:hover {
    color: #f44336;
}

/* ---- Input area ---- */

.discord-input-area {
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(177, 175, 172, 0.1);
    background: #1e1e1e;
}

.discord-input-reply {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: rgba(255, 152, 0, 0.08);
    border-radius: 6px;
    font-size: 13px;
    color: rgba(177, 175, 172, 0.6);
}

.discord-input-reply.active {
    display: flex;
}

.discord-input-reply .reply-close {
    margin-left: auto;
    cursor: pointer;
    color: rgba(177, 175, 172, 0.4);
    padding: 2px 6px;
}

.discord-input-reply .reply-close:hover {
    color: #f44336;
}

.discord-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #2a2a2a;
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(177, 175, 172, 0.1);
    transition: border-color 0.2s;
}

.discord-input-wrapper:focus-within {
    border-color: rgba(255, 152, 0, 0.4);
}

.discord-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #b1afac;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    line-height: 1.4;
}

.discord-input-wrapper textarea::placeholder {
    color: rgba(177, 175, 172, 0.3);
}

.discord-input-wrapper .btn-send {
    background: #ff9800;
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.discord-input-wrapper .btn-send:hover {
    background: #e68a00;
}

.discord-input-wrapper .btn-send:disabled {
    background: rgba(177, 175, 172, 0.15);
    cursor: default;
}

.discord-login-prompt {
    padding: 14px 20px;
    text-align: center;
    color: rgba(177, 175, 172, 0.5);
    font-size: 14px;
    border-top: 1px solid rgba(177, 175, 172, 0.1);
}

.discord-login-prompt a {
    color: #ff9800;
    text-decoration: none;
}

.discord-login-prompt a:hover {
    text-decoration: underline;
}

/* ---- Threads panel ---- */

.discord-threads-panel {
    width: 280px;
    min-width: 280px;
    background: #1a1a1a;
    border-left: 1px solid rgba(177, 175, 172, 0.1);
    overflow-y: auto;
    display: none;
}

.discord-threads-panel.active {
    display: block;
}

.discord-threads-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(177, 175, 172, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.discord-threads-header h4 {
    margin: 0;
    font-size: 14px;
    color: #fff;
}

.discord-threads-header .close-threads {
    cursor: pointer;
    color: rgba(177, 175, 172, 0.4);
    font-size: 16px;
}

.discord-thread-item {
    padding: 10px 16px;
    cursor: pointer;
    color: rgba(177, 175, 172, 0.6);
    font-size: 13px;
    border-bottom: 1px solid rgba(177, 175, 172, 0.05);
    transition: background 0.15s;
}

.discord-thread-item:hover {
    background: rgba(177, 175, 172, 0.06);
    color: #b1afac;
}

.discord-thread-item.active {
    background: rgba(255, 152, 0, 0.1);
    color: #fff;
}

.discord-thread-item .thread-name {
    font-weight: 600;
}

.discord-thread-item .thread-meta {
    font-size: 11px;
    color: rgba(177, 175, 172, 0.35);
    margin-top: 2px;
}

/* ---- Scrollbar styling ---- */

.discord-sidebar::-webkit-scrollbar,
.discord-messages::-webkit-scrollbar,
.discord-threads-panel::-webkit-scrollbar {
    width: 6px;
}

.discord-sidebar::-webkit-scrollbar-track,
.discord-messages::-webkit-scrollbar-track,
.discord-threads-panel::-webkit-scrollbar-track {
    background: transparent;
}

.discord-sidebar::-webkit-scrollbar-thumb,
.discord-messages::-webkit-scrollbar-thumb,
.discord-threads-panel::-webkit-scrollbar-thumb {
    background: rgba(177, 175, 172, 0.15);
    border-radius: 3px;
}

.discord-sidebar::-webkit-scrollbar-thumb:hover,
.discord-messages::-webkit-scrollbar-thumb:hover,
.discord-threads-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(177, 175, 172, 0.3);
}

/* ---- Responsive ---- */

@media (max-width: 992px) {
    .discord-container {
        margin: 10px;
        height: calc(100vh - 140px);
    }

    .discord-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .discord-threads-panel {
        width: 240px;
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .discord-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 140px);
    }

    .discord-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid rgba(177, 175, 172, 0.1);
    }

    .discord-sidebar-channels {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px;
        gap: 4px;
    }

    .discord-category {
        display: none;
    }

    .discord-channel {
        margin: 0;
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 13px;
    }

    .discord-main {
        min-height: 400px;
    }

    .discord-threads-panel {
        width: 100%;
        min-width: 100%;
        border-left: none;
        border-top: 1px solid rgba(177, 175, 172, 0.1);
        max-height: 200px;
    }

    .discord-msg-attachments img {
        max-width: 100%;
    }
}
