/* =========================================
   RESET
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html,
body {
    width: 100%;
    min-height: 100%;
}


body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    color: #111;

    background: #ffffff;
}


button,
textarea {
    font: inherit;
}


/* =========================================
   PAGE
========================================= */

.app {
    width: 100%;
    min-height: 100vh;

    display: flex;
}


/* =========================================
   SIDEBAR
========================================= */

.sidebar {
    width: 260px;
    height: 100vh;

    position: fixed;

    top: 0;
    left: 0;

    padding: 35px 25px;

    background: #faf9f0;

    border-right: 1px solid #e5e5e5;
}


.logo {
    display: block;

    margin-bottom: 35px;

    color: #111;

    text-decoration: none;

    font-size: 27px;
    font-weight: 700;
}


/* =========================================
   HOME
========================================= */

.home-btn {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 13px;

    padding: 13px 15px;

    color: #111;

    text-decoration: none;

    border-radius: 10px;

    font-size: 16px;

    transition: background 0.2s ease;
}


.home-btn:hover {
    background: #efeee6;
}


.back-arrow {
    font-size: 22px;
}


/* =========================================
   MAIN
========================================= */

.main {
    width: calc(100% - 260px);
    min-height: 100vh;

    position: relative;

    margin-left: 260px;

    padding:
        40px
        35px
        220px;
}


/* =========================================
   EMPTY / RESULT AREA
========================================= */

.result-area {
    width: min(100%, 1000px);

    margin: 80px auto 0;

    text-align: center;
}


.result-area h1 {
    margin-bottom: 10px;

    font-size: 34px;
}


.result-area p {
    color: #777;

    font-size: 15px;
}


/* =========================================
   COMPOSER POSITION
========================================= */

.composer-wrapper {
    position: fixed;

    left: 260px;
    right: 0;
    bottom: 0;

    z-index: 100;

    padding:
        20px
        35px
        28px;

    background:
        linear-gradient(
            to top,
            #ffffff 75%,
            rgba(255, 255, 255, 0)
        );
}


/* =========================================
   CHATGPT-LIKE COMPOSER
========================================= */

.composer {
    width: min(100%, 950px);

    min-height: 115px;

    margin: auto;

    padding: 14px 15px 12px;

    background: #ffffff;

    border: 1px solid #dedede;
    border-radius: 28px;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.08);
}


/* =========================================
   PREVIEW ROW
========================================= */

.preview-row {
    display: none;

    width: 100%;

    gap: 10px;

    overflow-x: auto;

    padding:
        0
        0
        12px;

    scrollbar-width: thin;
}


.preview-row.has-images {
    display: flex;
}


/* =========================================
   PREVIEW ITEM
========================================= */

.preview-item {
    width: 105px;
    height: 105px;

    position: relative;

    flex: 0 0 105px;

    overflow: hidden;

    background: #f3f3f3;

    border: 1px solid #e2e2e2;
    border-radius: 16px;
}


.preview-item img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


/* REMOVE IMAGE */

.remove-image {
    width: 25px;
    height: 25px;

    position: absolute;

    top: 5px;
    right: 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    color: #fff;

    background:
        rgba(0, 0, 0, 0.72);

    border: none;
    border-radius: 50%;

    font-size: 17px;

    cursor: pointer;
}


.remove-image:hover {
    background: #000;
}


/* =========================================
   PROMPT
========================================= */

#promptInput {
    width: 100%;
    min-height: 48px;
    max-height: 150px;

    display: block;

    padding:
        10px
        8px;

    resize: none;

    overflow-y: auto;

    color: #222;

    background: transparent;

    border: none;
    outline: none;

    font-size: 16px;
    line-height: 1.5;
}


#promptInput::placeholder {
    color: #888;
}


/* =========================================
   CONTROLS
========================================= */

.composer-controls {
    width: 100%;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding:
        3px
        3px
        0;
}


.left-controls {
    display: flex;
    align-items: center;

    gap: 11px;
}


/* =========================================
   PLUS BUTTON
========================================= */

.plus-btn {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    color: #222;

    background: transparent;

    border: none;
    border-radius: 50%;

    font-size: 31px;
    font-weight: 300;

    cursor: pointer;
}


.plus-btn:hover {
    background: #f0f0f0;
}


/* =========================================
   COUNTER
========================================= */

.image-counter {
    color: #999;

    font-size: 12px;
}


.image-counter.limit {
    color: #333;

    font-weight: 600;
}


/* =========================================
   SEND / GENERATE
========================================= */

.send-btn {
    width: 45px;
    height: 45px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    color: #ffffff;

    background: #111;

    border: none;
    border-radius: 50%;

    font-size: 25px;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}


