* {
    box-sizing: border-box;
}

:root {
    --ai-blue: #0802f5;
    --ai-blue-hover: #415bfe;
    --ai-red: #d90101;
    --ai-green: #03911f;
    --ai-yellow: #ffcd05;
}

body {
    color: #111827;
}

.ai-rws-section {
    margin-top: 0;
    margin-bottom: 60px;
}

.ai-header {
    text-align: center;
    padding: 10px 0 18px;
}

.ai-header h1 {
    margin: 0;
    font-size: clamp(2rem, 8vw, 3.3rem);
    line-height: 1.2 !important;
    letter-spacing: -0.04em;
}

.ai-header p {
    margin: 12px auto 0;
    max-width: 560px;
    color: #4b5563;
    font-size: 1rem;
}

.ai-logo {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #111827;
    color: #fff;
    font-weight: 800;
}

.ai-card {
    background: #fff;
    border-radius: 22px;
    padding: 16px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
    margin-bottom: 60px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

textarea {
    width: 100%;
    min-height: 138px;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 16px;
    padding: 14px;
    font: inherit;
    font-size: 1rem;
    outline: none;
}

.ai-card textarea,
#aiPrompt {
    font-size: 18px !important;
    line-height: 1.5 !important;
    font-family: 'Montserrat', Arial, sans-serif !important;
    min-height: 180px;
}

textarea:focus,
select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

.ai-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
    align-items: stretch;
}

#aiGenerateButton {
    grid-column: 1 / -1;
}

select,
button,
.ai-result-buttons a,
.ai-image-reference-button {
    min-height: 50px;
    border-radius: 15px;
    border: 0;
    font: inherit;
    font-size: 18px !important;
    line-height: 1.2 !important;
    font-weight: 800;
}

select {
    width: 100%;
    padding: 0 12px;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    color: #111827;
}

button,
.ai-result-buttons a,
.ai-image-reference-button {
    cursor: pointer;
    text-decoration: none;
    display: grid;
    place-items: center;
    padding: 0 16px;
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    -webkit-filter: none !important;
}

#aiInputImage {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.ai-image-reference-button {
    background: var(--ai-yellow) !important;
    color: #000000 !important;
    margin: 0;
    text-align: center;
}

.ai-image-reference-button:hover {
    -webkit-filter: brightness(110%) !important;
    cursor: pointer;
    color: #000000 !important;
}

.ai-note {
    margin: 10px 0 0;
    color: #6b7280;
    font-size: 1.5rem;
    text-align: center;
}

.ai-progress {
    margin-top: 18px;
    padding: 20px 14px;
    text-align: center;
    border-radius: 18px;
    background: #f8fafc;
}

.ai-loader {
    width: 42px;
    height: 42px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--ai-blue) !important;
    border-radius: 50%;
    margin: 0 auto 10px;
    animation: aiSpin 1s linear infinite;
}

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

.ai-progress p {
    margin: 0 0 12px;
    font-weight: 700;
}

.ai-bar {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

#aiProgressBarFill {
    width: 0%;
    height: 100%;
    background: var(--ai-blue) !important;
    transition: width 0.4s ease;
}

.ai-error {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-weight: 700;
}

.ai-image-preview-wrap {
    margin-top: 14px;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 12px;
    background: #fafafa;
}

.ai-image-preview-wrap img {
    display: block;
    max-width: 100%;
    max-height: 280px;
    height: auto;
    border-radius: 10px;
    margin: 0 auto 12px;
}

.ai-reference-actions {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 10px;
    align-items: stretch;
    margin-top: 12px;
}

#aiStrength {
    min-height: 50px;
    border-radius: 15px;
    border: 1px solid #d1d5db;
    font: inherit;
    font-size: 18px !important;
    line-height: 1.2 !important;
    font-weight: 800;
    padding: 0 12px;
    background: #f8fafc;
    color: #111827;
}

#aiRemoveImageButton {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}

.ai-result {
    margin-top: 18px;
    text-align: center;
}

.ai-result img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    background: #e5e7eb;
}

.ai-result-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.ai-simple-content {
    margin: 16px 0 0;
    padding: 18px;
    border-radius: 20px;
    background: #fff;
    color: #374151;
}

.ai-simple-content h2 {
    margin: 22px 0 6px;
    font-size: 1.2rem;
    color: #111827;
}

