/* Main container for the editor */
.bio-template-edit,
.bio-editor-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: auto;
    align-items: stretch;
    box-sizing: border-box;
}

/* Form fields sidebar (fixed width) */
.bio-fields {
    width: 350px;
    padding: 20px;
    box-sizing: border-box;
    min-height: 100vh;
    height: auto; 
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    flex-shrink: 0;
}

/* Section headers in the editor */
.bio-fields h3 {
    color: #fff;
    font-size: 1.2rem;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 2px solid rgba(195, 9, 130, 0.5);
    padding-bottom: 0.5rem;
}

.bio-fields h3:first-child {
    margin-top: 0;
}

/* Preview area (takes remaining space) */
.bio-preview {
    flex: 1;
    overflow: auto;
    padding: 2rem 0;
}

/* Container for the template itself */
#bio-template-preview {
    position: relative;
}

/* Input fields and textareas */
.bio-field-wrap {
    margin-bottom: 15px;
}

.bio-fields label {
    display: block;
    margin-bottom: 5px;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.bio-fields input[type="text"],
.bio-fields input[type="url"],
.bio-fields input[type="file"],
.bio-fields input[type="color"],
.bio-fields textarea,
.bio-fields select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s, background-color 0.3s;
}

.bio-fields input:focus,
.bio-fields textarea:focus,
.bio-fields select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #3498db;
    outline: none;
}

/* Placeholder color */
.bio-fields ::placeholder {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

/* Specific input types */
.bio-fields input[type="text"],
.bio-fields input[type="url"],
.bio-fields select {
    min-height: 44px;
    height: 44px;
}

.bio-fields input[type="color"] {
    height: 44px;
    cursor: pointer;
    padding: 4px;
}

.bio-fields textarea {
    min-height: 100px;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
}

/* Make the Model_Name textarea the same size as the Room_Name input */
#bte-input-model_name {
    min-height: 44px;
    height: 44px;
    resize: none; /* change to 'vertical' if you'd like users to still resize it vertically */
    overflow: hidden;
}

/* Fix dropdown option text color */
.bio-fields select option {
    color: #000;
    background: #fff;
}

/* Disabled dropdown options */
.bio-fields select option:disabled {
    color: #999 !important;
    background: #f5f5f5;
}

/* Image Preview Styling */
.image-preview {
    margin-top: 10px;
    display: none;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(195, 9, 130, 0.3);
}

/* Download button styling */
.bte-download-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #c30982, #3498db);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.bte-download-btn:hover {
    background: linear-gradient(135deg, #1a1a2e, #121221);
    box-shadow: 0 4px 5px rgba(195, 9, 130, 0.3);
}

/* Link block styling */
.link-block {
    position: relative;
}

.link-block hr {
    border: 1px solid rgba(195, 9, 130, 0.3);
    margin: 20px 0;
}

/* Site type selector cursor */
.site-type-selector {
    cursor: pointer;
}

/* Scrollbar styling for the fields sidebar */
.bio-fields::-webkit-scrollbar {
    width: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.bio-fields::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.bio-fields::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #c30982, #3498db);
    border-radius: 6px;
}

.bio-fields::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a0075f, #2980b9);
}

/* Color input styling improvements */
.color-input {
    cursor: pointer;
}

/* Link URL input styling */
.link-url-input {
    font-family: monospace;
}

/* RESPONSIVE FIX: Switch to a stacked layout for screens 
   smaller than 900px (standard tablet/mobile breakpoint). */
@media (max-width: 900px) {
    
    /* 1. Main Container: Switch from row (side-by-side) to column (stacked) */
    .bio-template-edit,
    .bio-editor-layout {
        flex-direction: column !important;
        align-items: center !important; 
        width: 100% !important;
        min-height: auto !important;
    }
    
    /* 2. Fields Sidebar: Make it take the full width of the screen */
    .bio-fields {
        width: 100% !important;
        padding: 20px !important;
        min-height: auto !important;
        border-right: none !important;
        order: 1; 
    }

    /* 3. Preview Area: Make it take the full width and be visible */
    .bio-preview {
        width: 100% !important;
        height: auto !important; 
        min-height: 50vh;
        padding: 10px 0 !important;
        order: 2; 
        flex-grow: initial !important; 
    }

    /* 4. Ensure the template content is contained within the new 100% width */
    #bio-template-preview {
        margin: 0 auto !important;
    }
}

/* ===================================
   CUSTOM EDITOR INTEGRATION STYLES
   =================================== */

/* Custom Editor Layout - Matches bio-editor-layout */
.custom-editor-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: auto;
    align-items: stretch;
    box-sizing: border-box;
}

/* Custom Editor Fields - Matches bio-fields */
.custom-editor-fields {
    width: 350px;
    padding: 20px;
    box-sizing: border-box;
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    flex-shrink: 0;
}

.custom-editor-fields h3 {
    color: #fff;
    font-size: 1.2rem;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 2px solid rgba(195, 9, 130, 0.5);
    padding-bottom: 0.5rem;
}

.custom-editor-fields h3:first-child {
    margin-top: 0;
}

/* Field Wrap - Matches bio-field-wrap */
.field-wrap {
    margin-bottom: 15px;
}

.custom-editor-fields label {
    display: block;
    margin-bottom: 5px;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.custom-editor-fields input[type="text"],
.custom-editor-fields input[type="url"],
.custom-editor-fields input[type="file"],
.custom-editor-fields input[type="color"],
.custom-editor-fields textarea,
.custom-editor-fields select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s, background-color 0.3s;
}

.custom-editor-fields input:focus,
.custom-editor-fields textarea:focus,
.custom-editor-fields select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #3498db;
    outline: none;
}

.custom-editor-fields ::placeholder {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.custom-editor-fields input[type="text"],
.custom-editor-fields input[type="url"],
.custom-editor-fields select {
    min-height: 44px;
    height: 44px;
}

.custom-editor-fields input[type="color"] {
    height: 44px;
    cursor: pointer;
    padding: 4px;
}

.custom-editor-fields textarea {
    min-height: 100px;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
}

.custom-editor-fields select option {
    color: #000;
    background: #fff;
}

.custom-editor-fields select option:disabled {
    color: #999 !important;
    background: #f5f5f5;
}

/* Custom Editor Preview - Matches bio-preview */
.custom-editor-preview {
    flex: 1;
    overflow: auto;
    padding: 2rem 0;
}

/* Template Preview - Matches bio-template-preview */
#template-preview {
    position: relative;
}

/* Download button for custom editor */
.download-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #c30982, #3498db);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: linear-gradient(135deg, #1a1a2e, #121221);
    box-shadow: 0 4px 5px rgba(195, 9, 130, 0.3);
}

/* Custom Editor Scrollbar */
.custom-editor-fields::-webkit-scrollbar {
    width: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.custom-editor-fields::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.custom-editor-fields::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #c30982, #3498db);
    border-radius: 6px;
}

.custom-editor-fields::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a0075f, #2980b9);
}

/* RESPONSIVE FIX: Switch to stacked layout for smaller screens */
@media (max-width: 900px) {
    .custom-editor-layout {
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        min-height: auto !important;
    }
    
    .custom-editor-fields {
        width: 100% !important;
        padding: 20px !important;
        min-height: auto !important;
        border-right: none !important;
        order: 1;
    }
    
    .custom-editor-preview {
        width: 100% !important;
        height: auto !important;
        min-height: 50vh;
        padding: 10px 0 !important;
        order: 2;
        flex-grow: initial !important;
    }
    
    #template-preview {
        margin: 0 auto !important;
    }
}