.send-btn:hover {
    background: #333;

    transform: scale(1.04);
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 650px) {

    .app {
        display: block;
    }


    /* HEADER */

    .sidebar {
        width: 100%;
        height: 65px;

        position: fixed;

        top: 0;
        left: 0;

        display: flex;
        align-items: center;

        padding: 0 15px;

        border-right: none;
        border-bottom: 1px solid #e5e5e5;

        z-index: 200;
    }


    .logo {
        margin: 0;

        font-size: 23px;
    }


    .home-btn {
        width: auto;

        margin-left: auto;

        padding: 8px 11px;

        font-size: 14px;
    }


    .back-arrow {
        font-size: 18px;
    }


    /* MAIN */

    .main {
        width: 100%;

        margin-left: 0;

        padding:
            100px
            14px
            190px;
    }


    .result-area {
        margin-top: 45px;
    }


    .result-area h1 {
        font-size: 28px;
    }


    /* COMPOSER */

    .composer-wrapper {
        left: 0;

        padding:
            15px
            10px
            18px;
    }


    .composer {
        min-height: 105px;

        padding:
            11px
            11px
            9px;

        border-radius: 24px;
    }


    /* IMAGES */

    .preview-item {
        width: 82px;
        height: 82px;

        flex-basis: 82px;

        border-radius: 13px;
    }


    /* PROMPT */

    #promptInput {
        min-height: 44px;

        padding:
            8px
            6px;

        font-size: 15px;
    }


    /* BUTTONS */

    .plus-btn {
        width: 39px;
        height: 39px;

        font-size: 28px;
    }


    .send-btn {
        width: 42px;
        height: 42px;

        font-size: 23px;
    }

}

.result-area {
    
    width: 100%;
    max-width: 650px;
    margin: 40px auto 160px;
    text-align: center;
}



#generatedImage {
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 0 auto;
    border-radius: 16px;
    object-fit: contain;
}

.download-btn {
    margin-top: 18px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: #111;
    color: white;
    font-size: 15px;
    cursor: pointer;
}

.download-btn:hover {
    opacity: 0.85;
}



.generating-state {
    display: none;
    width: 460px;
    max-width: 90%;
    margin: 80px auto;
}

.generating-state.show {
    display: block;
}

.generating-state p {
    font-size: 18px;
    margin-bottom: 25px;
    color: #555;
}


.generating-box {
    position: relative;

    width: 100%;
    aspect-ratio: 1 / 1;

    border-radius: 24px;

    overflow: hidden;

    background-image:
        radial-gradient(
            circle,
            #9ec5ff 2px,
            transparent 2px
        );

    background-size: 18px 18px;
}


.generating-glow {
    position: absolute;

    width: 180px;
    height: 180px;

    left: 50%;
    top: 50%;

    transform:
        translate(-50%, -50%);

    border-radius: 50%;

    background:
        rgba(70, 140, 255, 0.35);

    filter: blur(45px);

    animation:
        upscaloraGenerating 2s
        ease-in-out infinite;
}


@keyframes upscaloraGenerating {

    0% {
        transform:
            translate(-70%, -50%)
            scale(0.8);
        opacity: 0.4;
    }

    50% {
        transform:
            translate(-30%, -50%)
            scale(1.25);
        opacity: 1;
    }

    100% {
        transform:
            translate(-70%, -50%)
            scale(0.8);
        opacity: 0.4;
    }
}


.generated-result {
    display: none;
    text-align: center;
    margin: 40px auto 150px;
}


.generated-result.show {
    display: block;
}


#generatedImage {
    max-width: 600px;
    width: 90%;
    height: auto;

    border-radius: 18px;

    display: block;
    margin: auto;
}


.download-btn {
    margin-top: 20px;

    padding: 12px 25px;

    border: 0;
    border-radius: 10px;

    background: #111;
    color: white;

    cursor: pointer;
}


/* UPSCALORA LOGIN POPUP */

.login-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.login-popup-overlay[hidden] {
    display: none !important;
}

.login-popup-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 22px;
    padding: 34px 27px;
    text-align: center;
    color: #172033;
    box-shadow: 0 18px 65px rgba(0,0,0,0.2);
    animation: loginPopupIn 0.25s ease-out;
}

.login-popup-close {
    position: absolute;
    top: 13px;
    right: 18px;
    border: none;
    background: transparent;
    font-size: 29px;
    color: #64748b;
    cursor: pointer;
}

.login-popup-icon {
    width: 74px;
    height: 74px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #edf4ff;
    font-size: 38px;
}

.login-popup-card h2 {
    margin-bottom: 12px;
    font-size: 25px;
}

.login-popup-description {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 22px;
}

.login-popup-benefits {
    background: #f4f7ff;
    padding: 15px;
    border-radius: 14px;
    text-align: left;
    margin-bottom: 24px;
}

.login-popup-benefits p {
    margin: 11px 0;
    font-size: 14px;
}

.login-popup-button {
    display: block;
    padding: 15px;
    background: #2563eb;
    color: white;
    border-radius: 12px;
    font-weight: 650;
    text-decoration: none;
}

.login-popup-button:hover {
    background: #1d4ed8;
}

.login-popup-footer {
    color: #64748b;
    font-size: 12px;
    margin-top: 18px;
}

@keyframes loginPopupIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .login-popup-card {
        padding: 30px 20px;
    }

    .login-popup-card h2 {
        font-size: 22px;
    }
}