/* =====================================================
   ROYALE2 MARKET - MESAJ MERKEZİ
   ACCOUNT PANEL UYUMLU PROFESYONEL TASARIM
   ===================================================== */

.messages-page {
    min-height: calc(100vh - 74px);
    padding: 34px 24px 50px;
    box-sizing: border-box;

    color: #f5f0e8;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(193, 126, 31, 0.10),
            transparent 38%
        ),
        transparent;
}

.messages-page *,
.messages-page *::before,
.messages-page *::after {
    box-sizing: border-box;
}


/* =====================================================
   ANA MESAJ MERKEZİ
   ===================================================== */

.messages-page .messages-container {
    position: relative;

    width: min(1420px, calc(100% - 20px));
    height: calc(100vh - 145px);
    min-height: 650px;
    max-height: 860px;

    margin: 0 auto;

    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);

    background:
        linear-gradient(
            145deg,
            rgba(22, 19, 15, 0.985),
            rgba(10, 10, 9, 0.99)
        );

    border: 1px solid rgba(197, 137, 45, 0.22);
    border-radius: 18px;

    overflow: hidden;

    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.46),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.messages-page .messages-container::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    height: 1px;

    background: linear-gradient(
        90deg,
        transparent,
        rgba(230, 168, 65, 0.7),
        transparent
    );

    pointer-events: none;
    z-index: 5;
}


/* =====================================================
   SOL PANEL
   ===================================================== */

.messages-page .conversations-panel {
    position: relative;

    width: 330px;
    min-width: 330px;
    height: 100%;

    background:
        linear-gradient(
            180deg,
            rgba(20, 17, 13, 0.98),
            rgba(12, 11, 9, 0.99)
        );

    border-right: 1px solid rgba(197, 137, 45, 0.17);

    overflow-y: auto;
    overflow-x: hidden;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(190, 129, 38, 0.38)
        rgba(255, 255, 255, 0.025);
}

.messages-page .messages-panel-title {
    position: sticky;
    top: 0;
    z-index: 3;

    padding: 25px 22px 21px;

    background: rgba(18, 16, 12, 0.96);
    backdrop-filter: blur(10px);

    border-bottom: 1px solid rgba(197, 137, 45, 0.14);
}

.messages-page .messages-panel-title::before {
    content: "MESAJ MERKEZİ";

    display: block;
    margin-bottom: 7px;

    color: #b98638;

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.messages-page .messages-panel-title h2 {
    margin: 0;

    color: #fff;

    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.messages-page #conversationList {
    width: 100%;
    padding: 12px;
}


/* =====================================================
   KONUŞMA KARTLARI
   ===================================================== */

.messages-page .conversation-item {
    position: relative;

    display: block;
    width: 100%;

    margin: 0 0 8px;
    padding: 15px 16px;

    text-align: left;

    color: #f7f2e9;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.012)
        );

    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 11px;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.messages-page .conversation-item:hover {
    transform: translateY(-1px);

    background:
        linear-gradient(
            135deg,
            rgba(188, 127, 36, 0.10),
            rgba(255, 255, 255, 0.018)
        );

    border-color: rgba(205, 145, 52, 0.28);
}

.messages-page .conversation-item.active {
    background:
        linear-gradient(
            135deg,
            rgba(193, 127, 30, 0.18),
            rgba(92, 58, 17, 0.08)
        );

    border-color: rgba(220, 158, 55, 0.52);

    box-shadow:
        inset 3px 0 0 #d59a39,
        0 8px 24px rgba(0, 0, 0, 0.14);
}

.messages-page .conversation-item strong {
    display: block;

    margin: 0 0 5px;

    color: #fff;

    font-size: 14px;
    font-weight: 800;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages-page .conversation-item small {
    display: block;

    color: #948a7c;

    font-size: 11px;
    line-height: 1.45;
}


/* =====================================================
   OKUNMAMIŞ MESAJ ROZETİ
   ===================================================== */

.messages-page .conversation-unread-badge,
.conversation-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 21px;
    height: 21px;

    padding: 0 6px;

    border-radius: 999px;

    background: linear-gradient(
        135deg,
        #e3b14b,
        #a96b1c
    );

    color: #171009;

    font-size: 10px;
    font-weight: 900;
    line-height: 1;

    box-shadow:
        0 3px 12px rgba(211, 149, 51, 0.22);
}


/* =====================================================
   SAĞ SOHBET PANELİ
   ===================================================== */

.messages-page .chat-panel {
    position: relative;

    width: 100%;
    min-width: 0;
    height: 100%;

    background:
        radial-gradient(
            circle at 50% 15%,
            rgba(188, 123, 28, 0.035),
            transparent 42%
        ),
        rgba(10, 10, 9, 0.96);

    overflow: hidden;
}


/* =====================================================
   KONUŞMA SEÇİLMEDİ
   ===================================================== */

.messages-page .chat-empty {
    position: relative;

    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    padding: 30px;

    text-align: center;

    color: #8e8476;
}

.messages-page .chat-empty::before {
    content: "✉";

    width: 62px;
    height: 62px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 18px;

    border: 1px solid rgba(207, 145, 48, 0.35);
    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(199, 137, 42, 0.12),
            rgba(199, 137, 42, 0.035)
        );

    color: #d39a3e;

    font-size: 25px;

    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.2);
}

