.select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #ddd;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #4CAF50;
}

.poemetti-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.poemetti-language-switcher {
    margin-left: 20px;
    position: relative;
    min-width: 150px;
}

.poemetti-language-switcher select {
    padding: 10px 40px 10px 20px;
    border-radius: 25px;
    border: 2px solid #4CAF50;
    background-color: #fff;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.1);
    min-width: 180px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234CAF50' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
}

.poemetti-language-switcher select:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.poemetti-language-switcher select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* Mobile adjustments for header */
@media (max-width: 767px) {
    .poemetti-header {
        flex-direction: column; /* Stack title and switcher */
        align-items: center; /* Center items */
        gap: 15px; /* Add space between title and switcher */
    }

    .poemetti-language-switcher {
        margin-left: 0; /* Remove left margin */
        width: 100%; /* Make switcher take full width */
        max-width: 250px; /* Optional: Limit max width */
    }

    .poemetti-language-switcher select {
        width: 100%; /* Ensure select fills its container */
    }
}

.poemetti-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    position: relative;
    min-height: 400px;
}

.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#advanced-options {
    margin: 20px 0;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Hide back button on first step */
.wizard-step[data-step="1"] .prev-step {
    display: none !important;
}

/* Ensure next button is visible and centered on step 1 */
.wizard-step[data-step="1"] .next-step {
    display: block !important;
    margin: 15px auto;
}

/* Navigation buttons for all steps */
.wizard-nav {
    display: flex !important;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
    margin-top: 20px;
}

.wizard-nav button {
    display: inline-block;
    margin: 0;
    flex: 1;
    min-width: 120px;
    text-align: center;
    transition: all 0.3s ease;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

/* Specific styling for step 2 buttons */
.wizard-step[data-step="2"] .wizard-nav .prev-step,
.wizard-step[data-step="2"] .wizard-nav .next-step {
    opacity: 1;
    visibility: visible;
    display: inline-block;
}

/* Ensure buttons are always visible on step 2 */
.wizard-step[data-step="2"] .wizard-nav .prev-step,
.wizard-step[data-step="2"] .wizard-nav .next-step {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
}


.wizard-nav button {
    padding: 10px 20px;
}

.next-step, .prev-step, .generate-poem {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 10px 20px;
    margin: 15px auto;
    display: block;
    font-size: 1em;
    min-width: 120px;
    text-align: center;
}

.wizard-nav {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 15px;
    width: 100%;
}

/* Specific styling for step 1 next button */
.wizard-step[data-step="1"] .wizard-nav {
    justify-content: center;
}

.wizard-step[data-step="1"] .next-step {
    margin: 0 auto;
}

.wizard-nav button {
    padding: 10px 20px;
    min-width: 120px;
}

.start-over {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    min-width: 120px;
}

.next-step:hover, .prev-step:hover {
    background: #45a049;
}

.prev-step {
    background: #6c757d;
}

.prev-step:hover {
    background: #5a6268;
}

.poemetti-container h2 {
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button[type="submit"] {
    background: #4CAF50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button[type="submit"]:hover {
    background: #45a049;
}

#poemetti-result {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.poem-content {
    white-space: pre-line;
    line-height: 1.6;
    font-size: 1.1em;
}

.poem-image {
    max-width: 100%;
    margin: 0 auto;
    display: block;
    text-align: center;
}

.poem-image {
    position: relative;
    min-height: 300px;
    margin: 10px 0 20px 0; /* Reduced top margin, kept bottom margin */
    border: 1px dashed #ddd; /* Visual debug */
    display: none; /* Initially hidden */
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.poem-image img {
    max-width: 100%;
    height: auto;
    display: none;
}

#poemetti-result {
    display: none;
    visibility: visible;
}

.poem-image img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin: 20px auto;
    display: none;
    background-color: #000;
    object-fit: contain;
}

/* Responsive styles for posts */
.post-content .poemetti-generated-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 1em auto;
}

.poem-image {
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-style: italic;
}

.poem-image .error-message {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    color: #d63638;
}

.poem-actions {
    margin-top: 15px;
}

.review-choices {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
}

.review-choices h4 {
    margin-top: 0;
    color: #333;
}

.review-choices ul {
    list-style: none;
    padding-left: 0;
}

.review-choices li {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.review-choices li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.start-over {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 10px 20px;
    margin-top: 20px;
}

.start-over:hover {
    background: #5a6268;
}

.download-btn {
    display: inline-block;
    padding: 8px 15px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.download-btn:hover {
    background: #45a049;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.share-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.share-btn.facebook {
    background: #3b5998;
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.twitter {
    background: #000000;
}

.share-btn.bluesky {
    background: #1185FE;
}

.share-btn:hover {
    transform: scale(1.1);
}

/* Message Styles */
.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message:before {
    content: "⚠️";
    font-size: 1.2em;
}

.info-message {
    color: #004085;
    background-color: #cce5ff;
    border: 1px solid #b8daff;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-message:before {
    content: "⏳";
    font-size: 1.2em;
}

.success-message {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-message:before {
    content: "✅";
    font-size: 1.2em;
}

/* Loading States */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading-indicator {
    animation: pulse 1.5s infinite;
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #666;
}

/* Retry Button */
.retry-button {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.retry-button:hover {
    background: #e0a800;
}

.retry-button:before {
    content: "🔄";
}

.poemetti-terms-notice {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9em;
    text-align: center;
    color: #6c757d;
}

.poemetti-terms-notice a {
    color: #0d6efd;
    text-decoration: none;
}

.poemetti-terms-notice a:hover {
    text-decoration: underline;
}

#poemetti-prompt.error {
    border-color: #dc3545;
}

#poemetti-prompt + .error-message {
    color: #dc3545;
    margin-top: 5px;
    font-size: 0.9em;
}

/* Styles for login prompt messages */
.login-prompt-message {
    margin: 15px 0;
    padding: 10px 15px;
    background-color: #e7f3fe; /* Light blue background */
    border: 1px solid #d0e3f0;
    border-radius: 4px;
    font-size: 0.95em;
    color: #31708f; /* Darker blue text */
    text-align: center;
}

.login-prompt-message a {
    color: #2a6496;
    font-weight: bold;
    text-decoration: none;
}

.login-prompt-message a:hover {
    text-decoration: underline;
}

/* Hide elements meant only for logged-in users when logged out */
.poemetti-container.user-logged-out .logged-in-only {
    display: none !important; /* Hide logged-in only options */
}
.character-counter {
    text-align: right;
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
}

.character-counter.warning {
    color: #ff9800;
}

.character-counter.error {
    color: #f44336;
}
