/* Popup chat styles (только нужное для popup) */
.overlay_cmc_messages {
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    display: none;
}

.overlay_cmc_messages.active {
    display: flex;
}

.overlay_cmc_messages .cmc_messages_container {

    box-shadow: 0 8px 32px rgba(40, 45, 59, 0.2);
    border-radius: 16px;
    border: 2px solid #282d3b;
    padding: 10px;
    width: 600px;
    min-width: 400px;
    max-width: 90vw;
    min-height: 500px;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    filter: none;
    backdrop-filter: none;
    opacity: 1;
}

.chat_messages_container {
    background: rgba(102, 108, 124, 0.15);
    backdrop-filter: blur(12px);

    border-radius: 16px;
    border: 2px solid #282d3b;
    box-shadow: 0 4px 24px rgba(40, 45, 59, 0.13);
    padding: 32px 24px 24px 24px;
    width: 600px;
    min-width: 340px;
    max-width: 95vw;
    min-height: 340px;
    max-height: 90vh;
    position: relative;
    display: none;
    /* Скрыт по умолчанию */
    flex-direction: column;
    align-items: stretch;
    margin: 24px auto;
    box-sizing: border-box;
    font-family: 'Montserrat', Arial, sans-serif;
    gap: 0;
    opacity: 0;
    /* Начинаем с прозрачности 0 */
    transition: opacity 0.3s ease;
    /* Плавный переход */
}

/* Search container now uses PrimeReact p-field class and AutoComplete component */
/* Custom styles removed - using PrimeReact defaults with inline styles where needed */

/* Chat search input wrapper */
.chat-search-input-wrapper {
    position: relative;
    width: 100%;
}

.chat-search-input-wrapper .p-autocomplete {
    width: 100%;
    position: relative;
}

/* Ensure input takes full width */
.chat-search-input-wrapper .p-autocomplete .p-inputtext,
.chat-search-input-wrapper .p-autocomplete input {
    width: 100% !important;
    padding-right: 48px !important;
    box-sizing: border-box !important;
}

/* Toggle button inside input field - positioned inside the white input */
.chat-search-mode-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #27384d;
    font-size: 20px;
    z-index: 100;
    pointer-events: auto;
    margin: 0;
    line-height: 1;
    height: auto;
    width: auto;
}

.chat-search-mode-toggle:hover {
    opacity: 0.8;
}

.chat-search-mode-toggle:active {
    opacity: 0.6;
}

.chat-search-mode-toggle i {
    display: inline-block;
    line-height: 1;
}

/* AutoComplete panel styling for chat search */
.chat-autocomplete-panel {
    border-radius: 18px !important;
    margin-top: 4px !important;
    z-index: 1000 !important;
    box-shadow: 0 4px 24px rgba(40, 45, 59, 0.13) !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
}

/* Hide empty autocomplete panel when no search started or no results */
.chat-autocomplete-panel .p-autocomplete-items-wrapper:empty,
.chat-autocomplete-panel .p-autocomplete-items:empty,
.chat-autocomplete-panel ul#chat-search-person_list:empty {
    display: none !important;
}

/* Hide panel when list wrapper is empty or has no children */
.p-autocomplete-panel .p-autocomplete-items-wrapper[data-pc-section="listwrapper"]:empty,
.p-autocomplete-panel ul.p-autocomplete-items:empty,
.p-autocomplete-panel ul#chat-search-person_list:empty {
    display: none !important;
}

/* Hide the entire panel if it only contains empty lists */
.p-autocomplete-panel:not(:has(.p-autocomplete-item)) {
    display: none !important;
}

.chat-autocomplete-panel .p-autocomplete-item {
    padding: 8px 12px;
    border-radius: 8px;
    margin: 2px 4px;
}

.chat-autocomplete-panel .p-autocomplete-item:hover {
    background: #f4f2f2 !important;
}

.cmc_contacts_container {
    margin-top: 0;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 4px;
    /* for scrollbar space */
    flex: 1;
    min-height: 0;
}

.cmc_contacts_text {
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 12px;
    color: #27384d;

}

.cmc_contact {
    background: #fff;
    border-radius: 30px;
    margin-bottom: 16px;
    transition: background 0.2s;
    box-shadow: none;
    padding: 0;
    cursor: pointer;
}

.cmc_contact:last-child {
    margin-bottom: 0;
}

