/**
 * Apexaio Sliding Panel - Frontend CSS
 * Version: 3.0.0 - Fully Responsive
 */

/* ==========================================================================
   CSS Custom Properties - Single source of truth for sizing
   ========================================================================== */

:root {
    --asp-panel-width: 400px;
    --asp-button-size: 56px;
    --asp-button-gap: 14px;
    --asp-transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1024px) {
    :root {
        --asp-panel-width: 350px;
        --asp-button-size: 50px;
        --asp-button-gap: 12px;
    }
}

@media (max-width: 767px) {
    :root {
        --asp-panel-width: 88vw;
        --asp-button-size: 44px;
        --asp-button-gap: 10px;
    }
}

@media (max-width: 480px) {
    :root {
        --asp-panel-width: 92vw;
        --asp-button-size: 40px;
        --asp-button-gap: 8px;
    }
}

/* ==========================================================================
   Panel Core
   ========================================================================== */

.apexaio-sliding-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    height: 100%;
    /* Width comes from inline style set by PHP (per-panel admin setting) */
    /* Falls back to CSS variable if not set */
    z-index: 99999;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transition: transform var(--asp-transition);
    will-change: transform;
    box-sizing: border-box;
}

/* Left panel (default) */
.apexaio-panel-position-left {
    left: 0;
    right: auto;
    transform: translateX(-110%);
}

/* Right panel */
.apexaio-panel-position-right {
    right: 0;
    left: auto;
    transform: translateX(110%);
}

/* Open state */
.apexaio-sliding-panel.apexaio-panel-open {
    transform: translateX(0) !important;
}

/* Panel inner */
.apexaio-panel-inner {
    position: relative;
    padding: 56px 24px 32px;
    min-height: 100%;
    box-sizing: border-box;
}

/* Mobile panel inner */
@media (max-width: 767px) {
    .apexaio-panel-inner {
        padding: 20px 16px 32px;
    }
}

/* Close button (hidden by default per user preference) */
.apexaio-panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 10;
    color: inherit;
    flex-shrink: 0;
}

.apexaio-panel-close:hover {
    background: rgba(0,0,0,0.3);
}

/* Panel content */
.apexaio-panel-content {
    width: 100%;
    box-sizing: border-box;
}

/* WPForms inside panel - prevent iOS zoom */
.apexaio-panel-content input,
.apexaio-panel-content textarea,
.apexaio-panel-content select {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.apexaio-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    cursor: pointer;
}

.apexaio-panel-overlay.apexaio-overlay-active {
    display: block;
}

/* ==========================================================================
   Floating Trigger Buttons
   - JS handles transform for movement, never set transform here!
   - Position comes from inline style set by PHP
   ========================================================================== */

.apexaio-floating-trigger {
    position: fixed;
    z-index: 99997;
    width: var(--asp-button-size);
    height: var(--asp-button-size);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: box-shadow 0.3s ease, opacity 0.3s ease;
    /* NO transform here - JS owns transform */
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}

/* Shapes */
.apexaio-button-circle  { border-radius: 50%; }
.apexaio-button-rounded { border-radius: 12px; }
.apexaio-button-square  { border-radius: 0; }

.apexaio-floating-trigger:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.apexaio-floating-trigger:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

/* Icon wrappers */
.apexaio-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    pointer-events: none;
}

.apexaio-icon-wrapper svg {
    display: block;
    fill: currentColor;
    pointer-events: none;
}

/* Active state: show close icon, hide default */
.apexaio-trigger-active .apexaio-icon-default {
    display: none;
}

.apexaio-trigger-active .apexaio-icon-close {
    display: flex !important;
}

.apexaio-icon-close {
    display: none;
}

/* ==========================================================================
   Push Mode
   ========================================================================== */

.apexaio-push-target {
    transition: margin var(--asp-transition);
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.apexaio-panel-title.screen-reader-text {
    clip: rect(1px,1px,1px,1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .apexaio-sliding-panel,
    .apexaio-panel-overlay,
    .apexaio-push-target,
    .apexaio-floating-trigger,
    .apexaio-icon-wrapper {
        transition: none !important;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .apexaio-sliding-panel,
    .apexaio-panel-overlay,
    .apexaio-floating-trigger {
        display: none !important;
    }
}
