/* Import Montserrat font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');

/* Define root variables for color scheme */
:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent-color: rgba(255, 255, 255, 0.2);
    --active-color: #ffffff;
}

/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base body styles */
body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Create animated background effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background-image: url('bg.webp'), url('bg.webp');
    background-size: 50% 100%;
    background-position: 0 0, 100% 0;
    background-repeat: no-repeat;
    filter: blur(60px);
    z-index: -1;
    animation: moveBackground 20s linear infinite;
}

/* Define keyframes for background animation */
@keyframes moveBackground {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Header styles */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--accent-color);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Heading styles */
h1,
h2 {
    text-align: center;
    padding: 10px 0;
    font-weight: 900;
    letter-spacing: 5px;
}

/* Paragraph styles */
p {
    text-align: justify;
    padding: 10px 0;
    font-size: 16px;
    font-weight: 600;
}

/* Container for centering content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation tabs styles */
.tabs {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

/* Tab and button styles */
.tab,
.bat {
    font-family: 'Montserrat', sans-serif;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
    background: none;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Active tab and button styles */
.tab.active,
.bat.active {
    background-color: var(--active-color);
    color: var(--bg-color);
}

/* Hover effects for tabs and buttons */
.tab:hover,
.bat:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Content section styles */
.content {
    display: none;
    padding: 20px;
}

/* Active content section */
.content.active {
    display: block;
}

/* Home section styles */
#home {
    column-count: 4;
    column-gap: 20px;
    padding: 20px;
}

/* Image item styles */
.image-item {
    break-inside: avoid;
    margin-bottom: 20px;
}

.image-item img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Image grid styles */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.image-grid .image-item {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.image-grid .image-item:hover {
    transform: scale(1.05);
}

.image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* This creates a 1:1 aspect ratio */
    overflow: hidden;
}

.image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-grid .image-description {
    padding: 10px;
    text-align: center;
    font-size: 14px;
}

/* Image generation form styles */
#image-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
}

#prompt {
    flex-grow: 1;
    padding: 10px;
    border: none;
    border-radius: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

/* Result display styles */
#result {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

#result img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Text selection styles */
::selection {
    background-color: var(--active-color);
    color: var(--bg-color);
}

/* Responsive design for different screen sizes */
@media (max-width: 1200px) {
    #home {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    #home {
        column-count: 2;
    }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
        align-items: center;
    }

    .tab,
    .bat {
        width: 100%;
        margin-bottom: 10px;
    }

    #image-form {
        flex-direction: column;
    }

    #prompt {
        width: 100%;
    }

    #home {
        column-count: 1;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Enhance section styles */
#enhance {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.enhance-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.enhance-text {
    position: fixed;
    top: 400px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 24px;
}

/* Enhance background with image rotation */
.enhance-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(1);
    border-radius: 20px;
    transition: transform 0.3s ease-out, filter 0.3s ease-out;  
    animation: changeImage 90s infinite;
}

/* Define keyframes for image rotation */
@keyframes changeImage {
    0%, 100% {
        background-image: url('https://ideogram.ai/api/images/direct/5MmOoNP1Thepwfm4y_7PzA.jpg');
    }
    11% {
        background-image: url('https://ideogram.ai/api/images/direct/2q24meocS0KigC6jjmN_Jw.jpg');
    }
    22% {
        background-image: url('https://ideogram.ai/api/images/direct/G8Au6X4vQRGEjttYMjOrdw.jpg');
    }
    33% {
        background-image: url('https://ideogram.ai/api/images/direct/VTTXDo3dQZKBWfTqEORe3w.jpg');
    }
    44% {
        background-image: url('https://ideogram.ai/api/images/direct/MazKzFJFRSWkQBgT0iZSBQ.jpg');
    }
    55% {
        background-image: url('https://ideogram.ai/api/images/direct/QGrve_0ERSqzsPy86ucQMQ.jpg');
    }
    66% {
        background-image: url('https://ideogram.ai/api/images/direct/Kptm1UTSQsyvSB3etig7dw.jpg');
    }
    77% {
        background-image: url('https://ideogram.ai/api/images/direct/JgapOv7pR0mUf0lJpA9qqQ.jpg');
    }
    88% {
        background-image: url('https://ideogram.ai/api/images/direct/0Yh1FD99Tk6DaxoqnGuBVw.jpg');
    }
}

/* Create fade effect for background transition */
.enhance-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    background-size: cover;
    background-position: center;
    transition: opacity 3s ease-in-out;
    opacity: 0;
}

.enhance-background.fade::before {
    opacity: 1;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .enhance-text {
        top: 200px;
        font-size: 18px;
        padding: 8px 16px;
    }

    .enhance-background {
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .enhance-text {
        top: 100px;
        font-size: 16px;
        padding: 6px 12px;
    }

    .enhance-background {
        border-radius: 5px;
    }
    .image-grid {
        grid-template-columns: 1fr;
    }
}

/* Add these styles for the image container */
#image-container {
    width: min(30vw, 90vh, 1024px);
    height: min(30vw, 90vh, 1024px);
    margin: 20px auto;
    position: relative;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

#result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#result img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Update the media queries for better responsiveness */
@media (max-height: 900px) {
    #image-container {
        width: min(80vw, 80vh, 1024px);
        height: min(80vw, 80vh, 1024px);
    }
}

@media (max-height: 700px) {
    #image-container {
        width: min(70vw, 70vh, 1024px);
        height: min(70vw, 70vh, 1024px);
    }
}

@media (max-height: 600px) {
    #image-container {
        width: min(60vw, 60vh, 1024px);
        height: min(60vw, 60vh, 1024px);
    }
}

/* Adjust the form layout for better spacing */
#image-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 20px;
}

#prompt {
    flex-grow: 1;
    max-width: 600px;
}

/* Add these styles for the generate section */
#generate .box4 {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Media query for mobile devices */
@media (max-width: 768px) {
    #generate .box4 {
        flex-direction: column;
    }

    #image-form {
        order: 2;
        margin-top: 20px;
        flex-direction: column;
        align-items: center;
    }

    #image-container {
        order: 1;
    }

    #prompt {
        width: 100%;
        margin-bottom: 10px;
    }

    .bat {
        width: 100%;
    }
}

/* Update the media query for smaller screens */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* Update these styles for the image actions */
.image-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#image-container:hover .image-actions {
    opacity: 1;
}

.action-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.action-btn i {
    color: var(--text-color);
    font-size: 18px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Media query for mobile devices */
@media (max-width: 768px) {
    .image-actions {
        opacity: 1; /* Always visible on mobile */
        bottom: 20px; /* Increase bottom spacing for better touch targets */
        right: 20px;
    }

    .action-btn {
        width: 40px; /* Larger buttons for easier tapping */
        height: 40px;
    }

    .action-btn i {
        font-size: 20px; /* Larger icons for better visibility */
    }
}