/* Communications Portal Specific CSS */

.comms-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.comms-header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-back:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
    color: var(--text-dark);
}

.comms-title-group {
    display: flex;
    flex-direction: column;
}

.comms-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}

.comms-subtitle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6B7280;
    font-size: 1rem;
    margin: 0;
}

.badge-crypto {
    background-color: #ECFDF5;
    color: #005F54;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #D1FAE5;
}

.btn-compose {
    background: #2563EB;
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-compose:hover {
    background: #1D4ED8;
}

.comms-inbox-container {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.empty-inbox-icon {
    width: 64px;
    height: 64px;
    background: #F8FAFC;
    color: #CBD5E1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.empty-inbox-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 0.75rem 0;
}

.empty-inbox-desc {
    color: #64748B;
    font-size: 1.125rem;
    margin: 0;
}

/* Compose Message UI */
.btn-cancel-compose {
    background: var(--white);
    color: #1E293B;
    border: 1px solid #3B82F6;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-cancel-compose:hover {
    background: #F8FAFC;
    border-color: #2563EB;
}

.compose-container {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.compose-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 2rem 0;
}

.compose-form-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: #F8FAFC;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1E293B;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #3B82F6;
    background: var(--white);
}

.form-input::placeholder {
    color: #475569;
}

.media-upload-box {
    width: 100%;
    padding: 1rem;
    border: 1px dashed #CBD5E1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #64748B;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    background: var(--white);
    transition: all 0.2s;
}

.media-upload-box:hover {
    border-color: #94A3B8;
    background: #F8FAFC;
}

.rtf-editor-container {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
    background: var(--white);
    margin-bottom: 1.5rem;
}

.rtf-toolbar {
    background: #F8FAFC;
    border-bottom: 1px solid #E5E7EB;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #475569;
}

.rtf-dropdown {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1E293B;
    cursor: pointer;
}

.rtf-btn-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.rtf-btn {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.rtf-btn:hover {
    color: #1E293B;
}

.rtf-textarea {
    width: 100%;
    min-height: 250px;
    padding: 1.5rem;
    border: none;
    resize: vertical;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    color: #1E293B;
    background: transparent;
}

.rtf-textarea:focus {
    outline: none;
}

.rtf-textarea::placeholder {
    color: #64748B;
    font-style: italic;
}

.compose-footer {
    display: flex;
    justify-content: flex-end;
}

.btn-send-message {
    background: #88AEE8;
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-send-message:hover {
    background: #3B82F6;
}

/* Inbox List */
.message-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-item {
    background: var(--white);
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.message-item:hover {
    border-color: #3B82F6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.message-item.unread {
    background: #F8FAFC;
    border-left: 4px solid #3B82F6;
}

.message-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #EEF2FF;
    color: #4F46E5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.message-summary {
    flex: 1;
    min-width: 0;
}

.message-summary h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 700;
}

.message-subject {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: #1E293B;
    font-weight: 600;
}

.message-preview {
    margin: 0;
    font-size: 0.875rem;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.message-date {
    font-size: 0.75rem;
    color: #94A3B8;
    font-weight: 600;
}

/* Thread View */
.thread-container {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 2rem;
}

.thread-header {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #F8FAFC;
}

.thread-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-dark);
    font-weight: 800;
}

.thread-messages {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #F8FAFC;
    max-height: 500px;
    overflow-y: auto;
}

.chat-message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
}

.chat-message.received {
    align-self: flex-start;
}

.chat-message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E5E7EB;
    color: #4B5563;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-message.sent .chat-avatar {
    background: #DBEAFE;
    color: #1D4ED8;
}

.chat-bubble {
    background: var(--white);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    word-break: break-word;
}

.chat-message.received .chat-bubble {
    border-top-left-radius: 4px;
}

.chat-message.sent .chat-bubble {
    background: #2563EB;
    color: var(--white);
    border-color: #2563EB;
    border-top-right-radius: 4px;
}

.chat-bubble p {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-time {
    font-size: 0.7rem;
    color: #94A3B8;
    display: block;
    text-align: right;
    margin-top: 0.5rem;
}

.chat-message.sent .chat-time {
    color: #BFDBFE;
}

.thread-reply {
    padding: 1.5rem;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 1rem;
    background: var(--white);
}

.thread-reply .form-input {
    flex: 1;
}

.btn-send-reply {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #2563EB;
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-send-reply:hover {
    background: #1D4ED8;
}

.btn-send-reply:disabled {
    background: #93C5FD;
    cursor: not-allowed;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 1024px) {
    .comms-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .comms-title {
        font-size: 1.5rem;
    }

    .btn-compose,
    .btn-cancel-compose {
        width: 100%;
        justify-content: center;
    }

    .comms-inbox-container {
        padding: 2rem;
    }

    .compose-container {
        padding: 1.5rem;
    }

    .compose-form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .rtf-toolbar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .chat-message {
        max-width: 95%;
        /* Give chat bubbles more room on narrow screens */
    }

    .thread-header h2 {
        font-size: 1.1rem;
    }
}