/* 
 * Kyrex Jewellery Customizer - Off-canvas Panel
 * Plugin Name: Kyrex Jewellery Customizer
 * Version: 1.4.5
 * Author: Kyrex
 * Website: https://www.kyrex.org/
 * 
 * Powered by Kyrex - Premium WordPress Solutions
 */

:root {
    --kyrex-primary: #1A3C34;
    --kyrex-bg: #F7F4EC;
    --kyrex-secondary: #476E50;
    --kyrex-accent: #C7A977;
    --kyrex-border: #d9d2c2;
    --kyrex-offcanvas-width: 480px;
    --kyrex-transition-speed: 300ms;
}

/* ============================================
   Summary Pill (kyrex-desc)
   ============================================ */
.kyrex-desc {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    background: #ffffff;
    border: 1px solid var(--kyrex-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    gap: 0 12px;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    /* For fade-out gradient positioning */
}

/* Fade-out gradient on the right side */
.kyrex-desc::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
    /* Allow clicks to pass through */
}

.kyrex-desc-section {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-right: 1px solid var(--kyrex-border);
    font-size: 13px;
    color: var(--kyrex-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.kyrex-desc-section:first-child {
    padding-left: 0;
}

.kyrex-desc-section:last-child {
    border-right: none;
    padding-right: 0;
}

.kyrex-desc-label {
    font-weight: 600;
    margin-right: 6px;
    color: var(--kyrex-primary);
}

.kyrex-desc-value {
    color: var(--kyrex-secondary);
    white-space: nowrap;
}

/* ============================================
   Customize Button
   ============================================ */
.kyrex-customize-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--kyrex-accent);
    color: #ffffff;
    border: 2px solid var(--kyrex-primary);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(199, 169, 119, 0.3);
}

.kyrex-customize-btn:hover {
    background: var(--kyrex-primary);
    color: var(--kyrex-accent);
    border-color: var(--kyrex-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(26, 60, 52, 0.4);
}

.kyrex-customize-btn:active {
    transform: translateY(0);
}

.kyrex-customize-btn.is-dimmed {
    opacity: 0.6;
}

/* ============================================
   Off-canvas Overlay
   ============================================ */
.kyrex-offcanvas-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    z-index: 99999998 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--kyrex-transition-speed) ease,
        visibility var(--kyrex-transition-speed) ease;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
}

.kyrex-offcanvas-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   Off-canvas Panel
   ============================================ */
.kyrex-offcanvas-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--kyrex-offcanvas-width);
    max-width: 100%;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 99999999 !important;
    transform: translateX(100%);
    transition: transform var(--kyrex-transition-speed) cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Ensure panel is on separate stacking context */
    isolation: isolate;
}

.kyrex-offcanvas-panel.is-open {
    transform: translateX(0);
}

/* Panel Header */
.kyrex-offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--kyrex-border);
    background: var(--kyrex-bg);
}

.kyrex-offcanvas-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--kyrex-primary);
    letter-spacing: 0.3px;
}

.kyrex-offcanvas-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: #f0f0f0;
    color: var(--kyrex-primary);
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.kyrex-offcanvas-close:hover {
    background: var(--kyrex-accent);
    color: #ffffff;
    transform: scale(1.1);
}

.kyrex-offcanvas-close:focus {
    outline: 2px solid var(--kyrex-accent);
    outline-offset: 2px;
}

/* Panel Body */
.kyrex-offcanvas-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.kyrex-offcanvas-body::-webkit-scrollbar {
    width: 8px;
}

.kyrex-offcanvas-body::-webkit-scrollbar-track {
    background: var(--kyrex-bg);
}

.kyrex-offcanvas-body::-webkit-scrollbar-thumb {
    background: var(--kyrex-border);
    border-radius: 4px;
}

.kyrex-offcanvas-body::-webkit-scrollbar-thumb:hover {
    background: var(--kyrex-secondary);
}

/* Panel Footer */
.kyrex-offcanvas-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--kyrex-border);
    background: var(--kyrex-bg);
}

.kyrex-offcanvas-apply {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--kyrex-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.kyrex-offcanvas-apply:hover {
    background: var(--kyrex-secondary);
    transform: translateY(-1px);
}

.kyrex-offcanvas-apply:active {
    transform: translateY(0);
}

.kyrex-offcanvas-apply:focus {
    outline: 2px solid var(--kyrex-accent);
    outline-offset: 2px;
}

/* ============================================
   Guide Buttons
   ============================================ */
.kyrex-guide-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin-top: 10px;
    background: transparent;
    border: 1px solid var(--kyrex-accent);
    border-radius: 6px;
    color: var(--kyrex-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kyrex-guide-link:hover {
    background: var(--kyrex-accent);
    color: var(--kyrex-primary);
    transform: translateY(-1px);
}

.kyrex-guide-link:focus {
    outline: 2px solid var(--kyrex-accent);
    outline-offset: 2px;
}

.kyrex-guide-link svg,
.kyrex-guide-link i {
    width: 16px;
    height: 16px;
}

/* ============================================
   Body Scroll Lock
   ============================================ */
body.kyrex-offcanvas-open {
    overflow: hidden;
}

/* ============================================
   Hide Theme Elements When Off-canvas is Open
   ============================================ */
/* Hide scroll-to-top button */
body.kyrex-offcanvas-open #bt-scroll-up,
body.kyrex-offcanvas-open #bt-scroll-up-reader {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Hide fixed header */
body.kyrex-offcanvas-open .item-is-fixed {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Additional safety: hide any fixed positioned elements except our customizer */
body.kyrex-offcanvas-open [style*="position: fixed"]:not(.kyrex-offcanvas-overlay):not(.kyrex-offcanvas-panel) {
    z-index: 1 !important;
}

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

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --kyrex-offcanvas-width: 420px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --kyrex-offcanvas-width: 100%;
    }

    .kyrex-offcanvas-header {
        padding: 16px 20px;
    }

    .kyrex-offcanvas-body {
        padding: 20px;
    }

    .kyrex-offcanvas-footer {
        padding: 16px 20px;
    }

    .kyrex-customize-btn {
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .kyrex-desc {
        padding: 10px 12px;
        font-size: 12px;
    }

    .kyrex-desc-label {
        margin-right: 4px;
    }

    .kyrex-offcanvas-title {
        font-size: 16px;
    }

    .kyrex-offcanvas-body {
        padding: 16px;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.kyrex-offcanvas-panel:focus {
    outline: none;
}

/* Keyboard navigation focus styles */
.kyrex-offcanvas-close:focus-visible,
.kyrex-offcanvas-apply:focus-visible,
.kyrex-customize-btn:focus-visible,
.kyrex-guide-link:focus-visible {
    outline: 3px solid var(--kyrex-accent);
    outline-offset: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .kyrex-desc,
    .kyrex-offcanvas-panel {
        border-width: 2px;
    }

    .kyrex-customize-btn,
    .kyrex-offcanvas-apply {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .kyrex-offcanvas-panel,
    .kyrex-offcanvas-overlay,
    .kyrex-customize-btn,
    .kyrex-offcanvas-close,
    .kyrex-guide-link {
        transition: none;
    }
}