.ai-simple-content h2:first-child {
    margin-top: 0;
}

.ai-simple-content p {
    margin: 0 0 10px;
}

.ai-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px !important;
}

.ai-links a {
    color: #111827;
    font-weight: 700;
}

.ai-steps {
    display: grid;
    gap: 12px;
    margin: 16px 0 18px;
}

.ai-step {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.ai-step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ai-blue);
    color: #ffffff;
    font-weight: 900;
    line-height: 1;
}

.ai-step h3 {
    margin: 0 0 4px;
    color: #111827;
    font-weight: 900;
    line-height: 1.55;
}

.ai-step h3 em {
    display: inline-block;
    margin-left: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--ai-yellow);
    color: #000000;
    font-style: normal;
    font-weight: 900;
    vertical-align: middle;
}

.ai-step p {
    margin: 0;
    color: #374151;
    line-height: 1.45;
}

.ai-privacy-note {
    margin-top: 14px !important;
    padding: 12px 14px;
    border-radius: 14px;
    background: #eef2ff;
    color: #1f2937;
    font-weight: 700;
}

/* Reusable colour classes for AI generator buttons */
.ai-card .btn-blue,
.ai-result-buttons .btn-blue {
    background-color: var(--ai-blue) !important;
    border-color: var(--ai-blue) !important;
    color: #ffffff !important;
}

.ai-card .btn-blue:hover,
.ai-result-buttons .btn-blue:hover {
    background-color: var(--ai-blue-hover) !important;
    border-color: var(--ai-blue-hover) !important;
    cursor: pointer;
    color: #ffffff !important;
}

.ai-card .btn-red,
.ai-result-buttons .btn-red {
    background-color: var(--ai-red) !important;
    border-color: var(--ai-red) !important;
    color: #ffffff !important;
}

.ai-card .btn-red:hover,
.ai-result-buttons .btn-red:hover {
    -webkit-filter: brightness(130%) !important;
    cursor: pointer;
    color: #ffffff !important;
}

.ai-card .btn-green,
.ai-result-buttons .btn-green {
    background-color: var(--ai-green) !important;
    border-color: var(--ai-green) !important;
    color: #ffffff !important;
}

.ai-card .btn-green:hover,
.ai-result-buttons .btn-green:hover {
    -webkit-filter: brightness(120%) !important;
    cursor: pointer;
    color: #ffffff !important;
}

.ai-card .btn-yellow,
.ai-result-buttons .btn-yellow {
    background-color: var(--ai-yellow) !important;
    border-color: var(--ai-yellow) !important;
    color: #000000 !important;
}

.ai-card .btn-yellow:hover,
.ai-result-buttons .btn-yellow:hover {
    -webkit-filter: brightness(110%) !important;
    cursor: pointer;
    color: #000000 !important;
}

.ai-card button:disabled,
.ai-result-buttons button:disabled,
.ai-card .btn-red:disabled,
.ai-card .btn-green:disabled,
.ai-card .btn-blue:disabled,
.ai-card .btn-yellow:disabled {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    -webkit-filter: none !important;
}

@media (max-width: 520px) {
    .ai-page {
        padding: 12px 10px 34px;
    }

    .ai-card {
        padding: 14px;
        border-radius: 20px;
    }

    .ai-controls {
        grid-template-columns: 1fr 1fr;
    }

    .ai-image-reference-button {
        width: 100%;
    }

    .ai-result-buttons {
        grid-template-columns: 1fr;
    }

    .ai-reference-actions {
        grid-template-columns: 1fr;
    }

    .ai-card textarea,
    #aiPrompt {
        font-size: 17px !important;
        min-height: 200px;
    }

    .ai-step {
        grid-template-columns: 38px 1fr;
        gap: 10px;
        padding: 12px;
    }

    .ai-step-number {
        width: 38px;
        height: 38px;
    }
}


.modal-dialog {
    position: relative !important; 
    
}

#aiResetPromptButton {
    grid-column: 1 / -1;
}

.ai-reset-prompt-button {
    min-height: 42px;
    width: 54px;
    justify-self: center;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #111827;
    font-size: 18px !important;
    font-weight: 800;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
}

.ai-reset-prompt-button:hover {
    background: #eef2ff;
    border-color: #0802f5;
    color: #0802f5;
    cursor: pointer;
}

.ai-reset-prompt-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

