﻿/* ========== Variables ========== */
:root {
    --kt-primary: #009ef7;
    --kt-primary-light: #f1faff;
    --kt-primary-active: #0084d3;
    --kt-gray-50: #f9fafb;
    --kt-gray-100: #f5f8fa;
    --kt-gray-200: #e9ecef;
    --kt-gray-300: #d1d5db;
    --kt-gray-400: #9ca3af;
    --kt-gray-500: #7e8299;
    --kt-gray-600: #5e6278;
    --kt-gray-700: #3f4254;
    --kt-gray-800: #2f3349;
    --kt-gray-900: #1d1f2d;
    --kt-Green-300: #51b587;
    --kt-white: #ffffff;
    --kt-transition: all 0.3s ease;
}

/* ========== Global Resets ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ========== Chat Container ========== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(130vh - 120px);
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--kt-gray-200);
    background: var(--kt-white);
    overflow: hidden;
}

/* ========== Chat Header ========== */
.chat-header {
    background: var(--kt-gray-100);
    border-bottom: 1px solid var(--kt-gray-200);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-title {
    display: flex;
    align-items: center;
}

    .chat-header-title .symbol {
        margin-left: 1rem;
    }

/* ========== Chat Body ========== */
.chat-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--kt-gray-50);
    scrollbar-width: thin;
    scrollbar-color: var(--kt-gray-300) transparent;
    scroll-behavior: smooth;
}

    .chat-messages::-webkit-scrollbar {
        width: 6px;
    }

    .chat-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .chat-messages::-webkit-scrollbar-thumb {
        background-color: var(--kt-gray-300);
        border-radius: 6px;
    }

/* ========== Message Items ========== */
.message-item {
    display: flex;
    margin-bottom: 1.5rem;
    max-width: 75%;
    align-self: flex-start;
    position: relative;
    margin-left: 15%;
    transition: var(--kt-transition);
}

    .message-item.message-out {
        align-self: flex-end;
        flex-direction: row-reverse;
        margin-right: 15%;
        margin-left: auto;
    }

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    background: var(--kt-primary-light);
    color: var(--kt-primary);
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.message-out .message-content {
    align-items: flex-end;
}

.message-info {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--kt-gray-500);
    font-size: 0.75rem;
    gap: 0.5rem;
}

.message-out .message-info {
    flex-direction: row-reverse;
}

.message-bubble {
    padding: 1rem 1.5rem;
    border-radius: 16px;
    max-width: 100%;
    min-width: 180px;
    word-break: break-word;
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    line-height: 1.6;
    transition: var(--kt-transition);
}

    .message-bubble.no-attachments {
        min-height: 80px;
        display: flex;
        align-items: center;
    }

.message-text {
    font-size: 0.875rem;
    color: var(--kt-white);
}

.bubble-primary {
    background: var( --kt-primary-active);
    color: var(--kt-white);
    border-bottom-right-radius: 4px;
}

.bubble-light {
    background: var(  --kt-Green-300);
    color: var(--kt-gray-800);
    border: 1px solid var(--kt-gray-200);
    border-bottom-left-radius: 4px;
}

    .bubble-light .message-text {
        color: var(--kt-gray-800);
    }

/* ========== Attachments ========== */
.message-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--kt-gray-300);
}

.attachment-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--kt-primary-light);
    border-radius: 8px;
    padding: 0.5rem;
    transition: var(--kt-transition);
    text-align: center;
}

    .attachment-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

.attachment-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kt-white);
}

    .attachment-preview img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.attachment-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--kt-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.attachment-download {
    background: var(--kt-primary-light);
    color: var(--kt-primary);
    border: none;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.675rem;
    transition: var(--kt-transition);
}

    .attachment-download:hover {
        background: var(--kt-primary);
        color: var(--kt-white);
    }

/* ========== Chat Footer ========== */
.chat-footer {
    background: var(--kt-white);
    border-top: 1px solid var(--kt-gray-200);
    padding: 1rem 1.5rem;
}

.dropzone-custom {
    border: 2px dashed var(--kt-gray-300);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: var(--kt-transition);
}

    .dropzone-custom:hover {
        border-color: var(--kt-primary);
        background: var(--kt-primary-light);
    }

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.message-input {
    flex-grow: 1;
    min-height: 80px;
    resize: none;
    border: 1px solid var(--kt-gray-300);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.875rem;
    transition: var(--kt-transition);
}

    .message-input:focus {
        border-color: var(--kt-primary);
        box-shadow: 0 0 0 3px var(--kt-primary-light);
    }

.send-button {
    height: 80px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--kt-primary);
    color: var(--kt-white);
    border: none;
    transition: var(--kt-transition);
}

    .send-button:hover {
        background: var(--kt-primary-active);
    }

/* ========== Responsive Design ========== */
@media (max-width: 1200px) {
    .chat-container {
        max-width: 100%;
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }
}

@media (max-width: 992px) {
    .message-item {
        max-width: 85%;
        margin-left: 10%;
        margin-right: 10%;
    }

    .message-bubble {
        min-width: 160px;
    }
}

@media (max-width: 768px) {
    .chat-header {
        padding: 1rem;
    }

    .message-item {
        max-width: 90%;
        margin-left: 5%;
        margin-right: 5%;
    }

    .message-bubble {
        min-width: 140px;
    }

    .message-attachments {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .attachment-preview {
        width: 35px;
        height: 35px;
    }

    .attachment-name {
        font-size: 0.675rem;
    }

    .attachment-download {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
    }

    .message-input-wrapper {
        flex-direction: column;
    }

    .send-button {
        width: 100%;
        height: 50px;
        margin-top: 0.5rem;
    }
}

/* ========== Animation Keyframes ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.message-item {
    animation: slideInUp 0.4s ease-out;
}
