/* Widget Container */
#room-preview-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Card Body Styling */
.card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Form Container */
.form-container {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    box-sizing: border-box;
}

/* Preview Container */
#previewContainer {
    flex: 1;
    min-width: 300px;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    padding: 20px;
    box-sizing: border-box;
}

.canvas-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

#previewCanvas,
.loading-placeholder,
.generated-preview,
.analysis-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#previewCanvas {
    display: block;
    z-index: 1;
}

.loading-placeholder {
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    z-index: 2;
    transform: scale(1.1); /* Compensate for blur overflow */
}

.generated-preview {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
    z-index: 4;
}

.analysis-overlay {
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 5;
    /* border-radius: 4px; */
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
    .card-body {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    #previewContainer {
        order: -1;
        margin-bottom: 20px;
        padding: 0 20px;
        width: 100%;
    }

    .form-container {
        width: 100%;
        padding: 0 20px;
    }

    .canvas-container {
        max-width: 100%;
        margin: 0 auto;
    }
}

/* Form Elements */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

/* Disabled form elements */
.form-control:disabled,
.form-check-input:disabled,
.form-check-label:disabled,
.btn:disabled,
.dropdown-button.disabled,
.form-label.disabled,
.dropdown-header:disabled,
.dropdown-item:disabled,
.room-message-text:disabled,
.form-check:disabled,
.form-check-label:disabled,
.form-check-input:disabled + .form-check-label,
.form-check-input:disabled ~ .form-check-label,
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Ensure disabled state is also applied to parent elements */
.form-check:disabled .form-check-label,
.form-check:disabled .form-check-input,
.form-check.disabled .form-check-label,
.form-check.disabled .form-check-input {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.form-control[type="file"] {
    padding: 8px 12px;
    line-height: 1.5;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0;
    transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
    outline: 0;
}

.form-control[type="file"]:focus {
    outline: 0;
}

.form-control[type="file"]:hover {
    border-color: #333;
}

.form-control[type="file"]::-webkit-file-upload-button {
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    margin-right: 8px;
}

.form-control[type="file"]::file-selector-button {
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    margin-right: 8px;
}

/* Radio Buttons */
.form-check {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.form-check-input {
    margin-right: 8px;
    border-color: #333;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #333;
    border-radius: 50%;
    position: relative;
    margin-top: 0;
}

.form-check-input:focus {
    outline: 0;
}

.form-check-input:checked {
    background-color: #333;
    border-color: #333;
}

.form-check-input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
}

.form-check-label {
    font-size: 14px;
    color: #333;
    margin-bottom: 0;
}

/* Preview actions */
.preview-disclaimer {
    font-size: 11px;
    line-height: 1.4;
    color: #6c757d;
    margin: 8px 0 0;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    margin-top: 24px;
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    margin-bottom: 16px;
}

.dropdown-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    /* border-radius: 4px; */
    cursor: pointer;
    text-align: left;
}

.dropdown-button img {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    object-fit: cover;
}

.dropdown-button.placeholder {
    color: #6c757d;
}

.dropdown-button.disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.dropdown-button:focus {
    outline: 0;
}

.dropdown-arrow {
    margin-left: auto;
    font-size: 12px;
    color: #6c757d;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    min-width: 200px;
    padding: 8px 0;
    margin: 4px 0 0;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    /* border-radius: 4px; */
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    background-color: #f8f9fa;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item img {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    object-fit: cover;
}

/* Room Message */
.room-message {
    margin: 24px 0;
}

.room-message-text {
    color: #333;
    margin: 0;
}

/* Generated Preview */
#generatedPreviewContainer {
    margin-top: 20px;
    position: relative;
}

#generatedPreviewContainer h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
    color: #333;
}

#generatedPreviewCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    /* border-radius: 4px; */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#generatedPreviewCanvas.visible {
    opacity: 1;
}

/* Loading States */
.loading-placeholder.visible {
    opacity: 1;
}

.generated-preview.visible {
    opacity: 1;
}

/* Analysis Overlay */
.analysis-overlay {
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 5;
    /* border-radius: 4px; */
}

.magic-icon-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.magic-icon {
    width: 48px;
    height: 48px;
    position: relative;
    animation: pulse 2s infinite;
}

.magic-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.sparkle-1 {
    top: 10%;
    left: 50%;
    animation-delay: 0s;
}

.sparkle-2 {
    top: 50%;
    right: 10%;
    animation-delay: 0.5s;
}

.sparkle-3 {
    bottom: 10%;
    left: 50%;
    animation-delay: 1s;
}

.sparkle-4 {
    top: 50%;
    left: 10%;
    animation-delay: 1.5s;
}

.analysis-text {
    font-size: 12px;
    text-align: center;
    max-width: 80%;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
    }
} 

.link-small {
    font-size: 14px;
    color: #333;
    text-decoration: none;
}

.link-small:hover {
    text-decoration: underline;
}

.open-in-new-tab-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.open-in-new-tab-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.open-in-new-tab-btn svg {
    width: 20px;
    height: 20px;
    color: #333;
}

.open-in-new-tab-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}