/**
 * Slide Out Filters Widget Stylesheet
 *
 * Styles for the slide-out filters panel widget including:
 * - Toggle button
 * - Slide-out panel with animation
 * - Overlay
 * - Filter groups and options
 * - Responsive behavior
 *
 * @package Storedash
 * @since 3.4.0
 */

/* ============================================
   Wrapper & Base Styles
   ============================================ */

.storedash-slide-out-filters-wrapper {
    position: relative;
    z-index: 10000000;
}

.storedash-slide-out-filters-wrapper.fixed-bottom-left {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10000000;
}

.storedash-slide-out-filters-wrapper.fixed-bottom-right {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000000;
}

.storedash-slide-out-filters-wrapper.fixed-top-left {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 10000000;
}

.storedash-slide-out-filters-wrapper.fixed-top-right {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 10000000;
}

/* ============================================
   Toggle Button
   ============================================ */

.storedash-slide-out-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    line-height: 1;
}

.storedash-slide-out-toggle:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.storedash-slide-out-toggle:active {
    transform: translateY(0);
}

.storedash-slide-out-toggle:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.storedash-slide-out-toggle .button-icon,
.storedash-slide-out-toggle svg,
.storedash-slide-out-toggle i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.storedash-slide-out-toggle .button-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.storedash-slide-out-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000001;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.storedash-slide-out-overlay.visible {
    opacity: 1;
}

/* ============================================
   Slide Out Panel
   ============================================ */

.storedash-slide-out-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 350px;
    background-color: #ffffff;
    z-index: 10000002;
    display: none;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.storedash-slide-out-panel.open {
    transform: translateX(0);
}

/* Panel Header */
.storedash-slide-out-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.storedash-slide-out-panel .panel-heading {
    margin: 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1;
}

.storedash-slide-out-panel .panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s ease;
}

.storedash-slide-out-panel .panel-close:hover {
    color: #374151;
}

.storedash-slide-out-panel .panel-close svg {
    width: 24px;
    height: 24px;
}

/* Panel Content */
.storedash-slide-out-panel .panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.storedash-slide-out-panel .filters-container {
    padding: 20px;
}

.storedash-slide-out-panel .no-filters {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    margin: 0;
}

/* Panel Footer */
.storedash-slide-out-panel .panel-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background-color: #f9fafb;
}

/* ============================================
   Filter Groups & Options
   ============================================ */

.filter-group {
    margin-bottom: 16px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    overflow: hidden;
}

.filter-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    transition: color 0.2s ease;
}

.filter-group-toggle:hover {
    color: #2563eb;
}

.filter-group-toggle .filter-group-title {
    margin: 0;
    padding: 0;
    text-align: left;
}

.filter-group-toggle .toggle-icon {
    transition: transform 0.3s ease;
    color: currentColor;
    flex-shrink: 0;
}

.filter-group-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.filter-options-wrapper {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    margin-top: 12px;
}

.filter-options-wrapper.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.filter-group:not(.collapsible) .filter-group-title {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1f2937;
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Filter Group Divider */
.filter-group-divider {
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    margin: 16px 0;
}

.filter-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
    color: #374151;
    transition: color 0.2s ease;
}

.filter-option:hover {
    color: #2563eb;
}

.filter-option input[type="checkbox"] {
    margin-top: 4px;
    cursor: pointer;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.filter-option .filter-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.filter-option .filter-count {
    color: #9ca3af;
    font-size: 12px;
    flex-shrink: 0;
}

/* ============================================
   Filter Search
   ============================================ */

.filter-search-container {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.filter-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.filter-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================
   Buttons
   ============================================ */

.filter-apply,
.filter-reset {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Single button takes full width */
.panel-footer .filter-apply:only-child,
.panel-footer .filter-reset:only-child {
    flex: 1;
}

.filter-apply {
    background-color: #2563eb;
    color: #ffffff;
}

.filter-apply:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.filter-apply:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.filter-reset {
    background-color: #e5e7eb;
    color: #374151;
}

.filter-reset:hover {
    background-color: #d1d5db;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

@media (max-width: 768px) {
    /* Panel width is controlled by Elementor responsive settings */

    .storedash-slide-out-filters-wrapper.fixed-bottom-left,
    .storedash-slide-out-filters-wrapper.fixed-bottom-right,
    .storedash-slide-out-filters-wrapper.fixed-top-left,
    .storedash-slide-out-filters-wrapper.fixed-top-right {
        bottom: 20px;
        top: auto;
        right: 20px;
        left: 20px;
    }

    .storedash-slide-out-toggle {
        padding: 10px 16px;
        font-size: 13px;
    }

    .storedash-slide-out-toggle .button-icon,
    .storedash-slide-out-toggle svg,
    .storedash-slide-out-toggle i {
        width: 20px;
        height: 20px;
    }

    .storedash-slide-out-toggle .button-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .storedash-slide-out-panel .panel-header {
        padding: 16px;
    }

    .storedash-slide-out-panel .panel-heading {
        font-size: 16px;
    }

    .storedash-slide-out-panel .filters-container {
        padding: 16px;
    }

    .storedash-slide-out-panel .panel-footer {
        padding: 16px;
        flex-direction: column;
    }

    .filter-apply,
    .filter-reset {
        width: 100%;
    }

    .filter-group {
        padding: 12px;
        margin-bottom: 12px;
    }
}

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

/* Focus visible for keyboard navigation */
.storedash-slide-out-toggle:focus-visible,
.panel-close:focus-visible,
.filter-group-toggle:focus-visible,
.filter-apply:focus-visible,
.filter-reset:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .storedash-slide-out-toggle,
    .storedash-slide-out-overlay,
    .storedash-slide-out-panel,
    .panel-close,
    .filter-option,
    .filter-apply,
    .filter-reset,
    .filter-group-toggle .toggle-icon,
    .filter-options-wrapper {
        transition: none !important;
        animation: none !important;
    }

    .storedash-slide-out-panel {
        transform: translateX(0);
    }

    .storedash-slide-out-panel:not(.open) {
        display: none;
    }
}
