/**
 * Edit Model Page CSS
 * 
 * Styles for the Edit Model admin page
 * Aligned with ExploreXR's admin style guidelines
 */

/* WordPress admin compatibility fixes - Only apply minimal necessary changes */

/* Ensure proper scroll behavior without breaking admin menu */
body.wp-admin {
    height: auto !important;
}

/* Don't override WordPress admin menu positioning - this breaks hover functionality */
/* Removed: #adminmenuwrap position and z-index overrides */

/* Ensure content area doesn't conflict with admin layout */
#wpcontent {
    height: auto !important;
    min-height: 100%;
}

/* Only apply admin bar fixes when needed */
@media screen and (max-width: 782px) {
    .explorexr-admin-menu-fix {
        padding-top: 46px; /* WordPress admin bar height on mobile */
    }
}

.explorexr-admin-page {    
    margin: 20px 20px 0 0;
}

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

.explorexr-page-title h1 {
    margin-bottom: 5px;
}

.explorexr-page-subtitle {
    color: #646970;
    font-size: 14px;
}

.explorexr-preview-card {
    margin-bottom: 30px;
}

.explorexr-model-shortcode {
    display: flex;
    align-items: center;
    gap: 5px;
}

.explorexr-model-shortcode code {
    padding: 4px 8px;
    background: #E4E9EC;
    border-radius: 4px;
}

/* Card styles - inheriting from admin-styles.css */
/* .explorexr-card base styles are defined in admin-styles.css */

.explorexr-card-note {
    background-color: #f0f6fc;
    border-left: 4px solid #72aee6;
    padding: 12px;
    margin-bottom: 20px;
}

.explorexr-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.explorexr-form-group {
    margin-bottom: 20px;
}

.explorexr-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.explorexr-form-group .description {
    display: block;
    color: #646970;
    font-size: 13px;
    margin-top: 5px;
}

.explorexr-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.explorexr-form-row label {
    margin-bottom: 0;
    min-width: 60px;
}

.explorexr-empty-preview {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    color: #646970;
}

.explorexr-empty-preview .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.explorexr-tabs {
    display: flex;
    border-bottom: 1px solid #c3c4c7;
    margin-bottom: 20px;
}

.explorexr-tab {
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 14px;
    color: #646970;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.explorexr-tab:hover {
    color: #2271b1;
}

.explorexr-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.explorexr-tab-content {
    display: none;
}

.explorexr-tab-content.active {
    display: block;
}

.explorexr-device-tabs {
    display: flex;
    margin-bottom: 15px;
    background: #f6f7f7;
    border-radius: 0;
    padding: 5px;
}

.explorexr-device-tab {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #646970;
    transition: all 0.2s ease;
}

.explorexr-device-tab.active {
    background: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    color: #2271b1;
}

.explorexr-device-content {
    display: none;
}

.explorexr-device-content.active {
    display: block;
}

.explorexr-size-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.explorexr-size-option {
    display: flex;
    cursor: pointer;
    border: 1px solid #c3c4c7;
    border-radius: 0;
    padding: 15px;
    background: #f6f7f7;
    transition: all 0.2s ease;
}

.explorexr-size-option:hover {
    background: #0D152C;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.explorexr-size-option input[type="radio"] {
    margin-right: 10px;
}

.explorexr-size-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.explorexr-size-box {
    background: #ddd;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.explorexr-file-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.explorexr-file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.explorexr-file-input-decoration {
    border: 2px dashed #c3c4c7;
    border-radius: 0;
    padding: 30px;
    text-align: center;
    color: #646970;
    transition: all 0.3s ease;
    background: #f6f7f7;
}

.explorexr-file-input-wrapper:hover .explorexr-file-input-decoration {
    border-color: #2AACE2;
    background: #f0f7fc;
}

.explorexr-file-input-decoration .dashicons {
    display: block;
    margin: 0 auto 10px;
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #2AACE2;
}

.explorexr-current-model {
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f7fc;
    border-radius: 0;
    border-left: 4px solid #2AACE2;
}

.explorexr-current-model h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1d2327;
    font-weight: 600;
}

.explorexr-model-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 500;
}

