@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
}

:root {
    --first-color: #14b8a6; /* Teal */
    --dark-color: #0f766e; /* Dark Teal */
    --accent-color: #ec4899; /* Pink Accent */
    --card-color: #ffffff; /* White */
    --input-color: #f0fdfa; /* Light Teal */
    --text-color: #0f172a; /* Dark Blue-Gray */
    --placeholder-color: #64748b; /* Muted Gray */
    --border-color: #bae6fd; /* Light Blue */
    --body-color: linear-gradient(#f0fdfa, #a7f3d0); /* Light Teal Gradient */
    --color-gradient: linear-gradient(135deg, #14b8a6, #ec4899);
}

body.dark-theme {
    --card-color: #1e293b; /* Dark Blue */
    --input-color: #0f172a; /* Darker Background */
    --text-color: #f1f5f9; /* Light Gray */
    --placeholder-color: #94a3b8; /* Soft Gray */
    --border-color: #334155; /* Muted Blue */

    background: var(--card-color);
    background-image: radial-gradient(circle at 15% 50%, rgba(20, 184, 166, 0.15) 0%, transparent 35%),
                      radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15) 0%, transparent 35%),
                      radial-gradient(circle at 50% 80%, rgba(20, 184, 166, 0.1) 0%, transparent 40%);
}


.dark-theme .theme-toggle i.fa-sun {
    color: orange;
}


body{
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 15px;
    color: var(--text-color);
    background: linear-gradient(135deg, #f0fdfa, #bdf1d9);
}

.container{
    position: relative;
    width: 900px;
    padding: 32px;
    border-radius: 23px;
    background: var(--card-color);
    box-shadow: 0 10px 20px 0 rgba(0, 0, 0, .1);
    overflow: hidden;
}

body.dark-theme .container{
    border: 1px solid var(--border-color);
}

.container::before{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--color-gradient);
}

