/* Message Actions */
.message {
    position: relative;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions {
    position: absolute;
    top: -10px;
    right: 10px;
    background: #2b2d31;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: flex;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 10;
}

.action-btn {
    padding: 6px 8px;
    color: #b5bac1;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.action-btn.delete:hover {
    background: #da373c;
    color: #fff;
}

.edit-input {
    width: 100%;
    background: #383a40;
    border: none;
    border-radius: 4px;
    padding: 8px;
    color: #dbdee1;
    margin-top: 5px;
    outline: none;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: var(--bg-charcoal);
}

.server-list {
    width: var(--server-list-width);
    background-color: var(--bg-charcoal-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    flex-shrink: 0;
}

.server-icon-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.server-icon {
    width: 100%;
    height: 100%;
    cursor: pointer;
    background: var(--bg-charcoal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-radius 0.2s, background-color 0.2s;
    overflow: hidden;
}

.server-icon:hover,
.server-icon.active {
    border-radius: 16px;
    background-color: var(--primary);
}

/* Member Sidebar */
.member-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-charcoal);
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.member-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.member-item {
    padding: 6px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: default;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.member-item.offline {
    opacity: 0.45;
    filter: grayscale(0.5);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-online {
    background: #3ba55d;
}

.status-idle {
    background: #faa61a;
}

.status-dnd {
    background: #ed4245;
}

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

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    /* Made more transparent */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    /* Blur the background for glassy effect */
}

.modal {
    background: rgba(43, 45, 49, 0.8);
    /* Semi-transparent background */
    width: 100%;
    max-width: 440px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    backdrop-filter: blur(12px);
    /* Stronger blur inside the modal */
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle border for glass effect */
}

.modal-header {
    padding: 16px;
    background: rgba(30, 31, 34, 0.4);
    /* Transparent header */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-body {
    padding: 24px;
}

.close-modal {
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--text-gray);
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #fff;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #18191c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

.context-item {
    padding: 8px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #dbdee1;
}

.context-item:hover {
    background: var(--primary);
    color: #fff;
}

.context-item.delete:hover {
    background: #da373c;
    color: #fff;
}

/* Cleanup existing message styles */
.message-actions .action-btn[title="Copy ID"] {
    display: none !important;
}

.admin-badge {
    display: none !important;
}

:root {
    --primary: #FD802E;
    --primary-light: #ff9d5c;
    --primary-dark: #c95d12;
    --bg-charcoal: #233D4C;
    --bg-charcoal-light: #315569;
    --bg-charcoal-dark: #162630;
    --text-white: #FFFFFF;
    --text-gray: #B9BBBE;
    --danger: #ED4245;
    --success: #3BA55D;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --sidebar-width: 240px;
    --server-list-width: 72px;
    --transition-speed: 0.2s;
}

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

body {
    background-color: var(--bg-charcoal-dark);
    color: var(--text-white);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
}

.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-charcoal-dark) 0%, var(--bg-charcoal) 100%);
    padding: 2rem;
}

.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.logo {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-gray);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    background: var(--bg-charcoal-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color var(--transition-speed);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s, background-color var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-light);
}

.btn-primary:active {
    transform: scale(0.98);
}

.session-key-display {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.8rem;
    word-break: break-all;
    margin-top: 0.5rem;
    border: 1px dashed var(--primary);
    color: var(--primary-light);
}

.hidden {
    display: none !important;
}

/* Connection Preview Styles */
.preview-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.server-preview-card,
.user-preview-card {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.pfp-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-charcoal);
    margin: 0 auto 1rem;
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: var(--bg-charcoal);
}

.server-list {
    width: var(--server-list-width);
    background-color: var(--bg-charcoal-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    flex-shrink: 0;
}

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-charcoal);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-radius 0.2s, background-color 0.2s;
}

.server-icon:hover,
.server-icon.active {
    border-radius: 16px;
    background-color: var(--primary);
}

.add-server-btn {
    background-color: var(--success) !important;
    margin-top: auto;
    margin-bottom: 8px;
    font-size: 1.5rem !important;
}

.channel-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-charcoal);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-weight: 700;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    font-family: var(--font-heading);
}

.channel-scroller {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.channel-item {
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 500;
}

.channel-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.channel-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.user-panel {
    height: 52px;
    background-color: var(--bg-charcoal-dark);
    padding: 0 8px;
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 4px;
    flex: 1;
}

.pfp-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-charcoal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 1px solid var(--primary);
}

.user-details {
    overflow: hidden;
}

.user-name-small {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-hash-small {
    font-size: 0.65rem;
    color: var(--text-gray);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-charcoal);
    min-width: 0;
}

.content-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    font-weight: 600;
    gap: 8px;
}

.hash-symbol {
    color: var(--text-gray);
    font-size: 1.5rem;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.message-scroller {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 16px;
}

.msg-pfp {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-charcoal-light);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-content {
    flex: 1;
}

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

.msg-author {
    font-weight: 600;
}

.msg-time {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.input-area {
    padding: 0 16px 24px;
}

.input-wrapper {
    background-color: var(--bg-charcoal-light);
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    /* Align to bottom for multiline */
    padding: 10px 16px;
    min-height: 44px;
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-white);
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 2px 0;
    max-height: 200px;
    overflow-y: auto;
}

/* Markdown Styling within messages */
.msg-text h1 {
    font-size: 1.5rem;
    margin: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.msg-text h2 {
    font-size: 1.3rem;
    margin: 6px 0;
}

.msg-text h3 {
    font-size: 1.1rem;
    margin: 4px 0;
}

.msg-text b,
.msg-text strong {
    font-weight: bold;
}

.msg-text i,
.msg-text em {
    font-style: italic;
}

.msg-text a {
    color: var(--primary);
    text-decoration: none;
}

.msg-text a:hover {
    text-decoration: underline;
}

.msg-text p {
    margin: 4px 0;
}

.msg-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.plus-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-white);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-white);
    outline: none;
}

.html-view,
.voice-view {
    flex: 1;
    min-height: 0;
}

#html-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.add-channel-btn {
    color: var(--text-gray);
    transition: color 0.2s;
    font-weight: bold;
}

.add-channel-btn:hover {
    color: #fff;
}

/* Voice Channel Styling */
.voice-view {
    position: relative;
    height: 100%;
}

.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px;
    height: calc(100% - 80px);
    /* Leave room for controls */
    overflow-y: auto;
}

.voice-participant {
    background: #1e1f22;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/9;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-participant:hover {
    box-shadow: 0 0 0 2px var(--primary);
}

.voice-participant.expanded {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 50;
    aspect-ratio: auto;
    background: #000;
}

.voice-participant video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voice-participant.expanded video {
    object-fit: contain;
}

.participant-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 60;
    /* Above expanded video */
}

.voice-controls {
    height: 80px;
    background: #1e1f22;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.btn-voice {
    background: #313338;
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-voice:hover {
    background: #4e5058;
}

.btn-voice.off {
    background: #da373c;
}

.btn-voice.btn-danger {
    background: #da373c;
}

.btn-voice.btn-danger:hover {
    background: #a1282b;
}

/* Sidebar Voice Participants */
.voice-participant-list {
    margin-top: 4px;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.voice-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.voice-user .status-indicator {
    width: 6px;
    height: 6px;
    background: #23a559;
    border-radius: 50%;
}