.messages-page .chat-empty h2 {
    margin: 0 0 8px;

    color: #f8f3eb;

    font-size: 21px;
    font-weight: 800;
}

.messages-page .chat-empty p {
    max-width: 380px;

    margin: 0;

    color: #837a6e;

    font-size: 13px;
    line-height: 1.6;
}


/* =====================================================
   AKTİF SOHBET
   JS display:flex yaptığında çalışır.
   Inline display:none korunuyor.
   ===================================================== */

.messages-page #chatArea {
    width: 100%;
    height: 100%;
    min-width: 0;

    flex-direction: column;

    background: transparent;

    overflow: hidden;
}


/* =====================================================
   SOHBET ÜST BİLGİ
   ===================================================== */

.messages-page .chat-header {
    position: relative;

    width: 100%;
    min-height: 82px;

    flex: 0 0 auto;

    padding: 17px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    background:
        linear-gradient(
            180deg,
            rgba(25, 21, 16, 0.97),
            rgba(16, 14, 11, 0.97)
        );

    border-bottom: 1px solid rgba(197, 137, 45, 0.16);
}

.messages-page .chat-header::after {
    content: "";

    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;

    height: 1px;

    background: linear-gradient(
        90deg,
        rgba(213, 154, 57, 0.32),
        transparent 48%
    );
}

.messages-page .chat-user-profile {
    display: flex;
    align-items: center;

    gap: 12px;

    min-width: 0;
}

.messages-page .chat-user-avatar {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(222, 160, 58, 0.55);
    border-radius: 12px;

    background:
        linear-gradient(
            145deg,
            #5d4019,
            #241b0f
        );

    color: #f2ba55;

    font-size: 12px;
    font-weight: 900;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 7px 18px rgba(0, 0, 0, 0.22);
}

.messages-page .chat-user-details {
    min-width: 0;
}

.messages-page .chat-user-name-row {
    display: flex;
    align-items: center;

    gap: 7px;

    min-width: 0;
}

