/*=============== GOOGLE FONTS ===============*/
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500;600&display=swap");

/*=============== VARIABLES CSS ===============*/
:root {
  /*========== Colors ==========*/
  --first-color: hsl(79, 100%, 49%);
  --white-color: #fff;
  --black-color: #000;

  /*========== Font and typography ==========*/
  --body-font: 'Poppins', sans-serif;
  --normal-font-size: .938rem;
  --tiny-font-size: .563rem;
}

/* Responsive typography */
@media screen and (min-width: 968px) {
  :root {
    --normal-font-size: 1rem;
  }
}

/*=============== BASE ===============*/
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  background-color: var(--white-color);
}

/*=============== MODERN INPUT ===============*/
.form {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 1.5rem;
}

.form__content {
    display: grid;
    row-gap: 1.5rem;
}

.form__input, 
.form__label, 
.form__submit {
    border: 0;
    outline: none;
    font-size: var(--normal-font-size);
    font-family: var(--body-font); 
}

.form__box {
    width: 321px;
    height: 59px;
    position: relative;
}

.form__shadow {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--black-color);
}

.form__input {
    position: absolute;
    border: 2.5px solid var(--black-color );
    background-color: var(--white-color);
    width: 100%;
    height: 100%;
    z-index: 10;
    padding: 18px;
    transition: transform .3s;
}

.form__input::placeholder {
    transition: opacity .5s;
}

.form__label {
    z-index: 100;
    position: absolute;
    top: 16px;
    left: 20px;
    font-size: var(--tiny-font-size);
    font-weight: 600;
    transition: .2s;
    pointer-events: none;
    opacity: 0;
}

.form__button {
    justify-self: flex-end;
    background-color: var(--black-color);
}

.form__submit {
    padding: .875rem 1.5rem;
    color: var(--black-color);
    background-color: var(--first-color);
    cursor: pointer;
    transition: transform .3s; 
}

.form__submit:hover {
    transform: translate(-6px, -6px);
}

/* Opaque placeholder */
.form__input:focus::placeholder {
    opacity: 0;
    transition: .3s;
}

/* Move input and sticky input up */
.form__input:focus, 
.form__input:not(:placeholder-shown).form__input:not(:focus) {
    transform: translate(-8px, -8px);
    padding: 28px 18px 18px;
    animation: input-animation .5s;
}

/* Move label and sticky label up */
.form__input:focus + .form__label, 
.form__input:not(:placeholder-shown).form__input:not(:focus) + .form__label {
    opacity: 1;
    top: 2px;   
    left: 12px;
    transition: .3s;
}

/* Input bounce animation */
@keyframes input-animation {
    0%{
        transform: translate(0);
    }
    40%{
        transform: translate(-9px, -9px);
    }
    60%{
        transform: translate(-7px, -7px);
    }
}

/*=============== BREAKPOINTS ===============*/
/* For small devices */
@media screen and (max-width: 340px) {
    .form__content,
    .form__box {
        width: 100%;
    }
}

/* For large devices */
@media screen and (min-width: 968px) {
    .form__content{
        zoom: 1.1;
    }
}

.code-container {
    position: relative;
    background-color: #282c34;
    border-radius: 8px;
    margin: 10px 0;
    font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.code-container pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 16px;
    margin: 0;
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
    white-space: pre;
}

.code-container .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #21252b;
    color: #abb2bf;
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    font-size: 0.9em;
}

.copy-btn {
    background-color: #4d78cc;
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.copy-btn:hover {
    background-color: #5a88db;
}

/* Thêm style cho danh sách tin nhắn */
#messages {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 70vh;
    overflow-y: auto;
}

#messages li {
    padding: 8px 12px;
    margin: 4px 0;
}

#chat-mes {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    margin-bottom: 8px;
    resize: vertical;
}

#chat-form {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

#messages {
    margin-bottom: 120px; /* Để tránh bị form che khuất */
}

#send-chat {
    width: 100%;
    padding: 8px;
    background: #4d78cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#send-chat:hover {
    background: #5a88db;
}

/* Thêm vào cuối file styles.css */
.chat-container {
    max-width: none;
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #36393f;
    color: #dcddde;
}

.chat-header {
    background: #2f3136;
    color: white;
    padding: 16px;
    border-bottom: 1px solid #202225;
    margin-bottom: 0;
}