.explorexr-model-file-path {
    margin-left: 34px;
    padding: 8px;
    background: #E4E9EC;
    border-radius: 4px;
    font-size: 13px;
    overflow-x: auto;
    border: 1px solid #e2e4e7;
}

.explorexr-current-poster {
    margin-bottom: 20px;
}

.explorexr-current-poster h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1d2327;
    font-weight: 600;
}

.explorexr-remove-poster {
    margin-top: 10px;
}

.explorexr-input-group {
    display: flex;
    gap: 5px;
}

.explorexr-input-group input {
    flex-grow: 1;
}

.explorexr-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.explorexr-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.explorexr-checkbox-label:hover {
    background-color: #f6f7f7;
}

.explorexr-checkbox-label span {
    line-height: 20px;
}

/* Form Actions Card - Separate visual section */
.explorexr-form-actions-card {
    margin-top: 30px;
    background: #f9f9f9;
    border: 2px solid #2AACE2;
}

.explorexr-form-actions-card .explorexr-card-content {
    padding: 20px;
}

.explorexr-form-actions {
    margin: 0;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
}

/* Button styles */
.explorexr-action-button,
.explorexr-primary-button,
.explorexr-secondary-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Button styles - inheriting base button styles from admin-styles.css */
/* .button-primary and .button-secondary are defined in admin-styles.css */

.explorexr-primary-button {
    background-color: #2AACE2;
    color: #fff;
    border: 1px solid #2AACE2;
}

.explorexr-primary-button:hover {
    background-color: #1e8bb8;
    color: #fff;
    border-color: #1e8bb8;
}

.explorexr-secondary-button,
.wrap.explorexr-edit-model-page .button {
    background-color: #0D152C;
    color: #2c3338;
    border: 1px solid #c3c4c7;
}

.explorexr-secondary-button:hover,
.wrap.explorexr-edit-model-page .button:hover {
    background-color: #e2e4e7;
    color: #1d2327;
}

span.required {
    color: #d63638;
}

span.optional {
    font-size: 12px;
    color: #646970;
    font-weight: normal;
}

/* Alert styles aligned with admin-style.css */
.explorexr-alert,
.ExploreXR-alert {
    display: flex;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    align-items: flex-start;
    line-height: 1.5;
    border-left: 4px solid;
    gap: 10px;
}

.explorexr-alert > div,
.ExploreXR-alert > div {
    flex: 1;
}

.explorexr-alert p,
.ExploreXR-alert p {
    margin: 0 0 8px 0;
}

.explorexr-alert p:last-child,
.ExploreXR-alert p:last-child {
    margin-bottom: 0;
}

.explorexr-alert.success,
.ExploreXR-alert.success {
    background-color: #d4edda;
    border-color: #00a32a;
    color: #155724;
}

.explorexr-alert.info,
.ExploreXR-alert.info {
    background-color: #d1ecf1;
    border-color: #72aee6;
    color: #0c5460;
}

.explorexr-alert.warning,
.ExploreXR-alert.warning {
    background-color: #fff3cd;
    border-color: #ffb900;
    color: #856404;
}

.explorexr-alert.error,
.ExploreXR-alert.error {
    background-color: #f8d7da;
    border-color: #d63638;
    color: #721c24;
}

.explorexr-alert .dashicons,
.ExploreXR-alert .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.explorexr-alert.success .dashicons,
.ExploreXR-alert.success .dashicons {
    color: #00a32a;
}

.explorexr-alert.error .dashicons,
.ExploreXR-alert.error .dashicons {
    color: #d63638;
}

.explorexr-alert code,
.ExploreXR-alert code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

.copy-shortcode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    margin-left: 8px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.2s;
}

.copy-shortcode:hover {
    background: #135e96;
}

.copy-shortcode .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin: 0;
}

/* Shortcode display styling */
.explorexr-model-shortcode {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
}

.explorexr-model-shortcode code {
    background: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    color: #2c3338;
    border: 1px solid #e0e0e0;
}

.explorexr-model-shortcode .copy-shortcode {
    margin-left: 0;
}