.messages-page .chat-header strong {
    display: block;

    max-width: 420px;

    color: #fff;

    font-size: 15px;
    font-weight: 800;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages-page .chat-header small {
    display: block;

    max-width: 500px;

    margin-top: 4px;

    color: #938778;

    font-size: 11px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages-page .chat-status-dot {
    width: 7px;
    height: 7px;

    display: inline-block;
    flex: 0 0 7px;

    border-radius: 50%;

    background: #42c977;

    box-shadow:
        0 0 0 3px rgba(66, 201, 119, 0.09);
}

.messages-page .chat-header-badge {
    flex: 0 0 auto;

    padding: 7px 11px;

    border: 1px solid rgba(201, 141, 48, 0.30);
    border-radius: 7px;

    background: rgba(190, 127, 31, 0.06);

    color: #c9943f;

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
}


/* =====================================================
   MESAJ LİSTESİ
   ===================================================== */

.messages-page #messageList,
.messages-page .message-list {
    position: relative;

    width: 100%;
    min-width: 0;

    flex: 1 1 auto;
    min-height: 0;

    padding: 28px 28px 22px;

    display: flex;
    flex-direction: column;

    gap: 10px;

    overflow-x: hidden;
    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(190, 129, 38, 0.35)
        rgba(255, 255, 255, 0.02);
}


/* =====================================================
   MESAJ SATIRLARI
   ===================================================== */

.messages-page .message-item {
    width: 100%;
    max-width: 100%;

    display: flex;

    margin: 0;
    padding: 0;
}

.messages-page .message-received {
    justify-content: flex-start;
}

.messages-page .message-sent {
    justify-content: flex-end;
}


/* =====================================================
   MESAJ BALONLARI
   ===================================================== */

.messages-page .message-bubble {
    position: relative;

    width: auto;
    min-width: 70px;
    max-width: min(68%, 620px);

    padding: 11px 14px 9px;

    background:
        linear-gradient(
            145deg,
            #211e19,
            #181613
        );

    color: #eee8de;

    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 13px 13px 13px 4px;

    line-height: 1.5;
    font-size: 13px;

    word-break: break-word;
    overflow-wrap: anywhere;

    box-shadow:
        0 5px 14px rgba(0, 0, 0, 0.12);
}

.messages-page .message-bubble.own {
    background:
        linear-gradient(
            145deg,
            #8e5d1d,
            #654114
        );

    color: #fff8ec;

    border-color: rgba(235, 179, 83, 0.30);

    border-radius: 13px 13px 4px 13px;

    box-shadow:
        0 5px 18px rgba(98, 61, 14, 0.16);
}

.messages-page .message-text {
    margin: 0;

    color: inherit;

    font-size: 13px;
    line-height: 1.55;

    white-space: pre-wrap;

    word-break: break-word;
    overflow-wrap: anywhere;
}

.messages-page .message-time {
    display: block;

    margin-top: 5px;

    color: rgba(255, 255, 255, 0.48);

    font-size: 9px;
    text-align: right;
}


/* =====================================================
   GÜVENLİK UYARISI
   ===================================================== */

.messages-page .phone-warning {
    position: relative;

    width: auto;
    flex: 0 0 auto;

    margin: 0 24px 12px;
    padding: 10px 13px;

    background:
        linear-gradient(
            90deg,
            rgba(190, 126, 28, 0.09),
            rgba(190, 126, 28, 0.035)
        );

    border: 1px solid rgba(207, 146, 48, 0.25);
    border-radius: 8px;

    color: #b99a61;

    font-size: 10px;
    line-height: 1.5;
}


/* =====================================================
   MESAJ GÖNDERME ALANI
   ===================================================== */

.messages-page #messageForm,
.messages-page .message-form {
    width: 100%;

    flex: 0 0 auto;

    display: flex;
    flex-direction: row;
    align-items: flex-end;

    gap: 10px;

    padding: 15px 24px 18px;

    background:
        linear-gradient(
            180deg,
            rgba(14, 13, 11, 0.96),
            rgba(10, 9, 8, 0.99)
        );

    border-top: 1px solid rgba(197, 137, 45, 0.13);
}

.messages-page #messageInput {
    display: block;

    width: auto;
    min-width: 0;

    flex: 1 1 auto;

    min-height: 46px;
    max-height: 120px;

    padding: 13px 14px;

    resize: none;

    background: rgba(255, 255, 255, 0.035);

    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 9px;

    outline: none;

    color: #f5efe5;

    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.messages-page #messageInput:hover {
    border-color: rgba(208, 147, 50, 0.22);
}

.messages-page #messageInput:focus {
    background: rgba(255, 255, 255, 0.045);

    border-color: rgba(216, 155, 57, 0.58);

    box-shadow:
        0 0 0 3px rgba(190, 126, 28, 0.07);
}

.messages-page #messageInput::placeholder {
    color: #70685e;
}

.messages-page #messageForm button,
.messages-page .message-form button {
    width: auto;
    min-width: 102px;
    height: 46px;

    flex: 0 0 auto;

    padding: 0 20px;

    border: 1px solid #b77a25;
    border-radius: 9px;

    background:
        linear-gradient(
            180deg,
            #c58b32,
            #95601d
        );

    color: #171008;

    font-size: 12px;
    font-weight: 900;

    cursor: pointer;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 5px 16px rgba(93, 55, 10, 0.20);

    transition:
        transform 0.16s ease,
        filter 0.16s ease,
        box-shadow 0.16s ease;
}

.messages-page #messageForm button:hover,
.messages-page .message-form button:hover {
    filter: brightness(1.09);

    transform: translateY(-1px);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 7px 20px rgba(93, 55, 10, 0.26);
}