.chat-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.room-info {
    font-size: 1rem;
    color: #ccc;
}

.message-header {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.message-content {
    color: #dcddde;
    margin-left: 0;
    font-size: 0.9375rem;
    line-height: 1.3;
}

/* Thêm vào cuối file */
.input-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-upload-btn:hover {
    background: #e0e0e0;
}

.file-upload-btn svg {
    color: #666;
}

.file-message {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    margin-top: 5px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.file-size {
    color: #666;
    font-size: 0.9em;
}

.download-btn {
    display: inline-block;
    padding: 6px 12px;
    background: #4d78cc;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background: #5a88db;
}

/* Thêm vào sau phần variables CSS */
.title-container {
    text-align: center;
    margin-bottom: 3rem;
    margin-top: -5rem;
}

.typewriter {
    color: var(--first-color);
    font-size: 3rem;
    font-weight: 600;
    overflow: hidden;
    border-right: .15em solid var(--first-color);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: .15em;
    animation: 
        typing 1.25s steps(10, end),
        blink-caret .75s step-end infinite;
}

/* Hiệu ứng gõ chữ */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* Hiệu ứng nhấp nháy con trỏ */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--first-color) }
}

/* Điều chỉnh responsive cho tiêu đề */
@media screen and (max-width: 768px) {
    .typewriter {
        font-size: 2rem;
    }
}

/* Cập nhật style cho khung chat */
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px;
    margin-bottom: 68px;
    background-color: #36393f;
}

#messages li {
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
}

/* Điều chỉnh form chat */
#chat-form {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 0;
    background: #36393f;
    border-top: 1px solid #202225;
    height: 68px;
}

.chat-input-container {
    background-color: #40444b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    margin: 0 16px;
}

#chat-mes {
    background: transparent;
    border: none;
    color: #dcddde;
    padding: 0.75rem 0;
    margin: 0;
    resize: none;
    height: 44px;
    max-height: 44px;
}

#chat-mes:focus {
    outline: none;
}

#chat-mes::placeholder {
    color: #72767d;
}

#send-chat {
    background: transparent;
    padding: 8px;
    color: #dcddde;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: auto;
}

#send-chat:hover {
    opacity: 1;
    background: transparent;
}

/* Style cho code blocks trong chat */
.code-container {
    background-color: #2f3136;
    border: 1px solid #202225;
    margin: 0.5rem 0;
}

.code-container .code-header {
    background-color: #202225;
    padding: 0.5rem 1rem;
}

/* Điều chỉnh scrollbar */
#messages::-webkit-scrollbar {
    width: 8px;
}

#messages::-webkit-scrollbar-track {
    background: #2f3136;
}

#messages::-webkit-scrollbar-thumb {
    background: #202225;
    border-radius: 4px;
}

#messages::-webkit-scrollbar-thumb:hover {
    background: #18191c;
}

/* Style cho phần upload file */
.chat-input-container {
    background-color: #40444b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    margin: 0 16px;
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 10px;
    color: #b9bbbe;
    transition: color 0.2s;
}

.file-upload-btn:hover {
    color: #dcddde;
}

#file-preview-container {
    margin: 8px 16px;
    padding: 8px 16px;
    background-color: #2f3136;
    border-radius: 4px;
}

.file-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#file-name {
    color: #dcddde;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

#cancel-upload {
    background-color: #4f545c;
    border: none;
    color: #dcddde;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

#cancel-upload:hover {
    background-color: #5d6269;
}

.file-message {
    background-color: #40444b;
    border: 1px solid #32353b;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.file-message:hover {
    background-color: #42464d;
    border-color: #5865f2;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0; /* Cho phép text truncate */
}

.file-info svg {
    color: #b9bbbe;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.file-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.file-name {
    color: #dcddde;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.file-size {
    color: #72767d;
    font-size: 0.7rem;
    font-weight: 400;
}

.download-btn {
    background-color: #5865f2;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    flex-shrink: 0;
}

.download-btn:hover {
    background-color: #4752c4;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.download-btn svg {
    width: 12px;
    height: 12px;
}

/* Hiệu ứng cho file message */
@keyframes fileAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-message {
    animation: fileAppear 0.3s ease-out;
}