/* Additional button icon styles */
.explorexr-action-button .dashicons,
.explorexr-primary-button .dashicons,
.explorexr-secondary-button .dashicons,
.wrap.explorexr-edit-model-page .button .dashicons {
    margin-right: 5px;
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: inherit;
}

/* Empty preview styling */
.explorexr-empty-preview {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f6f7f7;
    border-radius: 0;
    color: #646970;
}

.explorexr-empty-preview .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
    color: #2AACE2;
}

/* Model viewer styling */
.explorexr-model-preview {
    display: block !important; /* Override model-viewer's inline display */
    width: 100%; 
    height: 400px; 
    background-color: #f6f7f7; 
    border-radius: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Full width form groups */
.explorexr-full-width {
    grid-column: 1 / -1;
}

/* Size box demo elements */
.explorexr-size-box-small {
    width: 60px; 
    height: 60px;
    background-color: #e2e4e7;
}

.explorexr-size-box-medium {
    width: 80px; 
    height: 80px;
    background-color: #e2e4e7;
}

.explorexr-size-box-large {
    width: 100px; 
    height: 80px;
    background-color: #e2e4e7;
}

.explorexr-size-box-xlarge {
    width: 120px;
    height: 90px;
    background-color: #e2e4e7;
}

.explorexr-size-box-full {
    width: 120px;
    height: 70px;
    background-color: #e2e4e7;
}

/* Poster preview styling */
.explorexr-poster-thumbnail {
    max-width: 150px; 
    max-height: 150px; 
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.explorexr-poster-thumbnail:hover {
    transform: scale(1.05);
}

.explorexr-poster-preview {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.explorexr-poster-preview img {
    max-width: 200px;
    width: auto;
    height: auto;
    border: 2px solid #2AACE2; 
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(42, 172, 226, 0.3);
    display: block;
    margin: 0 auto;
}

/* Edit Model Notifications */
.explorexr-edit-notification {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 99999;
    min-width: 300px;
    max-width: 500px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    animation: slideInRight 0.3s ease-out;
}

.explorexr-edit-notification.success {
    border-left: 4px solid #00a32a;
    background: #f0f9f0;
}

.explorexr-edit-notification.error {
    border-left: 4px solid #d63638;
    background: #fdf0f0;
}

.explorexr-edit-notification.info {
    border-left: 4px solid #0073aa;
    background: #f0f9ff;
}

.explorexr-edit-notification .notification-message {
    font-size: 14px;
    line-height: 1.4;
}

.explorexr-edit-notification .notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #646970;
    padding: 0;
    margin-left: 10px;
    line-height: 1;
}

.explorexr-edit-notification .notification-close:hover {
    color: #d63638;
}

/* Responsive settings */
@media (max-width: 782px) {
    .explorexr-form-grid {
        grid-template-columns: 1fr;
    }
    
    .explorexr-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .explorexr-page-actions {
        margin-top: 15px;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .explorexr-page-actions a,
    .explorexr-page-actions button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .explorexr-form-actions {
        flex-direction: column;
    }
    
    .explorexr-form-actions button,
    .explorexr-form-actions a {
        width: 100%;
        justify-content: center;
    }
    
    .explorexr-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .explorexr-model-shortcode {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .explorexr-model-shortcode code {
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
    }
    
    .copy-shortcode {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive Model Viewer Sizes - WordPress Breakpoints */
@media screen and (max-width: 782px) {
    /* Tablet devices - Use tablet custom sizes if set */
    .explorexr-model-viewer-container[data-tablet-width]:not([data-tablet-width=""]) {
        width: var(--tablet-viewer-width) !important;
    }
    
    .explorexr-model-viewer-container[data-tablet-height]:not([data-tablet-height=""]) {
        height: var(--tablet-viewer-height) !important;
    }
}

@media screen and (max-width: 600px) {
    /* Mobile devices - Use mobile custom sizes if set */
    .explorexr-model-viewer-container[data-mobile-width]:not([data-mobile-width=""]) {
        width: var(--mobile-viewer-width) !important;
    }
    
    .explorexr-model-viewer-container[data-mobile-height]:not([data-mobile-height=""]) {
        height: var(--mobile-viewer-height) !important;
    }
}

.explorexr-form-group-indent { margin-top: 15px; margin-left: 20px; }
