* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #ffffff;
    color: #111;
}


/* =========================
   WHOLE PAGE
========================= */

.app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}


/* =========================
   LEFT SIDEBAR
========================= */

.sidebar {
    width: 275px;
    min-width: 275px;
    height: 100vh;

    position: fixed;
    top: 0;
    left: 0;

    background: #fffdf4;

    border-right: 1px solid #e4e4e4;

    padding: 38px 26px;

    z-index: 100;
}


/* LOGO */

.logo {
    font-size: 29px;
    font-weight: 700;
    color: #111;

    margin-bottom: 55px;
}


/* HOME */

.home-btn {
    display: flex;
    align-items: center;
    gap: 15px;

    width: fit-content;

    margin-left: 15px;

    color: #111;
    text-decoration: none;

    font-size: 17px;
    font-weight: 400;

    padding: 8px 0;

    transition: opacity 0.2s ease;
}

.home-btn:hover {
    opacity: 0.6;
}

.back-arrow {
    font-size: 24px;
    line-height: 1;
}


/* =========================
   RIGHT CONTENT
========================= */

.main-content {
    margin-left: 275px;

    width: calc(100% - 275px);
    min-height: 100vh;

    position: relative;

    background: #fff;
}


/* =========================
   GENERATOR
========================= */

.generator-area {
    position: fixed;

    left: calc(275px + (100% - 275px) / 2);
    transform: translateX(-50%);

    bottom: 35px;

    width: min(850px, calc(100% - 335px));

    z-index: 100;
}

.generator-area::before {
    content: "";

    position: absolute;

    left: -30px;
    right: -30px;
    top: -25px;
    bottom: -35px;

    background: #fff;

    z-index: -1;
}


/* TITLE */

.generator-title {
    text-align: center;

    font-size: 32px;
    font-weight: 700;

    margin-bottom: 400px;

    color: #111;
}


/* =========================
   DESCRIBE BOX
========================= */

.describe-box {
    width: 100%;
    min-height: 125px;

    position: relative;

    background: #fff;

    border: 1px solid #dedede;
    border-radius: 28px;

    padding: 24px 90px 24px 25px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
}


/* TEXT AREA */

.describe-box textarea {
    width: 100%;
    height: 75px;

    border: none;
    outline: none;

    resize: none;

    background: transparent;

    font-family: Arial, Helvetica, sans-serif;

    font-size: 17px;
    line-height: 1.5;

    color: #111;
}

.describe-box textarea::placeholder {
    color: #888;
}


/* =========================
   GENERATE BUTTON
========================= */

.generate-btn {
    position: absolute;

    right: 20px;
    bottom: 20px;

    width: 50px;
    height: 50px;

    border: none;
    border-radius: 50%;

    background: #111;
    color: #fff;

    font-size: 27px;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.generate-btn:hover {
    background: #292929;
    transform: scale(1.05);
}

.generate-btn:active {
    transform: scale(0.95);
}



/* =========================
   GPT GENERATING DOTS
========================= */

.generating-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.generating-dots span {
    width: 6px;
    height: 6px;

    background: #ffffff;
    border-radius: 50%;

    display: block;

    animation: dotBounce 0.9s infinite ease-in-out;
}

.generating-dots span:nth-child(1) {
    animation-delay: 0s;
}

.generating-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.generating-dots span:nth-child(3) {
    animation-delay: 0.30s;
}

@keyframes dotBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

/* ==========================================
   MOBILE - CHATGPT STYLE
========================================== */

@media (max-width: 768px) {

    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow-x: hidden;
    }


    /* =========================
       TOP HEADER
    ========================= */

    .sidebar {
        position: fixed;

        top: 0;
        left: 0;

        width: 100%;
        min-width: 0;
        height: 60px;

        padding: 0 16px;

        display: flex;
        align-items: center;
        justify-content: center;

        background: #fff;

        border-right: none;
        border-bottom: 1px solid #e8e8e8;

        z-index: 1000;
    }


    /* UPscalora */

    .logo {
        position: absolute;

        left: 50%;
        transform: translateX(-50%);

        margin: 0;

        font-size: 20px;
        font-weight: 700;

        white-space: nowrap;
    }


    /* HOME BUTTON */

    .home-btn {
        position: absolute;

        left: 16px;

        margin: 0;
        padding: 8px 0;

        gap: 6px;

        font-size: 14px;
    }


    .back-arrow {
        font-size: 20px;
    }


    /* =========================
       MAIN CHAT AREA
    ========================= */

    .main-content {
        margin-left: 0;
        margin-top: 60px;

        width: 100%;
        min-height: calc(100vh - 60px);

        background: #fff;
    }


    /* =========================
       ANSWERS
    ========================= */

    .answer-area {
        width: 100%;

        margin: 0;

        padding:
            25px
            18px
            180px
            18px;

        font-size: 15px;
        line-height: 1.65;
    }


    /* USER MESSAGE */

    .user-message {
        width: fit-content;
        max-width: 82%;

        margin-left: auto;
        margin-bottom: 22px;

        padding: 10px 15px;

        background: #f1f1f1;

        border-radius: 18px;

        font-size: 15px;
        line-height: 1.45;

        overflow-wrap: break-word;
    }


    /* AI MESSAGE */

    .ai-message {
        width: 100%;

        margin-bottom: 32px;

        padding: 0;

        background: transparent;

        font-size: 15px;
        line-height: 1.7;

        overflow-wrap: break-word;
    }


    /* =========================
       BOTTOM PROMPT AREA
    ========================= */

    .generator-area {
        position: fixed;

        left: 0;
        bottom: 0;

        transform: none;

        width: 100%;

        padding:
            10px
            12px
            14px
            12px;

        background: #fff;

        z-index: 900;
    }


    /* remove desktop white extension */

    .generator-area::before {
        display: none;
    }


    /* STARTING TITLE */

    .generator-title {
        font-size: 23px;

        text-align: center;

        margin-bottom: 500px;
    }


    /* =========================
       PROMPT BOX
    ========================= */

    .describe-box {
        width: 100%;

        min-height: 62px;

        padding:
            14px
            60px
            10px
            17px;

        border: 1px solid #dedede;

        border-radius: 26px;

        background: #fff;

        box-shadow:
            0 2px 12px rgba(0, 0, 0, 0.08);
    }


    /* TEXTAREA */

    .describe-box textarea {
        width: 100%;

        height: 38px;
        min-height: 38px;

        font-size: 16px;
        line-height: 1.4;

        padding-top: 5px;

        resize: none;
    }


    /* SEND BUTTON */

    .generate-btn {
        width: 42px;
        height: 42px;

        right: 10px;
        bottom: 10px;

        font-size: 22px;
    }

}
/* =========================
   CHAT / ANSWERS
========================= */