.messages-page #messageForm button:active,
.messages-page .message-form button:active {
    transform: translateY(0);
}


/* =====================================================
   BOŞ KONUŞMA LİSTESİ
   ===================================================== */

.messages-page .no-conversations {
    margin: 8px 0;

    padding: 18px 14px;

    color: #857b6e;

    background: rgba(255, 255, 255, 0.02);

    border: 1px dashed rgba(201, 141, 48, 0.18);
    border-radius: 9px;

    font-size: 12px;
    line-height: 1.55;
}

.messages-page .no-conversations strong {
    display: block;

    margin-bottom: 5px;

    color: #eee7dc;
}


/* =====================================================
   SCROLLBAR - CHROMIUM
   ===================================================== */

.messages-page .conversations-panel::-webkit-scrollbar,
.messages-page #messageList::-webkit-scrollbar {
    width: 7px;
}

.messages-page .conversations-panel::-webkit-scrollbar-track,
.messages-page #messageList::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.018);
}

.messages-page .conversations-panel::-webkit-scrollbar-thumb,
.messages-page #messageList::-webkit-scrollbar-thumb {
    background: rgba(190, 129, 38, 0.30);
    border-radius: 999px;
}

.messages-page .conversations-panel::-webkit-scrollbar-thumb:hover,
.messages-page #messageList::-webkit-scrollbar-thumb:hover {
    background: rgba(204, 143, 48, 0.48);
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 1050px) {

    .messages-page {
        padding: 24px 16px 36px;
    }

    .messages-page .messages-container {
        width: 100%;
        grid-template-columns: 290px minmax(0, 1fr);
    }

    .messages-page .conversations-panel {
        width: 290px;
        min-width: 290px;
    }

    .messages-page .message-bubble {
        max-width: 78%;
    }

}


/* =====================================================
   MOBİL
   Mevcut JS davranışını bozmadan korunmuştur.
   ===================================================== */

@media (max-width: 800px) {

    .messages-page {
        min-height: calc(100vh - 60px);

        padding: 12px;
    }

    .messages-page .messages-container {
        width: 100%;
        height: calc(100vh - 90px);
        min-height: 540px;

        grid-template-columns: 1fr;

        border-radius: 12px;
    }

    .messages-page .conversations-panel {
        display: none;
    }

    .messages-page .chat-header {
        min-height: 70px;

        padding: 12px 14px;
    }

    .messages-page .chat-user-avatar {
        width: 40px;
        height: 40px;

        flex-basis: 40px;

        border-radius: 10px;
    }

    .messages-page .chat-header strong {
        font-size: 14px;
    }

    .messages-page .chat-header-badge {
        display: none;
    }

    .messages-page #messageList,
    .messages-page .message-list {
        padding: 16px 13px;
    }

    .messages-page .message-bubble {
        max-width: 86%;

        font-size: 12px;
    }

    .messages-page .phone-warning {
        margin: 0 12px 9px;
        padding: 9px 10px;

        font-size: 9px;
    }

    .messages-page #messageForm,
    .messages-page .message-form {
        gap: 8px;

        padding: 11px 12px 13px;
    }

    .messages-page #messageInput {
        min-height: 43px;

        padding: 11px 12px;

        font-size: 12px;
    }

    .messages-page #messageForm button,
    .messages-page .message-form button {
        min-width: 78px;
        height: 43px;

        padding: 0 14px;

        font-size: 11px;
    }

}


/* =====================================================
   ÇOK KÜÇÜK EKRANLAR
   ===================================================== */

@media (max-width: 480px) {

    .messages-page {
        padding: 0;
    }

    .messages-page .messages-container {
        height: calc(100vh - 60px);
        min-height: 500px;

        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .messages-page .chat-empty::before {
        width: 54px;
        height: 54px;

        font-size: 22px;
    }

    .messages-page .chat-empty h2 {
        font-size: 18px;
    }

    .messages-page .message-bubble {
        max-width: 90%;
    }

}


/* =====================================================
   CHAT AREA GÖRÜNÜRLÜK DÜZELTMESİ
   Konuşma seçilmeden sohbet elemanları görünmesin
   ===================================================== */

.messages-page #chatArea[style*="display: none"] {
    display: none !important;
}

.messages-page #chatArea[style*="display:none"] {
    display: none !important;
}

