/* =========================================================
   ALPPORT AI - ADMIN
   ========================================================= */

.alpport-ai-admin {
    color: #1d2327;
}

.alpport-ai-card {
    background: #ffffff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 20px;
}


/* =========================================================
   FRONTEND ANA UYGULAMA
   ========================================================= */

.alpport-ai-frontend {
    width: 100%;
    max-width: 1280px;
    height: 720px;
    margin: 30px auto;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 14px;
    overflow: hidden;

    display: flex;
    flex-direction: row;

    box-sizing: border-box;

    color: #1f2328;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}


/* =========================================================
   BOX SIZING
   ========================================================= */

.alpport-ai-frontend *,
.alpport-ai-frontend *::before,
.alpport-ai-frontend *::after {
    box-sizing: border-box;
}


/* =========================================================
   SOL SIDEBAR
   ========================================================= */

.alpport-ai-sidebar {
    width: 270px;
    min-width: 270px;
    height: 100%;

    display: flex;
    flex-direction: column;

    background: #f7f7f8;
    border-right: 1px solid #e5e7eb;

    overflow: hidden;
}


/* =========================================================
   SIDEBAR HEADER
   ========================================================= */

.alpport-ai-sidebar-header {
    flex: 0 0 auto;

    padding: 20px 18px;

    border-bottom: 1px solid #e5e7eb;
}

.alpport-ai-logo {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;

    color: #202123;
}


/* =========================================================
   YENİ SOHBET
   ========================================================= */

.alpport-ai-new-chat {
    width: calc(100% - 24px);

    min-height: 46px;

    margin: 14px 12px 12px;
    padding: 10px 14px;

    display: flex;
    align-items: center;
    gap: 10px;

    border: 1px solid #d9dce1;
    border-radius: 9px;

    background: #ffffff;
    color: #202123;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    text-align: left;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.alpport-ai-new-chat:hover {
    background: #eeeeef;
    border-color: #c9ccd1;
}

.alpport-ai-new-chat-icon {
    font-size: 21px;
    line-height: 1;
    font-weight: 400;
}


/* =========================================================
   SOHBET LİSTESİ
   ========================================================= */

.alpport-ai-chat-list-wrapper {
    flex: 1 1 auto;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.alpport-ai-chat-list-title {
    flex: 0 0 auto;

    padding: 14px 16px 8px;

    color: #6b7280;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alpport-ai-chat-list {
    flex: 1 1 auto;
    min-height: 0;

    padding: 4px 8px 12px;

    overflow-y: auto;
}


/* =========================================================
   CHAT LİSTESİ ÖĞESİ
   ========================================================= */

.alpport-ai-chat-item {
    width: 100%;

    margin: 2px 0;

    padding: 10px 10px;

    display: flex;
    align-items: center;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: #343541;

    cursor: pointer;

    text-align: left;

    font-size: 13px;

    transition: background 0.15s ease;
}

.alpport-ai-chat-item:hover {
    background: #ececed;
}

.alpport-ai-chat-item.active {
    background: #e5e5e6;
}

.alpport-ai-chat-item-title {
    flex: 1 1 auto;
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alpport-ai-chat-item-delete {
    flex: 0 0 auto;

    margin-left: 8px;

    padding: 3px 6px;

    border: 0;
    border-radius: 5px;

    background: transparent;
    color: #8b8d91;

    cursor: pointer;

    opacity: 0;
}

.alpport-ai-chat-item:hover .alpport-ai-chat-item-delete {
    opacity: 1;
}

.alpport-ai-chat-item-delete:hover {
    background: #ddddde;
    color: #b42318;
}


/* =========================================================
   CHAT LİSTESİ BOŞ DURUM
   ========================================================= */

.alpport-ai-chat-list-empty {
    padding: 16px 10px;

    color: #8a8d91;

    font-size: 13px;
    line-height: 1.5;
}


/* =========================================================
   ANA CHAT
   ========================================================= */

.alpport-ai-main {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;

    display: flex;
    flex-direction: column;

    background: #ffffff;
}


/* =========================================================
   CHAT HEADER
   ========================================================= */

.alpport-ai-header {
    flex: 0 0 auto;

    min-height: 70px;

    padding: 16px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid #e5e7eb;

    background: #ffffff;
}

.alpport-ai-header-text {
    min-width: 0;
}

.alpport-ai-header h1 {
    margin: 0;
    padding: 0;

    font-size: 19px;
    line-height: 1.3;
    font-weight: 700;

    color: #202123;
}

.alpport-ai-header p {
    margin: 4px 0 0;
    padding: 0;

    color: #6b7280;

    font-size: 13px;
}


/* =========================================================
   MOBİL MENÜ BUTONU
   ========================================================= */

.alpport-ai-sidebar-toggle {
    display: none;

    width: 40px;
    height: 40px;

    padding: 0;

    border: 1px solid #d9dce1;
    border-radius: 8px;

    background: #ffffff;
    color: #202123;

    font-size: 20px;
    line-height: 1;

    cursor: pointer;
}

.alpport-ai-sidebar-toggle:hover {
    background: #f3f3f4;
}


/* =========================================================
   MESAJ ALANI
   ========================================================= */

.alpport-ai-messages {
    flex: 1 1 auto;
    min-height: 0;

    overflow-y: auto;

    padding: 30px 24px;

    background: #ffffff;

    box-sizing: border-box;
}


/* =========================================================
   HOŞ GELDİN
   ========================================================= */

.alpport-ai-welcome {
    max-width: 760px;

    margin: 100px auto 20px;
    padding: 0;

    background: transparent;
    border: 0;

    box-sizing: border-box;
}

.alpport-ai-welcome h2 {
    margin: 0 0 14px;

    font-size: 28px;
    line-height: 1.3;
    font-weight: 700;

    color: #202123;
}

.alpport-ai-welcome p {
    margin: 5px 0;

    color: #5f6368;

    font-size: 15px;
    line-height: 1.6;
}


/* =========================================================
   MESAJ SATIRI
   ========================================================= */

.alpport-ai-message {
    width: 100%;
    max-width: 850px;

    margin: 0 auto 20px;

    display: flex;
    flex-direction: column;

    box-sizing: border-box;
}

.alpport-ai-message-user {
    align-items: flex-end;
}

.alpport-ai-message-assistant {
    align-items: flex-start;
}


/* =========================================================
   MESAJ ROLÜ
   ========================================================= */

.alpport-ai-message-role {
    margin-bottom: 6px;

    font-size: 11px;
    font-weight: 600;

    color: #8a8d91;
}


/* =========================================================
   MESAJ BALONU
   ========================================================= */

.alpport-ai-message-content {
    max-width: 78%;

    padding: 12px 16px;

    border-radius: 14px;

    font-size: 15px;
    line-height: 1.6;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    box-sizing: border-box;
}


/* =========================================================
   KULLANICI MESAJI
   ========================================================= */

.alpport-ai-message-user
.alpport-ai-message-content {
    background: #2271b1;
    color: #ffffff;

    border-bottom-right-radius: 4px;
}


/* =========================================================
   AI MESAJI
   ========================================================= */

.alpport-ai-message-assistant
.alpport-ai-message-content {
    background: #f7f7f8;
    color: #202123;

    border: 1px solid #e5e7eb;

    border-bottom-left-radius: 4px;
}


/* =========================================================
   BEKLEYEN MESAJ
   ========================================================= */

.alpport-ai-message-pending {
    opacity: 0.65;
}

.alpport-ai-message-pending
.alpport-ai-message-content {
    background: #ffffff;

    color: #6b7280;

    border: 1px dashed #c7cdd4;
}


/* =========================================================
   AI DÜŞÜNÜYOR
   ========================================================= */

.alpport-ai-thinking {
    display: inline-flex;

    align-items: center;

    gap: 5px;
}

.alpport-ai-thinking span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #8a9199;

    display: inline-block;

    animation:
        alpport-ai-bounce
        1.2s
        infinite
        ease-in-out;
}

.alpport-ai-thinking span:nth-child(1) {
    animation-delay: 0s;
}

.alpport-ai-thinking span:nth-child(2) {
    animation-delay: 0.15s;
}

.alpport-ai-thinking span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes alpport-ai-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


/* =========================================================
   HATA
   ========================================================= */

.alpport-ai-error {
    max-width: 850px;

    margin: 15px auto;

    padding: 12px 16px;

    background: #fff1f0;

    border: 1px solid #f0b8b5;

    border-radius: 10px;

    color: #b42318;

    line-height: 1.5;
}


/* =========================================================
   GİRİŞ ALANI
   ========================================================= */

.alpport-ai-input-area {
    flex: 0 0 auto;

    padding: 14px 20px 18px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;
}


/* =========================================================
   CHAT FORM
   ========================================================= */

.alpport-ai-chat-form {
    width: 100%;
    max-width: 850px;

    margin: 0 auto;

    display: flex;
    align-items: flex-end;

    gap: 10px;
}


/* =========================================================
   TEXTAREA
   ========================================================= */

.alpport-ai-chat-form textarea {
    flex: 1 1 auto;

    width: 100%;

    min-height: 50px;
    max-height: 180px;

    resize: vertical;

    padding: 13px 15px;

    border: 1px solid #c9cdd2;
    border-radius: 12px;

    background: #ffffff;
    color: #1f2328;

    font-family: inherit;

    font-size: 15px;
    line-height: 1.5;

    box-sizing: border-box;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.alpport-ai-chat-form textarea:focus {
    border-color: #2271b1;

    box-shadow:
        0 0 0 1px #2271b1;
}


/* =========================================================
   GÖNDER BUTONU
   ========================================================= */

.alpport-ai-chat-form button {
    flex: 0 0 auto;

    min-width: 92px;
    min-height: 50px;

    padding: 12px 18px;

    border: 0;
    border-radius: 10px;

    background: #2271b1;
    color: #ffffff;

    font-family: inherit;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        opacity 0.15s ease,
        transform 0.1s ease;
}

.alpport-ai-chat-form button:hover {
    opacity: 0.9;
}

.alpport-ai-chat-form button:active {
    transform: translateY(1px);
}

.alpport-ai-chat-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* =========================================================
   ESKİ ENTER BİLGİSİ VARSA GİZLE
   ========================================================= */

.alpport-ai-input-info {
    display: none !important;
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

.alpport-ai-messages::-webkit-scrollbar,
.alpport-ai-chat-list::-webkit-scrollbar {
    width: 7px;
}

.alpport-ai-messages::-webkit-scrollbar-track,
.alpport-ai-chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.alpport-ai-messages::-webkit-scrollbar-thumb,
.alpport-ai-chat-list::-webkit-scrollbar-thumb {
    background: #c9cdd2;
    border-radius: 10px;
}


/* =========================================================
   GİRİŞ GEREKLİ
   ========================================================= */

.alpport-ai-login-required {
    max-width: 600px;

    margin: 60px auto;
    padding: 30px;

    text-align: center;

    background: #ffffff;

    border: 1px solid #e1e4e8;

    border-radius: 12px;
}

.alpport-ai-login-required h2 {
    margin: 0 0 10px;
}

.alpport-ai-login-required p {
    color: #6b7280;
}

.alpport-ai-login-required a {
    display: inline-block;

    margin-top: 10px;
    padding: 10px 18px;

    background: #2271b1;
    color: #ffffff;

    text-decoration: none;

    border-radius: 8px;
}


/* =========================================================
   MOBİL
   ========================================================= */

@media (max-width: 900px) {

    .alpport-ai-frontend {
        width: 100%;
        height: calc(100vh - 20px);

        margin: 10px 0;

        border-radius: 10px;
    }


    /* SIDEBAR MOBİLDE GİZLİ */

    .alpport-ai-sidebar {
        position: fixed;

        top: 0;
        left: 0;

        width: 280px;
        min-width: 280px;
        height: 100vh;

        z-index: 99999;

        transform: translateX(-100%);

        transition:
            transform 0.2s ease;

        box-shadow:
            5px 0 20px rgba(0, 0, 0, 0.12);
    }


    /* JS .open EKLEDİĞİNDE AÇILIR */

    .alpport-ai-sidebar.open {
        transform: translateX(0);
    }


    /* ANA ALAN */

    .alpport-ai-main {
        width: 100%;
        min-width: 0;
    }


    /* MOBİL MENÜ GÖRÜNÜR */

    .alpport-ai-sidebar-toggle {
        display: flex;

        align-items: center;
        justify-content: center;
    }


    .alpport-ai-header {
        min-height: 62px;

        padding: 12px 14px;
    }


    .alpport-ai-header h1 {
        font-size: 18px;
    }


    .alpport-ai-header p {
        font-size: 12px;
    }


    .alpport-ai-messages {
        padding: 20px 12px;
    }


    .alpport-ai-welcome {
        margin: 70px auto 20px;

        padding: 0 8px;
    }


    .alpport-ai-welcome h2 {
        font-size: 24px;
    }


    .alpport-ai-message {
        margin-bottom: 16px;
    }


    .alpport-ai-message-content {
        max-width: 90%;

        font-size: 14px;
    }


    .alpport-ai-input-area {
        padding: 10px;
    }


    .alpport-ai-chat-form {
        gap: 7px;
    }


    .alpport-ai-chat-form textarea {
        min-height: 48px;

        padding: 12px;

        font-size: 14px;
    }


    .alpport-ai-chat-form button {
        min-width: 72px;
        min-height: 48px;

        padding: 10px 12px;
    }

}


/* =========================================================
   ÇOK DAR TELEFON
   ========================================================= */

@media (max-width: 480px) {

    .alpport-ai-chat-form button {
        min-width: 62px;

        padding-left: 9px;
        padding-right: 9px;
    }

    .alpport-ai-message-content {
        max-width: 94%;
    }

}