.header{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header .logo-wrapper{
    display: flex;
    align-items: center;
    gap: 18px;
}

.header .logo-wrapper .logo{
    display: flex;
    align-items: center;
    justify-content: center;
    height: 55px;
    width: 56px;
    color: var(--card-color);
    background: var(--color-gradient);
    font-size: 1.35rem;
    border-radius: 36% 64% 35% 65% / 61% 47% 53% 39% ;
    flex-shrink: 0;
}

.header .logo-wrapper h1{
    font-size: 1.9rem;
    font-weight: 700;
    text-transform: capitalize;
}

.header .theme-toggle{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 43px;
    color: var(--placeholder-color);
    background: var(--input-color);
    font-size: 1.5rem;
    border-radius: 36% 64% 35% 65% / 61% 47% 53% 39% ;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all .3s ease;
}

.header .theme-toggle:hover{
    color: var(--first-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.main-content{
    margin: 35px 0 5px;
}

.main-content .prompt-container{
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.prompt-container .prompt-input{
    padding: 16px 20px;
    width: 100%;
    min-height: 120px;
    line-height: 1.6;
    font-size: 1.05rem;
    border-radius: 15px;
    color: var(--text-color);
    background: var(--border-color);
    border: 1px solid var(--border-color);
    resize: vertical;
    transition: all .3s ease;
}

.prompt-container .prompt-input::placeholder{
    color: var(--placeholder-color);
}

.prompt-container .prompt-input:focus{
    outline: none;
    color: var(--text-color);
    box-shadow: 0 0 0 4px rgba(139, 91, 246, 0.15);
}

.prompt-container .prompt-btn{
    position: absolute;
    width: 35px;
    height: 35px;
    right: 15px;
    bottom: 15px;
    color: var(--card-color);
    background: var(--color-gradient);
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    opacity: .8;
    transition: all .3s ease;
}

.prompt-container .prompt-btn:hover{
    opacity: 1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.main-content .prompt-actions{
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.1fr 1fr;
    gap: 14px;
}

.prompt-actions .select-wrapper{
    position: relative;
}

.prompt-actions .select-wrapper::after{
    content: '\f078';
    position: absolute;
    right: 20px;
    top: 50%;
    padding-left: 7px;
    font-size: .9rem;
    font-weight: 900;
    font-family: "Font Awesome 6 Free";
    color: var(--accent-color);
    background: var(--input-color);
    transform: translateY(-50%);
    pointer-events: none;
}

.prompt-actions :where(.custom-select, .generate-btn){
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-color);
    cursor: pointer;
    text-transform: capitalize;
    transition: all .3s ease;
}

.prompt-actions .custom-select{
    width: 100%;
    height: 100%;
    outline: none;
    appearance: none;
    color: var(--text-color);
}

.prompt-actions .custom-select:is(:focus, :hover) {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.prompt-actions .generate-btn{
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 12px 25px;
    gap: 12px;
    color: var(--card-color);
    background: var(--color-gradient);
    font-weight: 500;
    border: none;
    transition: all .3s ease;
}

.prompt-actions .generate-btn:disabled {
    opacity: .6;
    pointer-events: none;
}

.prompt-actions .generate-btn:hover{
    box-shadow: 0 4px 10px rgba(109, 40, 217, 0.3);
    transform: translateY(-2px);
}

.main-content .gallery-grid:has(.img-card){
    margin-top: 30px;
}

.main-content .gallery-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.gallery-grid .img-card{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    aspect-ratio: 1;
    overflow: hidden;
    transition: all .3s ease;
}

.gallery-grid .img-card:not(.loading, .error):hover{
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1);
}

.gallery-grid .img-card .result-img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-grid .img-card:is(.loading, .error) :is(.result-img, .img-overlay){
    display: none;
}

.gallery-grid .img-card .img-overlay{
    position: absolute;
    display: flex;
    justify-content: flex-end;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .8));
    opacity: 0;
    pointer-events: none;
    transition: all .3s ease;
}

.gallery-grid .img-card:hover .img-overlay{
    opacity: 1;
    pointer-events: auto;
}

.gallery-grid .img-card .img-download-btn{
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    width: 35px;
    color: var(--card-color);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter:blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all .3s ease;
}

.gallery-grid .img-card .img-download-btn:hover{
    transform: scale(1.05);
    background: rgba(255, 255, 255, .4);
}

.gallery-grid .img-card .status-container{
    display: none;
    align-items: center;
    flex-direction: column;
    padding: 15px;
    gap: 13px;
}

.gallery-grid .img-card:where(.loading, .error) .status-container{
    display: flex;
}

.gallery-grid .img-card.loading .status-container i,
.gallery-grid .img-card.error .loader{
    display: none;
}

.gallery-grid .img-card.error .status-container i{
    font-size: 1.7rem;
    color: #ff0000;
}

.gallery-grid .img-card.loading .loader {
    height: 30px;
    aspect-ratio: 2.5;
    --_g: no-repeat radial-gradient(farthest-side,#000 90%,#0000);
    background:var(--_g), var(--_g), var(--_g), var(--_g);
    background-size: 20% 50%;
    animation: l43 1s infinite linear; 
  }

  @keyframes l43 {
    0%     {background-position: calc(0*100%/3) 50% ,calc(1*100%/3) 50% ,calc(2*100%/3) 50% ,calc(3*100%/3) 50% }
    16.67% {background-position: calc(0*100%/3) 0   ,calc(1*100%/3) 50% ,calc(2*100%/3) 50% ,calc(3*100%/3) 50% }
    33.33% {background-position: calc(0*100%/3) 100%,calc(1*100%/3) 0   ,calc(2*100%/3) 50% ,calc(3*100%/3) 50% }
    50%    {background-position: calc(0*100%/3) 50% ,calc(1*100%/3) 100%,calc(2*100%/3) 0   ,calc(3*100%/3) 50% }
    66.67% {background-position: calc(0*100%/3) 50% ,calc(1*100%/3) 50% ,calc(2*100%/3) 100%,calc(3*100%/3) 0   }
    83.33% {background-position: calc(0*100%/3) 50% ,calc(1*100%/3) 50% ,calc(2*100%/3) 50% ,calc(3*100%/3) 100%}
    100%   {background-position: calc(0*100%/3) 50% ,calc(1*100%/3) 50% ,calc(2*100%/3) 50% ,calc(3*100%/3) 50% }
  }

  .footer{
    position: absolute;
    display: block;
    bottom: 0;
    padding: 10px;
    text-align: center;
    color: #525252;
    font-size: .80rem;
    text-transform: capitalize;
}

  @keyframes l13{ 
    100%{transform: rotate(1turn)}
  }

  .gallery-grid .img-card .status-text{
    text-align: center;
    font-size: .88rem;
    color: var(--placeholder-color);
    text-transform: capitalize;
  }

  @media (max-width: 768px) {
    .container{
        padding: 18px;
    }

    .header .logo-wrapper .logo {
        height: 50px;
        width: 51px;
        font-size: 1.25rem;
    }

    .header .logo-wrapper h1 {
        font-size: 1.5rem;
    }

    .main-content .prompt-actions {
        grid-template-columns: 1fr;
        margin-top: -10px;
    }

    .prompt-actions .generate-btn {
        margin: 10px 0 0;
    }

    .gallery-grid .img-card .img-overlay {
        opacity: 1;
    }
  }