.messages-page #chatArea[style*="display: flex"],
.messages-page #chatArea[style*="display:flex"] {
    display: flex !important;
}

/* ChatArea kapalıysa içindeki hiçbir eleman taşmasın */
.messages-page #chatArea[style*="display: none"] > *,
.messages-page #chatArea[style*="display:none"] > * {
    display: none !important;
}

/* =====================================================
   ROYALE2 MARKET
   AKTİF SOHBET HEADER DÜZELTMESİ
   ===================================================== */

.messages-page #chatArea {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
}

/* Sohbet üst barı */
.messages-page #chatArea .chat-header {
    position: relative !important;
    width: 100% !important;
    min-height: 76px !important;
    height: 76px !important;
    flex: 0 0 76px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    padding: 14px 20px !important;
    margin: 0 !important;

    background:
        linear-gradient(
            180deg,
            rgba(31, 25, 16, 0.98),
            rgba(17, 15, 12, 0.98)
        ) !important;

    border: 0 !important;
    border-bottom: 1px solid rgba(197, 139, 39, 0.25) !important;

    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Kullanıcı bölümü */
.messages-page #chatArea .chat-user-profile {
    position: relative !important;

    display: flex !important;
    align-items: center !important;

    gap: 12px !important;

    min-width: 0 !important;
    flex: 1 1 auto !important;

    margin: 0 !important;
    padding: 0 !important;
}

/* Avatar */
.messages-page #chatArea .chat-user-avatar {
    position: relative !important;
    inset: auto !important;

    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    flex: 0 0 42px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 10px !important;

    background:
        linear-gradient(
            145deg,
            rgba(191, 128, 24, 0.28),
            rgba(74, 48, 12, 0.35)
        ) !important;

    border: 1px solid rgba(218, 155, 45, 0.55) !important;

    color: #e0a837 !important;

    font-size: 12px !important;
    font-weight: 900 !important;

    box-shadow: none !important;
}

/* Kullanıcı yazıları */
.messages-page #chatArea .chat-user-details {
    position: relative !important;
    min-width: 0 !important;

    margin: 0 !important;
    padding: 0 !important;
}

.messages-page #chatArea .chat-user-name-row {
    display: flex !important;
    align-items: center !important;

    gap: 7px !important;

    margin: 0 !important;
    padding: 0 !important;
}

.messages-page #chatArea #chatUsername {
    display: block !important;

    margin: 0 !important;
    padding: 0 !important;

    color: #f4f0e8 !important;

    font-size: 14px !important;
    font-weight: 800 !important;

    line-height: 1.2 !important;
}

.messages-page #chatArea #chatListingTitle {
    display: block !important;

    max-width: 420px !important;

    margin: 5px 0 0 !important;
    padding: 0 !important;

    color: #8f8779 !important;

    font-size: 11px !important;
    line-height: 1.3 !important;

    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Online noktası */
.messages-page #chatArea .chat-status-dot {
    position: relative !important;
    inset: auto !important;

    display: inline-block !important;

    width: 7px !important;
    height: 7px !important;
    min-width: 7px !important;

    margin: 0 !important;

    border-radius: 50% !important;
    background: #44c76a !important;

    box-shadow: 0 0 8px rgba(68, 199, 106, 0.45) !important;
}

/* Güvenli mesajlaşma rozeti */
.messages-page #chatArea .chat-header-badge {
    position: relative !important;
    inset: auto !important;

    flex: 0 0 auto !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 0 0 16px !important;
    padding: 7px 11px !important;

    width: auto !important;
    height: auto !important;

    border: 1px solid rgba(203, 143, 35, 0.35) !important;
    border-radius: 7px !important;

    background: rgba(191, 128, 24, 0.08) !important;

    color: #c99332 !important;

    font-size: 9px !important;
    font-weight: 800 !important;

    line-height: 1 !important;
    letter-spacing: 0.7px !important;

    white-space: nowrap !important;

    box-shadow: none !important;
}

/* Mesaj alanı header'ın altından düzgün başlasın */
.messages-page #chatArea #messageList,
.messages-page #chatArea .message-list {
    position: relative !important;

    flex: 1 1 auto !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 22px !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Güvenlik uyarısı */
.messages-page #chatArea .phone-warning {
    position: relative !important;
    inset: auto !important;

    flex: 0 0 auto !important;

    width: auto !important;

    margin: 0 20px 10px !important;
    padding: 10px 12px !important;
}

