/* =========================================
   Configurator — Shared Component
   Core Make My Plugin

   Base styles for all product configurators.
   Visual language: neutral palette, dark buttons,
   contained flexbox layout.
   ========================================= */

/* --- Container --- */

.mmy-configurator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 20px auto;
    width: 100%;
    max-width: none;
}

/* --- Interface (sidebar + preview) --- */

.mmy-interface {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    height: 80vh;
    min-height: 400px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* --- Sidebar --- */

.mmy-sidebar {
    width: 320px;
    padding: 20px;
    background: #fafafa;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.mmy-sidebar h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* --- Section Dividers --- */

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

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

.mmy-section h4 {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Form Fields --- */

.mmy-input-group {
    margin-bottom: 15px;
}

.mmy-input-group:last-child {
    margin-bottom: 0;
}

.mmy-inline-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.mmy-inline-group:last-child {
    margin-bottom: 0;
}

.mmy-inline-group .mmy-input-group {
    flex: 1;
    margin-bottom: 0;
}

.mmy-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.mmy-input,
.mmy-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.mmy-input:focus,
.mmy-select:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(153, 153, 153, 0.1);
}

/* Checkbox fields */
.mmy-field-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Radio groups */
.mmy-radio-group {
    display: flex;
    gap: 16px;
}

.mmy-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 400;
}

/* Help text */
.mmy-help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* --- Pricing Section --- */

.mmy-pricing {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
}

.mmy-pricing h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}

.mmy-price-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.mmy-price-line:last-child {
    margin-bottom: 0;
}

.mmy-price-line.mmy-total {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    border-top: 1px solid #ddd;
    padding-top: 8px;
    margin-top: 10px;
}

/* --- Buttons --- */

.mmy-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    text-align: center;
    display: block;
}

.mmy-btn-primary {
    background: #333;
    color: white;
}

.mmy-btn-primary:hover {
    background: #555;
    transform: translateY(-1px);
}

.mmy-btn-primary:active {
    transform: translateY(0);
}

.mmy-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.mmy-btn-secondary {
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.mmy-btn-secondary:hover {
    background: #f8f9fa;
    border-color: #bbb;
    transform: translateY(-1px);
}

.mmy-btn-secondary:active {
    transform: translateY(0);
}

.mmy-btn-secondary:disabled {
    background: white;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

/* Actions container */
.mmy-actions {
    margin-top: 10px;
}

.mmy-actions .mmy-btn + .mmy-btn {
    margin-top: 10px;
}

/* --- Preview Container --- */

.mmy-preview-container {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    box-sizing: border-box;
}

/* --- Preview Toggle (2D / 3D tabs) --- */

.mmy-preview-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.mmy-preview-toggle-btn {
    padding: 8px 16px;
    border: none;
    background: white;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
}

.mmy-preview-toggle-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.mmy-preview-toggle-btn.active {
    background: #333;
    color: white;
}

.mmy-preview-toggle-btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.mmy-preview-toggle-btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* --- 3D Container --- */

.mmy-3d-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.mmy-3d-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* --- Validation Messages --- */

.mmy-validation-messages {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #6d4c00;
}

.mmy-validation-messages ul {
    margin: 0;
    padding: 0 0 0 16px;
    list-style: disc;
}

.mmy-validation-messages li {
    margin-bottom: 2px;
}

/* --- Loading State --- */

.mmy-loading {
    opacity: 0.6;
    pointer-events: none;
}

.mmy-loading .mmy-btn {
    background: #ccc !important;
    cursor: not-allowed;
}

/* --- Hidden Helper --- */

.mmy-instance-data {
    display: none;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 1200px) {
    .mmy-configurator {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .mmy-configurator {
        width: 100%;
    }

    .mmy-interface {
        flex-direction: column;
        height: auto;
        max-height: none;
    }

    .mmy-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        max-height: 50vh;
    }

    .mmy-preview-container {
        min-height: 300px;
        padding: 15px;
    }

    .mmy-preview-toggle {
        top: 5px;
        right: 5px;
    }

    .mmy-preview-toggle-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .mmy-configurator {
        width: 100%;
        margin: 10px 0;
    }

    .mmy-interface {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .mmy-sidebar {
        padding: 15px;
    }

    .mmy-section {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .mmy-inline-group {
        flex-direction: column;
        gap: 15px;
    }

    .mmy-inline-group .mmy-input-group {
        margin-bottom: 15px;
    }

    .mmy-inline-group .mmy-input-group:last-child {
        margin-bottom: 0;
    }
}

/* --- Accessibility --- */

@media (prefers-contrast: high) {
    .mmy-interface {
        border-color: #000;
    }

    .mmy-btn-primary {
        background: #000;
    }

    .mmy-input:focus,
    .mmy-select:focus {
        border-color: #000;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mmy-input,
    .mmy-select,
    .mmy-btn,
    .mmy-preview-toggle-btn {
        transition: none;
    }
}