.cmc_contact:hover {
    background: #f4f2f2;
}

.cmc_contact a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #27384d;
    padding: 10px 24px 10px 10px;
    border-radius: 30px;
    transition: background 0.2s;
    box-shadow: none;
    pointer-events: none;
    /* Предотвращаем переход по ссылке */
}

.cmc_circule_photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #2c3a4b;
    margin-right: 16px;
    border: 3px solid #b9e6e6;
    flex-shrink: 0;
}

.cmc_user_name {
    font-weight: 600;
    font-size: 18px;
    margin-right: 12px;
    margin-left: 0;
    color: #27384d;
}

.cmc_last_date {
    font-size: 15px;
    color: #27384d;
    opacity: 0.8;
    margin-right: auto;
    margin-left: 0;
    padding-left: 0;
}

.cmc_send_message_button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    position: relative;
}

.cmc_send_message_button i {
    font-size: 16px;
    color: #b9a12b;
}

.cmc_send_message_button::after {
    display: none;
}

/* Оверлей для popup чата */
.chat_modal_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 92;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

/* Скрытие оверлея */
.chat_modal_overlay.hidden {
    display: none;
}

/* Скрытие контейнера чата когда overlay скрыт */
.chat_modal_overlay.hidden .chat_messages_container {
    display: none;
    opacity: 0;
    animation: fadeOut 0.2s ease-in;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Центрирование popup чата */
.chat_modal_overlay .chat_messages_container {
    position: relative;
    margin: 0;
    top: 0;
    left: 0;
    z-index: 93;
    box-shadow: 0 8px 32px rgba(40, 45, 59, 0.18);
    display: flex;
    opacity: 1;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Крестик закрытия */
.chat_messages_close_btn {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: #282d3b;
    font-size: 24px;
    cursor: pointer;
    z-index: 94;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat_messages_close_btn:hover {
    opacity: 1;
}

/* Скрыть popup по умолчанию */
.chat_modal_overlay {
    opacity: 1;
    pointer-events: auto;
}

.chat_modal_overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- TOP PANEL --- */
/* Unified back button styles */
.service-edit-back-btn {
    margin-bottom: 8px;
}

/* Back button in messages container */
.cmc_messages_container .service-edit-back-btn.cmc-messages-back-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 44px;
    height: 44px;
    background: #fff8c8 !important;
    border-radius: 50% !important;
    border: 1.5px solid #e8e8e8 !important;
    box-shadow: 0 2px 8px rgba(40, 45, 59, 0.08);
    z-index: 10;
    margin-bottom: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmc_messages_container .service-edit-back-btn.cmc-messages-back-btn:hover {
    background: #fbd551 !important;
}

.cmc_messages_container .service-edit-back-btn.cmc-messages-back-btn .p-button-icon {
    color: #282d3b;
    font-size: 20px;
}

.cmc_messages_container_close_btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: none;
    border: none;
    font-size: 2.2rem;
    color: #282d3b;
    cursor: pointer;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmc_messages_container_close_btn:hover {
    background: #ffe98a;
}

/* Back button (top left) */
.cmc_messages_left_top_button_back {
    position: absolute;
    top: 18px;
    left: 18px;
    background: none;
    border: none;
    color: #282d3b;
    cursor: pointer;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.cmc_messages_left_top_button_back:hover {
    background: #ffe98a;
}

.cmc_messages_left_top_button_back svg {
    width: 24px;
    height: 24px;
    fill: #282d3b;
    stroke: #282d3b;
}

.cmc_messages_left_top_button_back:hover svg {
    fill: #282d3b;
    stroke: #282d3b;
}

/* --- MESSAGES AREA --- */
.cmc_messages_area {
    flex: 1;
    overflow-y: auto;
    padding: 60px 0 120px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* --- MESSAGES --- */
.cmc_message_communication_container,
.cmc_message,
.cmc_message_sent {
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 75%;
    margin-bottom: 8px;
    animation: messageSlideIn 0.2s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cmc_message_communication_container {
    align-self: flex-start;
}

.cmc_message_communication_container .cmc_message_text {
    background: #e8e8e8;
}

.cmc_message_sent {
    align-self: flex-end;
}

.cmc_message_sent .cmc_message_text {
    background: #fff59d;
}

/* Grouped messages - reduce spacing */
.cmc_message_communication_container.cmc_message_grouped {
    margin-top: 2px;
    margin-bottom: 2px;
}

.cmc_message_grouped .cmc_message_sender_name {
    display: none;
}

.cmc_message_sender_name {
    font-size: 12px;
    color: #27384d;
    opacity: 0.75;
    font-weight: 600;
    margin-bottom: 4px;
    padding: 0 6px;
    letter-spacing: 0.2px;
}

.cmc_message_text {
    font-size: 15px;
    color: #27384d;
    margin-bottom: 0;
    padding: 4px 8px;
    font-weight: 400;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(40, 45, 59, 0.08);
    transition: box-shadow 0.2s ease;
}

.cmc_message_text:hover {
    box-shadow: 0 2px 4px rgba(40, 45, 59, 0.12);
}

/* Incoming messages - modern green/yellow bubble */
.cmc_message_communication_container .cmc_message_text {
    background: linear-gradient(135deg, #f0f9e8 0%, #e8f5d3 100%);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(200, 220, 180, 0.3);
}

/* Sent messages - modern light bubble */
.cmc_message_sent .cmc_message_text {
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(220, 220, 220, 0.4);
}

.cmc_message_date {
    font-size: 11px;
    color: #27384d;
    opacity: 0.6;
    margin-top: 4px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cmc_message_communication_container .cmc_message_date {
    align-self: flex-start;
}

.cmc_message_sent .cmc_message_date {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* --- STATUS ICON (галочка) --- */
.cmc_message_sent::after {
    display: none;
}

.cmc_message_status_icon {
    font-size: 13px;
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    vertical-align: baseline;
    font-family: 'Courier New', monospace;
    letter-spacing: -1px;
    transition: color 0.2s ease;
}

/* Single checkmark - sent but not read (gray) */
.cmc_message_status_icon.cmc_message_status_sent {
    color: #9ca3af;
    opacity: 0.8;
}

/* Double checkmark - read (blue/green) */
.cmc_message_status_icon.cmc_message_status_read {
    color: #3b82f6;
    opacity: 1;
}

/* --- SYSTEM MESSAGES (centered) --- */
.cmc_messages_area .cmc_message_system {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 12px auto;
    max-width: 85%;
    width: 100%;
    animation: messageSlideIn 0.2s ease-out;
    align-self: center;
}

.cmc_message_system {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 12px auto;
    max-width: 85%;
    width: 100%;
    animation: messageSlideIn 0.2s ease-out;
    align-self: center;
}

.cmc_message_system_text {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-radius: 18px;
    padding: 8px 16px;
    font-size: 14px;
    color: #856404;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.15);
    word-wrap: break-word;
    line-height: 1.5;
    width: auto;
    max-width: 100%;
}

.cmc_message_system_personal .cmc_message_system_text {
    background: #E8E8E8;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cmc_message_system .cmc_message_date {
    align-self: center;
    margin-top: 4px;
    flex-direction: row;
    gap: 4px;
    text-align: center;
}

/* --- FILE ATTACHMENTS --- */
.cmc_message_file_container {
    margin-bottom: 8px;
    max-width: 100%;
}

.cmc_message_file_link {
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 12px;
    color: #27384d;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    word-break: break-word;
    min-width: 150px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cmc_message_file_link:hover {
    background: #e0e0e0;
    text-decoration: none;
    color: #27384d;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cmc_message_file_link i {
    font-size: 16px;
    color: #6b7280;
}

/* 
 * ====================================================================
 * PENDING MAKE REQUESTS - CRITICAL COMPONENT STYLES
 * ====================================================================
 * Styles for PendingMakeRequestsBlock component
 * 
 * @component: PendingMakeRequestsBlock.tsx
 * @location: frontend/src/components/ui/PendingMakeRequestsBlock.tsx
 * @usage: Rendered in ChatMessagesDialog.tsx (line ~1520)
 * 
 * This component displays pending "Make" requests when:
 * - A user (performer) clicks "Make" on a task/service
 * - The current user (publisher) opens a chat with that performer
 * 
 * If styles stop working, check:
 * 1. Component file: frontend/src/components/ui/PendingMakeRequestsBlock.tsx
 * 2. Component usage: frontend/src/components/ui/ChatMessagesDialog.tsx
 * 3. Model: services_and_projects/models.py:1149 (PendingMakeRequest)
 * ====================================================================
 */
.cmc_pending_make_requests {
    position: absolute;
    bottom: 100px;
    left: 24px;
    right: 24px;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(40, 45, 59, 0.12);
    z-index: 11;
    box-sizing: border-box;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.cmc_pending_make_requests--collapsed {
    left: auto;
    right: 24px;
    bottom: 100px;
    width: auto;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

@keyframes cmc-arrow-nudge {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-3px); }
}

@keyframes cmc-eye-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.85; }
}

.cmc-collapsed-icon-arrow {
    animation: cmc-arrow-nudge 1.8s ease-in-out infinite;
}

.cmc-collapsed-icon-eye {
    animation: cmc-eye-pulse 2.2s ease-in-out infinite;
}

.cmc_pending_make_requests>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Service request layout - buttons below content */
.cmc_pending_make_requests>div[style*="flex-direction: column"] {
    align-items: flex-start;
}

.cmc_pending_make_requests>div[style*="flex-direction: column"]>div:first-child {
    width: 100%;
}

.cmc_pending_make_requests>div[style*="flex-direction: column"]>div:last-child {
    width: 100%;
    justify-content: flex-start;
}

.cmc_pending_make_requests>div:last-child {
    margin-bottom: 0;
}

.cmc_pending_make_requests>div>div:first-child {
    flex: 1;
}

.pending-request-title {
    font-weight: 600;
    font-size: 14px;
    color: #27384d;
    margin-bottom: 4px;
}

.pending-request-id {
    font-size: 12px;
    color: #6b7280;
}

.cmc_pending_make_requests>div>div:last-child {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cmc_pending_make_requests .p-button {
    font-size: 12px;
    padding: 6px 12px;
}

.cmc_pending_make_requests .p-button.p-button-text {
    background: transparent;
    border: none;
}

/* --- INPUT AREA --- */
.cmc_message_bottom_container {
    background: #fff;
    border-radius: 20px;
    position: absolute;
    bottom: 20px;
    left: 24px;
    right: 24px;
    padding: 5px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(40, 45, 59, 0.12);
    z-index: 10;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease;
}

.cmc_message_bottom_container:focus-within {
    box-shadow: 0 4px 16px rgba(40, 45, 59, 0.16);
}

/* PrimeReact InputTextarea overrides */
.cmc_message_bottom_container .p-inputtextarea {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
    border: none;
    outline: none;
    box-shadow: none;
    background: #ffffff;
    font-size: 16px;
    padding: 10px 8px;
    min-height: 24px;
    max-height: 120px;
    resize: none;
    font-family: inherit;
    overflow-y: auto;
    overflow-x: hidden;
    color: #27384d;
    line-height: 1.5;
    box-sizing: border-box;
    transition: none;
}

/* Plain textarea fallback (for non-React pages) */
.cmc_message_bottom_container textarea {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
    border: none;
    outline: none;
    box-shadow: none;
    background: #ffffff;
    font-size: 16px;
    padding: 10px 8px;
    min-height: 24px;
    max-height: 120px;
    resize: none;
    font-family: inherit;
    overflow-y: auto;
    overflow-x: hidden;
    color: #27384d;
    line-height: 1.5;
    box-sizing: border-box;
}

.cmc_message_bottom_container .p-inputtextarea::placeholder,
.cmc_message_bottom_container textarea::placeholder {
    color: #8a9ba8;
    opacity: 1;
    font-weight: 400;
}

.cmc_message_bottom_container .p-inputtextarea:focus,
.cmc_message_bottom_container textarea:focus {
    outline: none;
    box-shadow: none;
}

.cmc_message_bottom_container .p-inputtextarea::-webkit-scrollbar {
    width: 4px;
}

.cmc_message_bottom_container .p-inputtextarea::-webkit-scrollbar-track {
    background: transparent;
}

.cmc_message_bottom_container .p-inputtextarea::-webkit-scrollbar-thumb {
    background: rgba(40, 45, 59, 0.2);
    border-radius: 2px;
}

.cmc_message_bottom_container .p-inputtextarea::-webkit-scrollbar-thumb:hover {
    background: rgba(40, 45, 59, 0.3);
}

/* PrimeReact Button overrides */
.cmc_message_bottom_container .p-button {
    flex-shrink: 0;
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 50%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-sizing: border-box;
}

/* Plain button fallback (for non-React pages) */
.cmc_message_bottom_container button {
    flex-shrink: 0;
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 50%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-sizing: border-box;
}

.cmc_message_bottom_container .p-button:hover,
.cmc_message_bottom_container button:hover {
    background: rgba(40, 45, 59, 0.06);
    transform: scale(1.05);
}

.cmc_message_bottom_container .p-button:active,
.cmc_message_bottom_container button:active {
    background: rgba(40, 45, 59, 0.1);
    transform: scale(0.95);
}

.cmc_message_bottom_container .p-button:focus,
.cmc_message_bottom_container button:focus,
.cmc_message_bottom_container button:focus-visible {
    outline: 2px solid rgba(185, 161, 43, 0.4);
    outline-offset: 2px;
}

.cmc_message_bottom_container .p-button .p-button-icon {
    font-size: 20px;
    transition: transform 0.2s ease;
}

.cmc_message_bottom_container .p-button:hover .p-button-icon {
    transform: scale(1.1);
}

/* SVG icons in buttons */
.cmc_message_bottom_container button svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.cmc_message_bottom_container button:hover svg {
    transform: scale(1.1);
}

.cmc_message_bottom_container .cmc_message_send_button,
.cmc_message_bottom_container .cmc_message_send_button .p-button-icon,
.cmc_message_bottom_container .cmc_message_send_button svg {
    color: #b9a12b;
}

.cmc_message_bottom_container .add_file,
.cmc_message_bottom_container .add_file .p-button-icon,
.cmc_message_bottom_container .add_file svg {
    color: #27384d;
}

/* Add file menu dropdown */
.add_file_menu {
    min-width: 150px;
}

.add_file_menu .p-menuitem-link {
    padding: 0.75rem 1rem;
}

.add_file_menu .p-menuitem-icon {
    margin-right: 0.5rem;
}

/* Service edit button in dialog */
.service-item-dialog {
    position: relative;
}

.service-item-dialog:hover .service-edit-btn-dialog {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Service Area Header (in message area) */
.service-area-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 5;
    border-bottom: 1px solid rgba(40, 45, 59, 0.1);
}

.service-area-title {
    font-size: 20px;
    font-weight: 600;
    color: #27384d;
    margin: 0;
    flex: 1;
}

.service-list-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Services Dialog Styles (now used in message area) */
.services-dialog-loading,
.services-dialog-empty {
    padding: 20px;
    text-align: center;
    color: #27384d;
    opacity: 0.7;
}

.services-dialog-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px;
    max-width: 100%;
    box-sizing: border-box;
}

.service-item-dialog {
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 20px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.service-item-dialog:hover {
    background-color: #f8f9fa;
}

.service-item-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.service-item-dialog-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.service-item-dialog-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background-color: #f1f3f4;
    padding: 8px 12px;
    border-radius: 6px;
}

.service-item-dialog-price-currency {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 500;
}

.service-item-dialog-price-amount {
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 600;
}

.service-item-dialog-price-unit {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 500;
}

.service-item-dialog-description {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

.service-edit-btn-dialog {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.service-custom-item {
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 20px;
    background-color: white;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    color: #1a1a1a;
    transition: all 0.2s ease;
}

.service-custom-item:hover {
    background-color: #f8f9fa;
}

/* Service Edit Form in Message Area */
.service-edit-form-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.service-edit-back-btn {
    margin-bottom: 8px;
}

.service-edit-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.service-edit-form .form-group_stngs {
    margin-bottom: 20px;
}

.service-edit-form .form-input_stngs,
.service-edit-form .form-select_stngs,
.service-edit-form .form-textarea_stngs {
    width: 100%;
}

.service-edit-form .p-inputnumber {
    width: 100%;
}

.service-edit-form .p-inputnumber-input {
    width: 100%;
}

/* Hide reject button in ConfirmPopup for templating group */
.p-confirm-popup .p-confirm-popup-footer button.p-confirm-popup-reject,
.p-confirm-popup .p-confirm-popup-footer button:last-child:not(.p-confirm-popup-accept) {
    display: none !important;
}

/* --- SCROLLBAR --- */
.cmc_messages_area::-webkit-scrollbar {
    width: 6px;
}

.cmc_messages_area::-webkit-scrollbar-track {
    background: transparent;
}

.cmc_messages_area::-webkit-scrollbar-thumb {
    background: #e2c14b;
    border-radius: 3px;
}

.cmc_pending_make_requests::-webkit-scrollbar {
    width: 6px;
}

.cmc_pending_make_requests::-webkit-scrollbar-track {
    background: transparent;
}

.cmc_pending_make_requests::-webkit-scrollbar-thumb {
    background: #e2c14b;
    border-radius: 3px;
}

.cmc_contacts_container::-webkit-scrollbar {
    width: 6px;
}

.cmc_contacts_container::-webkit-scrollbar-thumb {
    background: #e2c14b;
    border-radius: 3px;
}

.cmc_contacts_container::-webkit-scrollbar-track {
    background: transparent;
}

/* --- Оверлей для popup чата с размытием и затемнением --- */


/* Desktop: Fixed width for all chat containers */
@media (min-width: 601px) {
    .cmc_messages_container {
        width: 600px;
        max-width: 600px;
    }

    .chat_messages_container {
        width: 600px;
        max-width: 600px;
    }

    .overlay_cmc_messages .cmc_messages_container {
        width: 600px;
        max-width: 600px;
    }
}

/* Mobile: Responsive width */
@media (max-width: 600px) {
    .cmc_messages_container {
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        padding: 16px;
        min-height: 400px;
    }

    .chat_messages_container {
        width: 100%;
        max-width: 95vw;
    }

    .overlay_cmc_messages .cmc_messages_container {
        width: 100%;
        min-width: 95vw;
        max-width: 95vw;
        padding: 16px;
    }

    .cmc_message_text {
        font-size: 14px;
        padding: 12px 16px;
    }

    .cmc_message_bottom_container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    /* Уменьшаем размер изображений на мобильных */
    .cmc_message_image {
        max-height: 200px;
        max-width: 85%;
    }

    /* Уменьшаем размер файловых ссылок на мобильных */
    .cmc_message_file_link {
        padding: 10px 12px;
        font-size: 13px;
        min-width: 120px;
    }

    .cmc_message_file_container {
        margin-bottom: 6px;
    }
}

/* Override button styles in chat service forms - loaded last to override PrimeReact */
.cmc_messages_area .form-actions_stngs .cancel-btn_stngs,
.cmc_messages_area .form-actions_stngs .cancel-btn_stngs.p-button,
.cmc_messages_area .form-actions_stngs .cancel-btn_stngs.p-button .p-button-label {
    background-color: #282D3B !important;
    color: white !important;
    border: none !important;
}

.cmc_messages_area .form-actions_stngs .cancel-btn_stngs:hover,
.cmc_messages_area .form-actions_stngs .cancel-btn_stngs.p-button:hover {
    background-color: #1a1d26 !important;
    color: white !important;
}

.cmc_messages_area .form-actions_stngs .duplicate-btn_stngs,
.cmc_messages_area .form-actions_stngs .duplicate-btn_stngs.p-button,
.cmc_messages_area .form-actions_stngs .duplicate-btn_stngs.p-button .p-button-label {
    background-color: #282D3B !important;
    color: white !important;
    border: none !important;
}

.cmc_messages_area .form-actions_stngs .duplicate-btn_stngs:hover,
.cmc_messages_area .form-actions_stngs .duplicate-btn_stngs.p-button:hover {
    background-color: #1a1d26 !important;
    color: white !important;
}

.cmc_messages_area .form-actions_stngs .save-btn_stngs,
.cmc_messages_area .form-actions_stngs .save-btn_stngs.p-button,
.cmc_messages_area .form-actions_stngs .save-btn_stngs.p-button .p-button-label {
    background-color: #282D3B !important;
    color: white !important;
    border: none !important;
}

.cmc_messages_area .form-actions_stngs .save-btn_stngs:hover,
.cmc_messages_area .form-actions_stngs .save-btn_stngs.p-button:hover {
    background-color: #1a1d26 !important;
    color: white !important;
}

/* Read-only field styles */
.readonly-field_stngs {
    background-color: #f5f5f5;
    cursor: not-allowed;
    color: #6b7280;
}

.verification-link_stngs {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.verification-link_stngs:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Pending request action buttons underline hover animation */
.pending-request-action-btn {
    position: relative;
    overflow: hidden;
}

.pending-request-action-btn::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 1.5px;
    background-color: #27384d;
    transition: width 0.25s ease, left 0.25s ease;
    transform: translateX(-50%);
}

.pending-request-action-btn:hover::after {
    width: calc(100% - 16px);
    left: 50%;
}

.pending-request-action-btn--decline::after {
    background-color: #dc2626;
}