/* Mesaj gönderme bölümü */
.messages-page #chatArea #messageForm {
    position: relative !important;
    inset: auto !important;

    width: 100% !important;

    flex: 0 0 auto !important;

    margin: 0 !important;
    padding: 12px 20px !important;

    display: flex !important;
    align-items: center !important;

    gap: 10px !important;
}

/* Mesaj kutusu */
.messages-page #chatArea #messageInput {
    position: relative !important;

    flex: 1 1 auto !important;

    width: 100% !important;
    min-width: 0 !important;

    height: 46px !important;
    min-height: 46px !important;
    max-height: 110px !important;

    margin: 0 !important;
}

/* Gönder */
.messages-page #chatArea #messageForm button {
    position: relative !important;

    flex: 0 0 auto !important;

    min-width: 94px !important;
    height: 46px !important;

    margin: 0 !important;
}

/* =====================================================
   ROYALE2 MARKET - MESAJLAR SAYFASI HEADER DÜZELTMESİ
   Sadece messages.html sayfasını etkiler
   ===================================================== */

body:has(.messages-page) .site-header {
    width: 100%;
    height: 72px;
    min-height: 72px;

    display: flex;
    align-items: center;

    position: relative;
    z-index: 1000;

    background: rgba(28, 22, 14, 0.96) !important;
    border-bottom: 1px solid rgba(197, 137, 47, 0.28) !important;
}

body:has(.messages-page) .site-header .header-inner {
    width: min(1420px, calc(100% - 40px));
    height: 72px;

    margin: 0 auto;
    padding: 0;

    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;

    gap: 34px;
}


/* LOGO */

body:has(.messages-page) .site-header .brand {
    min-width: 180px;

    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;

    gap: 10px;

    margin: 0;
    padding: 0;

    text-decoration: none;
    white-space: nowrap;
}

body:has(.messages-page) .site-header .brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;

    display: grid !important;
    place-items: center;

    border: 1px solid #b87927;
    border-radius: 4px;

    background:
        linear-gradient(
            145deg,
            rgba(184, 121, 39, 0.20),
            rgba(16, 12, 8, 0.90)
        );

    color: #e5ad4d;

    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

body:has(.messages-page) .site-header .brand-text {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;

    line-height: 1;
}

body:has(.messages-page) .site-header .brand-text strong {
    display: block;

    color: #ffffff;

    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;

    line-height: 1;
}

body:has(.messages-page) .site-header .brand-text small {
    display: block;

    margin-top: 5px;

    color: #9d8a6b;

    font-size: 8px;
    font-weight: 700;
    letter-spacing: 3px;

    line-height: 1;
}


/* ORTA NAVİGASYON */

body:has(.messages-page) .site-header nav {
    min-width: 0;

    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;

    gap: 28px;

    margin: 0;
    padding: 0;
}

body:has(.messages-page) .site-header nav a {
    display: inline-flex !important;
    align-items: center;

    margin: 0;
    padding: 8px 0;

    color: #a89b88;

    font-size: 13px;
    font-weight: 600;
    line-height: 1;

    text-decoration: none;
    white-space: nowrap;

    transition:
        color 0.18s ease,
        opacity 0.18s ease;
}

body:has(.messages-page) .site-header nav a:hover {
    color: #d9a447;
}


/* SAĞ TARAF */

body:has(.messages-page) .site-header .actions {
    margin-left: auto;

    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;

    gap: 12px;

    white-space: nowrap;
}

body:has(.messages-page) .site-header .actions .login {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    min-height: 38px;

    padding: 0 12px;

    color: #d5c6af;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;

    background: transparent;
    border: 0;
}

body:has(.messages-page) .site-header .actions .login:hover {
    color: #e2ad4d;
}

body:has(.messages-page) .site-header .actions .sell {
    min-height: 40px;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    padding: 0 18px;

    border: 1px solid rgba(205, 143, 48, 0.55);
    border-radius: 5px;

    background:
        linear-gradient(
            180deg,
            #bd812d,
            #98621f
        );

    color: #ffffff;

    font-size: 13px;
    font-weight: 800;

    text-decoration: none;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        0 5px 15px rgba(0, 0, 0, 0.18);

    transition:
        transform 0.18s ease,
        filter 0.18s ease;
}