.answer-area {
    width: min(800px, calc(100% - 60px));

    margin-left: auto;
    margin-right: auto;

    padding-top: 70px;
    padding-bottom: 230px;

    position: relative;

    font-size: 16px;
    line-height: 1.7;
}


/* USER MESSAGE */

.user-message {
    width: fit-content;
    max-width: 70%;

    margin-left: auto;
    margin-bottom: 30px;

    padding: 12px 18px;

    background: #f1f1f1;

    border-radius: 20px;

    color: #111;

    font-size: 16px;
    line-height: 1.5;

    white-space: pre-wrap;
}


/* GEMINI ANSWER */

.ai-message {
    width: 100%;

    margin-bottom: 40px;

    color: #111;

    background: transparent;

    font-size: 16px;
    line-height: 1.75;

    white-space: pre-wrap;

    overflow-wrap: break-word;
}





/* ==========================
   ASKIF CHAT HISTORY
========================== */

.new-chat-btn {
    display: block;
    width: 100%;
    margin-top: 30px;
    padding: 12px 15px;
    background: #ffffff;
    border: 1px solid #dedede;
    border-radius: 12px;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.new-chat-btn:hover {
    background: #f1f1f1;
}

.chat-history-section {
    margin-top: 28px;
}

.chat-history-section h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: #777;
}

.chat-history-list {
    max-height: calc(100vh - 330px);
    overflow-y: auto;
}

.chat-history-item {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    border-radius: 10px;
}

.chat-history-item.active,
.chat-history-item:hover {
    background: #eeeeee;
}

.chat-history-title {
    flex: 1;
    min-width: 0;
    padding: 12px 8px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-chat-btn {
    border: none;
    background: transparent;
    padding: 8px;
    cursor: pointer;
    color: #777;
}

.delete-chat-btn:hover {
    color: #d22;
}




/* MOBILE CHATGPT-STYLE SIDEBAR */

.mobile-menu-btn,
.close-sidebar-btn,
.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {

    /* Hamburger button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px;
        left: 12px;
        width: 44px;
        height: 44px;
        border: none;
        background: transparent;
        color: #111;
        font-size: 26px;
        cursor: pointer;
        z-index: 1100;
        touch-action: manipulation;
    }

    /* Sliding sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(300px, 82vw);
        min-width: 0;
        height: 100dvh;
        padding: 65px 18px 20px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        background: #fffdf4;
        border-right: 1px solid #e5e5e5;
        border-bottom: none;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 1200;
        overflow-y: auto;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* Logo */
    .sidebar .logo {
        position: static;
        left: auto;
        transform: none;
        margin: 0 0 25px;
        font-size: 23px;
    }

    /* Home */
    .sidebar .home-btn {
        position: static;
        margin: 0;
        font-size: 16px;
    }

    /* New Chat */
    .sidebar .new-chat-btn {
        display: block;
        margin-top: 20px;
    }

    /* Chat history */
    .sidebar .chat-history-section {
        display: flex;
        flex-direction: column;
        margin-top: 25px;
        min-height: 0;
    }

    .sidebar .chat-history-list {
        max-height: none;
        overflow-y: auto;
    }

    /* Close button */
    .close-sidebar-btn {
        display: block;
        position: absolute;
        top: 13px;
        right: 15px;
        border: none;
        background: transparent;
        font-size: 30px;
        cursor: pointer;
    }

    /* Dark overlay */
    .sidebar-overlay.visible {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1150;
    }

    /* Fixed mobile header */
    .main-content::before {
        content: "UPscalora";
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: #fff;
        border-bottom: 1px solid #eee;
        font-size: 20px;
        font-weight: 700;
        z-index: 1000;
        pointer-events: none;
    }
}

/* Cloud history feedback and responsive chat corrections */
.askif-status { color: #ab3030; margin: 16px 0; font-size: 14px; }
.chat-history-title:disabled, .delete-chat-btn:disabled { opacity: .5; cursor: wait; }
@media (max-width: 768px) {
    .answer-area { width: 100%; margin: 0; padding: 25px 18px 180px; }
    .user-message { max-width: 82%; font-size: 15px; }
    .ai-message { font-size: 15px; }
}
