body {
    font-family: Arial, sans-serif;
    background: #3b3b3b;
    color: #333;
    display: flex;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
}

.content {
    background: linear-gradient(270deg, #202020, #353430, #aa9b73, #ffdd66, #ffcc00);
    background-size: 400% 400%;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    width: 66.66%;
    animation: animatedGradient 15s ease infinite;
}

.result {
    width: 900px;
    height: 900px;
    overflow: hidden;
    cursor: grab;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.result img {
    width: 100%;
    height: auto;
    transform-origin: 0 0;
    object-fit: contain;
    border-radius: 20px;
    /* filter: hue-rotate(335deg) saturate(150%) brightness(1.05); */
    filter: grayscale(50%) contrast(115%) brightness(95%);
}

.panel {
    background: #ffcc00;
    color: #000;
    width: 33.33%;
    padding: 20px;
    text-align: center;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 100vh;
}

.panel-content {
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.top-buttons,
.size-buttons,
.model-buttons {
    margin-bottom: 20px;
}

.button {
    background: #ffcc00;
    color: #3b3b3b;
    border: 2px solid #3b3b3b;
    border-radius: 10px;
    padding: 10px 20px;
    margin: 0 10px;
    cursor: pointer;
    text-align: center;
}

.button.active {
    background: #3b3b3b;
    color: #fff;
}

.form-container {
    width: 100%;
    background-color: #ffcc00;
    padding: 10px;
    box-sizing: border-box;
    z-index: 100;
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex; /* Added to align items horizontally */
    justify-content: center; /* Align items horizontally */
    align-items: center; /* Align items vertically */
}

textarea {
    background: #ffbd43;
    height: 35vh;
    width: calc(100% - 3px);
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    resize: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 30px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-align: left;
    line-height: 1.5;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    color: #807077;
    outline: none;
    color: #b94b70;
    border-radius: 8px;
    height: 300px;
    width: 90%;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: #4a4a4a #2d2d2d;
}

textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: #2d2d2d;
}

textarea::-webkit-scrollbar-thumb {
    background-color: #4a4a4a;
    border-radius: 10px;
    border: 2px solid #2d2d2d;
}

textarea::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

input[type="submit"],
input[type="button"] {
    background: #3b3b3b;
    color: var(--button-text-color, #ffcc00);
    padding: 10px 20px;
    border: 2px solid #3b3b3b;
    cursor: pointer;
    border-radius: 15px;
    /*margin-left: 10px; */ /*Remove this line*/
    flex: 1; /* Chia đều không gian */
    margin: 0 5px; /* Thêm khoảng cách giữa các nút */
    box-sizing: border-box; /* Đảm bảo padding và border không ảnh hưởng đến kích thước */
    height: 40px; /* Đặt chiều cao cố định */
    display: flex;
    justify-content: center; /* Căn giữa theo chiều ngang */
    align-items: center; /* Căn giữa theo chiều dọc */
    text-align: center; /* Đảm bảo text bên trong thẻ cũng được căn giữa */
}

input[type="submit"]:hover,
input[type="button"]:hover {
    background: var(--button-hover-bg);
    color: #000;
}

.loading-border {
    border: 3px dashed #ffcc00;
    position: absolute;
    animation: blink 1s infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes animatedGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.progress-circle {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 5px solid #ffcc00;
    border-top: 5px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

img.fade-out {
    animation: fadeOut 0.1s forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.size-buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.size-buttons .button {
    background: #ffcc00;
    color: #000;
    border: 2px solid #3b3b3b;
    border-radius: 10px;
    padding: 10px;
    margin: 0 10px;
    cursor: pointer;
    text-align: center;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
}

.size-buttons .button.active {
    background: #3b3b3b;
    color: #ffffff;
}

.Tu-khoa-nhanh-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.Tu-khoa-nhanh {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.Tu-khoa-nhanh .button {
    background: #ffcc00;
    color: #000;
    border: 2px solid #3b3b3b;
    border-radius: 10px;
    padding: 10px;
    margin: 5px;
    cursor: pointer;
    text-align: center;
    width: 70px;
    height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
    font-size: 14px;
    box-sizing: border-box;
}

.Tu-khoa-nhanh .button.active {
    background: #3b3b3b;
    color: #ffffff;
    border: 2px solid #3b3b3b;
}

.model-buttons-container {
    display: flex;
}

.model-buttons {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 50px;
    overflow-x: auto;
    white-space: nowrap;
}

.model-buttons .button {
    background: #ffcc00;
    color: #000;
    border: 2px solid #3b3b3b;
    border-radius: 10px;
    /*padding: 10px; Loại bỏ hoặc điều chỉnh padding */
    padding: 0; /* Loại bỏ padding để đảm bảo kích thước chính xác */
    margin: 0 10px;
    cursor: pointer;
    text-align: center;
    width: 80px; /* Kích thước chiều rộng (ví dụ) */
    height: 80px; /* Kích thước chiều cao (ví dụ) */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5vmin;  /* Kích thước font chữ linh hoạt */
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;

    white-space: nowrap;
    overflow: hidden;      /* Ẩn phần văn bản bị tràn */
    text-overflow: ellipsis; /* Thêm dấu ba chấm */
    line-height: 1;  /* Đảm bảo line-height không làm tăng chiều cao */
    flex-shrink: 0; /* Ngăn nút co lại nếu không đủ không gian */
}

.model-buttons .button.active {
    background: #3b3b3b;
    color: #ffffff;
    border: 2px solid #3b3b3b;
}

.model-buttons::-webkit-scrollbar {
    height: 8px;
}

.model-buttons::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-radius: 50%;
    border-top-color: #333;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

img.fade-out {
    animation: fadeOut 0.1s forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}
.top-right-buttons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 300;
}

.square-button {
    background: rgba(255, 255, 255, 0.5);
    color: #000;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 300;
    border-radius: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
}

.square-button:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* Style cho biểu tượng tải xuống */
.square-button i {
    font-size: 16px;
    /* Điều chỉnh kích thước biểu tượng nếu cần */
}

/* Thêm class và animation fade-in */
.result img.fade-in {
    animation: fadeIn 2s ease-in-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* CSS hiện tại của bạn */

/* CSS cho nút "Biên tập Prompt" và hộp thoại modal */
#editPromptButton {
    background: #3b3b3b;
    color: #ffcc00;
    border: 2px solid #3b3b3b;
    padding: 10px 20px;
    border-radius: 15px;
    flex: 1; /* Chia đều không gian */
    margin: 0 5px; /* Thêm khoảng cách giữa các nút */
    box-sizing: border-box; /* Đảm bảo padding và border không ảnh hưởng đến kích thước */
    height: 40px; /* Đặt chiều cao cố định */
    display: flex;
    justify-content: center; /* Căn giữa theo chiều ngang */
    align-items: center; /* Căn giữa theo chiều dọc */
    text-align: center; /* Đảm bảo text bên trong thẻ cũng được căn giữa */
    transition: all 0.3s ease-in-out;
}


#editPromptButton:hover {
    background: #ffcc00;
    /* Màu nền khi hover */
    color: #000;
    /* Màu chữ khi hover */
}

/* Style cho hộp thoại (modal) */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.719);
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: #ffcc00;
    margin: 10% auto;
    /* Canh giữa */
    padding: 20px;
    border: 1px solid #888;
    width: 70%;
    /* Chiều rộng hộp thoại */
    max-height: 70vh;
    /* Chiều cao tối đa */
    overflow-y: auto;
    /* Thêm thanh cuộn dọc khi cần */
    position: relative;
    /* Để định vị nút đóng */
    border-radius: 20px;
}

.modal-content::-webkit-scrollbar {
    width: 5px;
    /* Độ rộng của thanh cuộn */
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    /* Màu của thanh cuộn */
    border-radius: 10px;
    /* Độ cong của góc thanh cuộn */
}

.close {
    position: absolute;
    top: 0;
    right: 0;
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 5px;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* CSS Reset */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
li,
form,
input,
textarea,
button {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    box-sizing: border-box;
    /* Quan trọng: đảm bảo padding và border không làm thay đổi kích thước phần tử */
}

/* CSS cho vùng chứa textarea và các nút */
.textarea-wrapper {
    position: relative;
    /* Để định vị tuyệt đối các nút */
    width: 100%;
    /* Chiều rộng bằng textarea */
}

/* CSS cho textarea */
textarea {
    width: 100%;
    /* Chiều rộng 100% của vùng chứa */
    /* Các thuộc tính khác giữ nguyên */
}

/* CSS cho các nút Copy, Paste, Clear */
.textarea-buttons {
    position: absolute;
    /* Định vị tuyệt đối bên trong textarea-wrapper */
    bottom: 10px;
    /* Cách đáy textarea 10px */
    right: 10px;
    /* Cách phải textarea 10px */
    display: flex;
    /* Sắp xếp các nút theo hàng ngang */
    gap: 5px;
    /* Khoảng cách giữa các nút */
    z-index: 10;
    /* Đảm bảo nút hiển thị trên textarea */
}

.textarea-buttons button {
    background: transparent;
    /* Nền trong suốt */
    border: none;
    /* Không có viền */
    color: #807077;
    /* Màu biểu tượng */
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    font-size: 16px;
    /* Điều chỉnh kích thước biểu tượng */
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.textarea-buttons button:hover {
    opacity: 1;
    /* Hiệu ứng hover */
    background-color: rgba(0, 0, 0, 0.1);
    /* Màu nền nhạt khi hover */
}