body:has(.messages-page) .site-header .actions .sell:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}


/* HEADER İLE MESAJ SAYFASI ARASINDAKİ MESAFE */

body:has(.messages-page) .messages-page {
    min-height: calc(100vh - 72px);
}


/* TABLET */

@media (max-width: 1000px) {

    body:has(.messages-page) .site-header .header-inner {
        width: calc(100% - 28px);
        gap: 20px;
    }

    body:has(.messages-page) .site-header nav {
        gap: 16px;
    }

    body:has(.messages-page) .site-header .brand {
        min-width: auto;
    }
}


/* MOBİL */

@media (max-width: 760px) {

    body:has(.messages-page) .site-header {
        height: auto;
        min-height: 64px;
    }

    body:has(.messages-page) .site-header .header-inner {
        width: calc(100% - 24px);
        min-height: 64px;

        flex-wrap: wrap;

        padding: 10px 0;
        gap: 10px 16px;
    }

    body:has(.messages-page) .site-header .brand {
        margin-right: auto;
    }

    body:has(.messages-page) .site-header nav {
        width: 100%;
        order: 3;

        overflow-x: auto;

        gap: 18px;
    }

    body:has(.messages-page) .site-header nav a {
        font-size: 12px;
    }

    body:has(.messages-page) .site-header .actions {
        margin-left: 0;
    }

    body:has(.messages-page) .site-header .actions .sell {
        padding: 0 12px;
    }
}


/* =====================================================
   ROYALE2 MARKET
   MESAJLAŞMA PROFESYONEL SON DOKUNUŞLAR
   ===================================================== */

/* MESAJ AKIŞI */
.messages-page #messageList,
.messages-page .message-list {
    padding: 22px 26px 18px;

    gap: 8px;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(190, 132, 43, 0.65)
        rgba(255, 255, 255, 0.035);
}


/* CHROME / EDGE SCROLLBAR */
.messages-page #messageList::-webkit-scrollbar,
.messages-page .message-list::-webkit-scrollbar {
    width: 7px;
}

.messages-page #messageList::-webkit-scrollbar-track,
.messages-page .message-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.025);
}

.messages-page #messageList::-webkit-scrollbar-thumb,
.messages-page .message-list::-webkit-scrollbar-thumb {
    background:
        linear-gradient(
            180deg,
            #c58a32,
            #76501f
        );

    border-radius: 999px;
}

.messages-page #messageList::-webkit-scrollbar-thumb:hover,
.messages-page .message-list::-webkit-scrollbar-thumb:hover {
    background: #d69a3c;
}


/* MESAJ SATIRI */
.messages-page .message-item {
    width: 100%;

    display: flex;

    margin: 0;
    padding: 0 2px;
}


/* GELEN MESAJ */
.messages-page .message-received {
    justify-content: flex-start;
}


/* GİDEN MESAJ */
.messages-page .message-sent {
    justify-content: flex-end;
}


/* ORTAK MESAJ BALONU */
.messages-page .message-bubble {
    position: relative;

    width: auto;
    min-width: 76px;
    max-width: min(68%, 540px);

    padding: 11px 13px 8px;

    border-radius: 10px;

    line-height: 1.4;

    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.16);

    transition:
        border-color 0.18s ease,
        transform 0.18s ease;
}


/* GELEN MESAJ BALONU */
.messages-page .message-received .message-bubble {
    background:
        linear-gradient(
            145deg,
            rgba(58, 49, 36, 0.96),
            rgba(42, 36, 27, 0.96)
        );

    border: 1px solid rgba(177, 137, 75, 0.18);

    color: #f4eee5;

    border-bottom-left-radius: 3px;
}


