:root {
    --primary: #AA2B8B !important;
    --primary-hover: #8F1A73 !important;
    --heading-font: 'Cormorant Garamond', serif;
    --body-font: 'Raleway', sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--body-font);
    font-weight: 300;
    background-color: #fdfbf5;
}

body.dragging:after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 9999;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1rem;
}

.main-heading {
    font-family: var(--heading-font);
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    text-align: center;
    margin: 0 auto 2rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    padding: 0 10px;
}

@media (max-width: 480px) {
    .main-heading {
        font-size: clamp(1.8rem, 7vw, 2.2rem);
    }
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 0 1rem 0;
}

.upload-section, .result-section {
    width: 100%;
}

.image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    background-color: transparent;
}

/* Make containers consistent between placeholder and result */
#resultImageContainer {
    flex: 1;
    max-width: 100%;
    position: relative;
    background-color: transparent;
    border-radius: 4px;
    overflow: hidden;
}

/* Ensure consistent sizing for placeholder and result images */
#previewImage, #resultImage, .placeholder-img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
    display: block;
    margin: 0;
    background-color: #f0f0f0;
}

/* Make placeholder container match result image container */
.image-placeholder {
    width: 100%;
    position: relative;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #888;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f0f0f0;
}

.char-count {
    text-align: right;
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

.errorMessage {
    color: #ff3860;
    background-color: #feecf0;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
}

/* Error message that overlays on the result image */
.overlay-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 300px;
    z-index: 30;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-align: center;
    font-weight: 500;
}

/* Make retry link more prominent */
.overlay-error a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.overlay-error a:hover {
    color: var(--primary-hover);
}

#downloadBtn {
    position: absolute;
    bottom: 70px;
    left: 10px;
    right: 10px;
    width: calc(100% - 20px);
    z-index: 10;
    background-color: #AA2B8B;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: none;
    padding: 15px 0;
    margin: 0;
    border-radius: 4px;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

#downloadBtn:hover {
    background-color: #8F1A73;
}

/* Image flow layout */
.image-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    width: 100%;
    margin-bottom: 50px; /* Space for buttons */
}

@media (min-width: 768px) {
    /* Desktop mode */
    .image-flow {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Make right image wider in desktop mode */
    #sourceContainer {
        flex: 0.7;
        max-width: 45%;
    }
    
    #resultImageContainer {
        flex: 1.3;
        max-width: 55%;
    }
}

@media (max-width: 767px) {
    /* Mobile mode */
    .image-flow {
        flex-direction: column;
        align-items: center;
    }
    
    /* Full width containers on mobile */
    #sourceContainer, #resultImageContainer {
        width: 100%;
    }
}

.image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

#sourceContainer {
    flex: 0.7;
    max-width: 70%;
}

.image-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
}

.flow-arrow {
    font-size: 2.8rem;
    color: #8F1A73 !important;
    transform: rotate(90deg);
    font-weight: bold;
}

@media (min-width: 768px) {
    .flow-arrow {
        transform: rotate(0);
    }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 4px;
    z-index: 100;
    backdrop-filter: blur(3px);
}

#placeholderText {
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
}

/* Loading spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Person type selector */
.person-type {
    color: #AA2B8B !important;
    cursor: pointer;
    font-family: var(--heading-font);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 4px;
    display: inline-block;
}

.person-type:hover {
    color: #8F1A73 !important;
}

/* Image upload area */
.image-upload-area {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
    border: 2px dashed transparent;
    transition: all 0.3s ease;
}

.image-upload-area.dragover {
    border: 2px dashed var(--primary);
    border-radius: 4px;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    gap: 0.1rem;
}

.upload-overlay:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.upload-icon {
    font-size: 2.5rem;
    color: white;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-family: var(--body-font);
}

/* Remove custom instructions related styles */
.custom-toggle,
.custom-options,
.char-count {
    display: none;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 4px;
    z-index: 100;
    backdrop-filter: blur(3px);
}

#generateButton, button[type="submit"] {
    font-family: var(--body-font);
    background-color: #AA2B8B !important;
    border-color: #AA2B8B !important;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Make disabled button fully transparent initially */
#generateButton:disabled {
    opacity: 0 !important;
    transition: opacity 0.3s ease;
}

#generateButton:not(:disabled) {
    opacity: 1 !important;
    transition: opacity 0.3s ease;
}

#generateButton:hover, button[type="submit"]:hover {
    background-color: #8F1A73 !important;
    border-color: #8F1A73 !important;
}

.blurred-image {
    filter: blur(15px);
    transition: filter 0.3s ease;
}

.gray-background {
    background-color: #f0f0f0;
    min-height: 200px;
    width: 100%;
    border-radius: 4px;
}

.pulse-effect {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        filter: blur(15px);
    }
    50% {
        filter: blur(25px) brightness(1.1);
    }
    100% {
        filter: blur(15px);
    }
}

/* Position the generate button over the result image */
#generateButton {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: calc(100% - 20px);
    transform: none;
    z-index: 10;
    background-color: #AA2B8B;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: none;
    padding: 15px 0;
    margin: 0;
    border-radius: 4px;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

/* Centered generate button */
.centered-generate-button {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 80% !important;
    display: block !important;
}

#generateButton:hover {
    background-color: #8F1A73;
}

/* Hide placeholder when result image is visible */
#resultImage:not([hidden]) ~ #imagePlaceholder {
    display: none;
}

/* Action icons */
.action-icons {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    color: var(--primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.icon-btn:hover {
    background-color: white;
    transform: scale(1.1);
    color: var(--primary-hover);
}

/* Fullscreen modal */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fullscreen-modal.active {
    display: flex;
}

.fullscreen-header {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
}

.fullscreen-header .icon-btn {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.fullscreen-header .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.fullscreen-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#fullscreenImage {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

/* Hide original download button */
#downloadBtn {
    display: none !important;
}

.info-box {
    background-color: #f8f1f7;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 0 auto 2rem;
    max-width: 800px;
    box-shadow: 0 2px 5px rgba(170, 43, 139, 0.1);
    border-left: 4px solid var(--primary);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: opacity 0.5s ease-out;
}

.info-box.fade-out {
    opacity: 0;
}

.info-box p {
    margin: 0.5rem 0;
}

.info-box i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.info-box a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
}

.info-box a:hover {
    color: var(--primary-hover);
}