body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f8;
    color: #333;
    min-height: 100vh;
}

.page-container {
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: auto;
}

@media (min-width: 993px) {
    .page-container {
        flex-direction: row;
        gap: 30px;
        align-items: flex-start;
    }

    .chat-side {
        width: 35%;
        position: sticky;
        top: 20px;
        height: calc(100vh - 40px);
        display: flex;
        flex-direction: column;
    }

    .form-side {
        width: 65%;
    }
}

/* Mobile and tablet styles */
@media (max-width: 992px) {
    .chat-toggle-fixed {
        display: block;
    }

    .chat-side {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1001;
        background-color: rgba(0, 0, 0, 0.5);
        padding: 20px;
    }

    .chat-container {
        height: 90%;
        width: 90%;
        max-width: 500px;
        margin: 0 auto;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 5%;
    }
    
    /* Ensure the chat input is always visible on mobile */
    .chat-input-container {
        margin-top: auto;
        padding-bottom: 10px;
        position: sticky;
        bottom: 0;
        background-color: white;
    }

    .close-chat-btn {
        display: block;
    }

    .form-side {
        width: 100%;
        display: flex;
        justify-content: center;
    }
}

.container {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

h1, h2 {
    color: #2c3e50;
    margin-bottom: 1em;
}

h1 {
    text-align: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}


/* Formatted Field Content Styles */
.formatted-field-content {
    margin: 10px 0;
    padding: 8px 12px;
    border-left: 3px solid #6366f1;
    background-color: rgba(99, 102, 241, 0.05);
    border-radius: 0 5px 5px 0;
}

.field-label {
    font-weight: bold;
    color: #4f46e5;
    margin-right: 8px;
    display: inline-block;
    min-width: 80px;
}

.field-value {
    display: block;
    margin-top: 5px;
    line-height: 1.6;
}

.formatted-field-content .field-value.formatted-text-large {
    font-size: 18px;
    font-weight: 600;
    color: #4338ca;
    margin-bottom: 5px;
}

.formatted-field-content .field-value.bold-text {
    font-weight: 600;
    color: #6366f1;
}

.field-insertion-notice {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    text-align: center;
    margin-top: 15px;
    padding: 5px;
    background-color: #f3f4f6;
    border-radius: 4px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center; /* Vertically align items */
}

.price-input-container {
    display: flex;
    align-items: flex-start; /* Align items to the top */
    gap: 10px; /* Add space between input and select */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.price-input-container .input-wrapper {
    flex-grow: 1; /* Allow input wrapper to take available space */
    min-width: 150px; /* Ensure input has some minimum width */
}

input[type="text"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 12px 45px 12px 12px; /* Add padding for icons */
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    flex-grow: 1; /* Allow input/textarea to take available space */
}

#price-type {
    width: auto; /* Don't take full width */
    flex-shrink: 0; /* Prevent select from shrinking too much */
    height: 46px; /* Match height of input + border */
    box-sizing: border-box; /* Include padding/border in height */
}

textarea {
    resize: vertical;
    min-height: 80px;
}

#description {
    line-height: 2;
}

select {
    padding: 12px; /* Standard padding for select */
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: #777; 
    font-size: 1.1em;
    padding: 0 8px; 
    position: absolute; 
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.2s ease; 
}

.copy-button {
    right: 30px; 
}
.copy-button i.fa-copy {
    color: #3498db; 
}

.clear-button {
    right: 5px; 
}

.icon-button:hover i {
    color: #333; 
}
.copy-button:hover i.fa-copy {
    color: #2980b9; 
}
.copy-button i.fa-check {
    color: #2ecc71; 
}

.input-wrapper textarea + .copy-button {
    top: 15px; 
    transform: translateY(0);
}
.input-wrapper textarea + .clear-button {
    top: 15px; 
    right: 5px;
    transform: translateY(0);
}

.tip {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.tip a {
    color: #3498db;
    text-decoration: none;
}
.tip a:hover {
    text-decoration: underline;
}

/* Image Upload Section */
input[type="file"] {
    display: none; 
}

label.button {
    display: inline-block;
    padding: 12px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
    transition: background-color 0.3s ease;
    margin-bottom: 15px; 
}

label.button:hover {
    background-color: #2980b9;
}

.tips-container {
    background-color: #eaf6ff;
    border: 1px solid #bde0ff;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.tips-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0056b3;
}

.tips-container ul {
    list-style: disc;
    margin-left: 20px;
    padding-left: 0;
    margin-bottom: 0;
}
.tips-container li {
    margin-bottom: 8px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.image-preview-container {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f9f9f9;
    aspect-ratio: 1 / 1;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: grab;
}

.image-preview-container:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.image-preview-container.uploading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(52, 152, 219, 0.2);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

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

.image-preview-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.image-preview-container.uploading img {
    opacity: 0.5;
}

.image-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 6px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 4px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    z-index: 2;
}

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

.image-actions button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1em;
    padding: 3px;
    line-height: 1;
    transition: color 0.2s ease, transform 0.1s ease;
}

.image-actions button:hover {
    color: #eee;
    transform: scale(1.1);
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0, 0, 0, 0.6); 
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto; 
    padding: 30px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 600px;
    border-radius: 8px;
    position: relative;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#modal-image-preview {
    display: block;
    max-width: 100%;
    max-height: 400px;
    margin: 20px auto;
    border: 1px solid #ddd;
}

.editor-tools {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.editor-tools label {
    display: block;
    width: 100%;
    margin-bottom: 5px;
}
.editor-tools input[type="range"] {
    width: calc(100% - 80px); 
    margin-left: 10px;
}

.tool-button {
     padding: 8px 15px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tool-button i {
    color: #555;
}

.tool-button:hover {
    background-color: #ddd;
}

#save-image-changes {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}
#save-image-changes:hover {
    background-color: #27ae60;
}

.ai-features {
    background-color: #f0f0f0;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
}

.ai-features p {
    color: #555;
}

#generate-listing-btn {
    padding: 12px 25px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: not-allowed;
    font-size: 1.1em;
    margin-top: 15px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 0 auto;
        width: 95%;
    }
    h1 {
        font-size: 1.8em;
    }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    .modal-content {
        width: 90%;
        margin: 15% auto;
    }
    .input-wrapper {
        flex-direction: column; 
        align-items: flex-start;
    }

    input[type="text"],
    input[type="number"],
    input[type="tel"],
    textarea,
    select {
        width: 100%; 
    }
    select#price-type {
        width: 100%;
        margin-left: 0;
        margin-top: 0; 
    }

    .icon-button {
        position: absolute;
        top: auto; 
        bottom: 5px; 
        transform: translateY(0); 
    }
    .input-wrapper textarea + .copy-button,
    .input-wrapper textarea + .clear-button {
        top: auto; 
        bottom: 5px;
        transform: translateY(0); 
    }

    /* Adjust price container for stacking */
    .price-input-container {
        flex-direction: column;
        gap: 15px; /* Adjust gap for vertical stacking */
    }
    .price-input-container .input-wrapper {
        width: 100%; /* Ensure input takes full width */
        margin-bottom: 35px; /* Add back bottom margin specifically for the input wrapper */
    }
}