/* GİDEN MESAJ BALONU */
.messages-page .message-sent .message-bubble,
.messages-page .message-bubble.own {
    background:
        linear-gradient(
            145deg,
            #c38a32,
            #a66f23
        );

    border: 1px solid rgba(229, 174, 78, 0.52);

    color: #fff;

    border-bottom-right-radius: 3px;

    box-shadow:
        0 5px 18px rgba(126, 79, 19, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}


/* MESAJ METNİ */
.messages-page .message-text {
    margin: 0;

    color: inherit;

    font-size: 13px;
    font-weight: 500;

    line-height: 1.42;

    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}


/* MESAJ SAATİ */
.messages-page .message-time {
    display: block;

    margin-top: 5px;

    color: rgba(255, 255, 255, 0.52);

    font-size: 9px;
    font-weight: 500;

    line-height: 1;

    text-align: right;
}


/* GELEN MESAJIN SAATİ */
.messages-page .message-received .message-time {
    color: rgba(230, 220, 205, 0.48);
}


/* MESAJ YAZMA ALANI */
.messages-page #messageForm,
.messages-page .message-form {
    padding: 12px 16px;

    gap: 10px;

    background:
        linear-gradient(
            180deg,
            rgba(15, 13, 10, 0.98),
            rgba(10, 9, 7, 0.98)
        );

    border-top:
        1px solid rgba(190, 132, 43, 0.22);
}


/* TEXTAREA */
.messages-page #messageInput {
    min-height: 44px;
    height: 44px;
    max-height: 110px;

    padding: 12px 14px;

    background:
        rgba(255, 255, 255, 0.035);

    border:
        1px solid rgba(197, 145, 67, 0.18);

    border-radius: 8px;

    color: #f4eee5;

    font-size: 13px;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.messages-page #messageInput:hover {
    border-color:
        rgba(197, 145, 67, 0.32);
}

.messages-page #messageInput:focus {
    background:
        rgba(255, 255, 255, 0.05);

    border-color:
        rgba(211, 154, 61, 0.72);

    box-shadow:
        0 0 0 3px rgba(190, 132, 43, 0.08);

    outline: none;
}

.messages-page #messageInput::placeholder {
    color:
        rgba(211, 201, 185, 0.38);
}


/* GÖNDER BUTONU */
.messages-page #messageForm button,
.messages-page .message-form button {
    min-width: 88px;
    height: 44px;

    padding: 0 18px;

    border:
        1px solid rgba(226, 168, 71, 0.52);

    border-radius: 8px;

    background:
        linear-gradient(
            180deg,
            #c88e35,
            #a66d21
        );

    color: #171008;

    font-size: 12px;
    font-weight: 800;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 4px 12px rgba(0, 0, 0, 0.18);

    transition:
        transform 0.16s ease,
        filter 0.16s ease,
        box-shadow 0.16s ease;
}

.messages-page #messageForm button:hover,
.messages-page .message-form button:hover {
    background:
        linear-gradient(
            180deg,
            #d79b40,
            #b57927
        );

    transform: translateY(-1px);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 6px 16px rgba(0, 0, 0, 0.22);
}

.messages-page #messageForm button:active,
.messages-page .message-form button:active {
    transform: translateY(0);
}


/* GÜVENLİK BİLGİSİ */
.messages-page .phone-warning {
    margin: 0 16px 8px;

    padding: 9px 11px;

    background:
        rgba(185, 127, 37, 0.055);

    border:
        1px solid rgba(190, 132, 43, 0.30);

    border-radius: 7px;

    color: #ba914c;

    font-size: 10px;

    line-height: 1.4;
}


/* AKTİF KONUŞMA */
.messages-page .conversation-item.active {
    position: relative;

    background:
        linear-gradient(
            135deg,
            rgba(177, 119, 34, 0.18),
            rgba(47, 35, 20, 0.55)
        );

    border-color:
        rgba(210, 151, 57, 0.68);

    box-shadow:
        inset 3px 0 0 #d29536;
}


/* KONUŞMA HOVER */
.messages-page .conversation-item:hover {
    border-color:
        rgba(197, 140, 51, 0.48);

    background:
        rgba(197, 140, 51, 0.075);
}


/* OKUNMAMIŞ MESAJ ROZETİ */
.messages-page .conversation-unread-badge {
    min-width: 20px;
    height: 20px;

    padding: 0 6px;

    border-radius: 999px;

    background:
        linear-gradient(
            135deg,
            #dfa641,
            #a56c22
        );

    color: #171008;

    font-size: 10px;
    font-weight: 900;

    box-shadow:
        0 3px 10px rgba(191, 128, 35, 0.25);
}


/* MOBİL */
@media (max-width: 800px) {

    .messages-page #messageList,
    .messages-page .message-list {
        padding: 16px 12px;
    }

    .messages-page .message-bubble {
        max-width: 84%;
    }

    .messages-page #messageForm,
    .messages-page .message-form {
        padding: 10px;
    }

    .messages-page .phone-warning {
        margin:
            0 10px 7px;
    }
}
