/**
 * Installation & Reskin Section Styles
 * Based on the demo toggle-button.html design
 */

/* Main Installation Wrapper - Compact */
.mkvfe-installation-wrapper {
    margin: 8px 0;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    font-family: "Segoe UI", Arial, sans-serif;
}

/* Header with title and controls - Compact */
.mkvfe-installation-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.mkvfe-installation-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    flex: 1 1 auto;
    min-width: 0; /* Allow text truncation */
}

/* Controls container - Compact */
.mkvfe-installation-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Divider after toggle */
.mkvfe-divider {
    color: #ccc;
    font-size: 16px;
    font-weight: 300;
    user-select: none;
    line-height: 1;
}

/* Toggle Wrapper */
.mkvfe-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Toggle label removed */

/* Toggle Switch */
.mkvfe-toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.mkvfe-toggle-switch input {
    display: none;
}

.mkvfe-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 26px;
    transition: 0.3s;
    cursor: pointer;
}

.mkvfe-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mkvfe-toggle-switch input:checked + .mkvfe-slider {
    background: #007bff;
}

.mkvfe-toggle-switch input:checked + .mkvfe-slider::before {
    transform: translateX(18px);
}

/* Share Button */
.mkvfe-share-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Share Icons */
.mkvfe-share-icons {
    display: none !important;
    margin-top: 10px;
    gap: 6px;
    flex-wrap: wrap;
}

.mkvfe-share-icons.show {
    display: flex !important;
}

.mkvfe-share-link {
    flex: 1 1 auto;
    text-align: center;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    text-decoration: none;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.mkvfe-share-link i {
    font-size: 12px;
}

/* Description */
.mkvfe-installation-description {
    margin-top: 10px;
    font-size: 12px;
    color: #555;
    line-height: 1.4;
}

/* Modal Styles */
.mkvfe-modal {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 999999;
}

.mkvfe-modal.show {
    display: flex !important;
}

.mkvfe-modal-content {
    background: #fff;
    width: 100%;
    max-width: var(--mkvfe-modal-width, 500px);
    border-radius: 14px;
    max-height: 90vh;
    overflow-y: auto;
    transition: opacity 0.2s ease;
}

/* Modal header removed - content only */

.mkvfe-modal-body {
    padding: 20px;
}

/* Loading State */
.mkvfe-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Plan Styles (for default content) */
.mkvfe-plan {
    border: 1px solid #e1e4e8;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    background: #f8f9fa;
}

.mkvfe-plan:last-child {
    margin-bottom: 0;
}

.mkvfe-plan strong {
    display: block;
    margin-bottom: 6px;
    color: #222;
    font-size: 16px;
}

.mkvfe-plan .price {
    font-weight: bold;
    color: #007bff;
    font-size: 18px;
}

/* Tablet Responsive */
@media (min-width: 640px) and (max-width: 1023px) {
    .mkvfe-installation-header {
        flex-wrap: nowrap;
    }
    
    .mkvfe-installation-title {
        font-size: 15px;
    }
    
    .mkvfe-modal-content {
        max-width: calc(100vw - 40px);
        width: calc(100vw - 40px);
    }
}

/* Desktop Enhancements */
@media (min-width: 1024px) {
    .mkvfe-installation-header {
        flex-wrap: nowrap;
    }
    
    .mkvfe-installation-title {
        flex: 1;
        font-size: 16px;
    }

    .mkvfe-share-icons {
        justify-content: flex-start;
    }

    .mkvfe-share-link {
        flex: 0 0 auto;
        min-width: 80px;
    }
    
    .mkvfe-modal-content {
        max-width: var(--mkvfe-modal-width, 500px);
    }
}

/* Mobile Responsive */
@media (max-width: 639px) {
    .mkvfe-installation-wrapper {
        margin: 10px 0;
        padding: 10px;
    }
    
    .mkvfe-installation-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }
    
    .mkvfe-installation-title {
        font-size: 13px;
        flex: 1 1 auto;
        margin-right: 6px;
    }
    
    .mkvfe-installation-controls {
        flex: 0 0 auto;
        gap: 6px;
    }
    
    .mkvfe-divider {
        font-size: 12px;
    }
    
    .mkvfe-share-icons {
        margin-top: 8px;
        width: 100%;
        order: 3;
    }
    
    .mkvfe-share-link {
        font-size: 10px;
        padding: 5px 8px;
        min-width: 60px;
    }
    
    .mkvfe-installation-description {
        margin-top: 8px;
        order: 4;
        width: 100%;
        font-size: 11px;
    }
    
    .mkvfe-modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
        width: calc(100vw - 20px);
    }
    
    .mkvfe-modal-body {
        padding: 15px;
    }
}

/* Integration with existing plugin styles */
.mkvfe-variation-selector + .mkvfe-installation-wrapper,
.mkvfe-simple-product-wrapper + .mkvfe-installation-wrapper {
    margin-top: 24px;
}

/* Ensure proper z-index stacking */
.mkvfe-modal {
    z-index: 999999;
}

/* Accessibility improvements */
.mkvfe-toggle-switch:focus-within .mkvfe-slider {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.mkvfe-share-btn:focus {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

.mkvfe-modal-close:focus {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

/* Animation for share icons */
.mkvfe-share-icons {
    opacity: 0 !important;
}

.mkvfe-share-icons.show {
    opacity: 1 !important;
}

/* Clean modal background */
.mkvfe-modal.show {
    background: rgba(0, 0, 0, 0.65) !important;
}