/*=============== DRAG AND DROP OVERLAY ===============*/
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.drag-overlay-content {
    background: linear-gradient(135deg, #2c2f36 0%, #1e2124 100%);
    border: 2px dashed #5865f2;
    border-radius: 20px;
    padding: 60px 80px;
    text-align: center;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.drag-overlay-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 48%, rgba(88, 101, 242, 0.1) 50%, transparent 52%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.drag-overlay.active .drag-overlay-content {
    transform: scale(1);
    border-color: #00d4aa;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.15),
        0 0 30px rgba(0, 212, 170, 0.3);
}

.drag-overlay.active .drag-overlay-content::before {
    background: linear-gradient(45deg, transparent 48%, rgba(0, 212, 170, 0.15) 50%, transparent 52%);
}

.drag-icon {
    margin-bottom: 24px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.drag-icon svg {
    color: #ffffff;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}

.drag-overlay.active .drag-icon svg {
    color: #00d4aa;
    transform: scale(1.1);
}

.drag-text {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.drag-overlay.active .drag-text {
    color: #00d4aa;
}

.drag-subtext {
    font-size: 1rem;
    color: #b9bbbe;
    margin: 0;
    opacity: 0.8;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.drag-overlay.active .drag-subtext {
    color: #ffffff;
}

/*=============== FILE PREVIEW CARD ===============*/
.file-preview-card {
    position: absolute;
    bottom: 100%; /* Đặt phía trên chat input */
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background-color: #40444b;
    border: 1px solid #32353b;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    animation: slideDown 0.2s ease-out;
    z-index: 1000; /* Đảm bảo hiển thị trên các element khác */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-preview-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.file-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preview-filename {
    font-weight: 500;
    color: #ffffff; /* Đổi sang màu trắng cho dark theme */
    font-size: 0.95rem;
    word-break: break-all;
}

.preview-filesize {
    font-size: 0.8rem;
    color: #b9bbbe; /* Đổi sang màu xám sáng cho dark theme */
}

.cancel-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #b9bbbe; /* Màu xám sáng cho dark theme */
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cancel-file-btn:hover {
    background-color: #32353b; /* Dark hover background */
    color: #ffffff; /* Trắng khi hover */
}

.cancel-file-btn svg {
    width: 16px;
    height: 16px;
}

/* Enter key hint styling */
.enter-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.enter-key {
    background-color: #32353b;
    border: 1px solid #42464d;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-family: monospace;
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.enter-text {
    font-size: 0.75rem;
    color: #b9bbbe;
    font-weight: 500;
}

/*=============== ENHANCED CHAT INPUT ===============*/
.chat-input-container {
    position: relative; /* Cần để file-preview-card position absolute hoạt động */
}

.chat-input-container.file-staged #chat-mes {
    background-color: #36393f; /* Darker background để hiển thị readonly state */
    color: #72767d; /* Màu xám cho text */
    cursor: default; /* Thay đổi cursor */
    outline: 2px solid #5865f2; /* Thêm border để hiển thị active state */
    outline-offset: -2px;
}

.chat-input-container.file-staged #chat-mes::placeholder {
    color: #72767d; /* Màu placeholder xám */
}

/* Đảm bảo textarea luôn có thể focus khi file staged */
.chat-input-container.file-staged #chat-mes:focus {
    outline: 2px solid #00d4aa; /* Màu xanh khi focus */
    outline-offset: -2px;
}

/*=============== RESPONSIVE DESIGN ===============*/
@media (max-width: 768px) {
    .drag-overlay-content {
        padding: 40px 50px;
        margin: 20px;
        border-radius: 16px;
    }
    
    .drag-text {
        font-size: 1.3rem;
    }
    
    .drag-subtext {
        font-size: 0.9rem;
    }
    
    .drag-icon svg {
        width: 60px;
        height: 60px;
    }
    
    .file-preview-card {
        padding: 10px 12px;
    }
    
    .preview-filename {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .drag-overlay-content {
        padding: 30px 40px;
        margin: 15px;
    }
    
    .drag-text {
        font-size: 1.1rem;
    }
    
    .drag-subtext {
        font-size: 0.8rem;
    }
    
    .drag-icon svg {
        width: 50px;
        height: 50px;
    }
    
    /* File message responsive */
    .file-message {
        max-width: 240px;
        padding: 6px 10px;
    }
    
    .file-name {
        max-width: 140px;
        font-size: 0.8rem;
    }
    
    .file-size {
        font-size: 0.65rem;
    }
    
    .download-btn {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
}

