/**
 * Advanced Offcanvas Widget v2.0 - Enhanced CSS
 * With Preset Styles & Content Builder Support
 */

/* ==================================
   BASE STYLES
================================== */

:root {
    --eoc-transition-duration: 400ms;
    --eoc-z-index-overlay: 9998;
    --eoc-z-index-offcanvas: 9999;
    --eoc-scrollbar-width: 0px;
}

.eoc-wrapper {
    position: relative;
}

/* ==================================
   TRIGGER STYLES
================================== */

.eoc-trigger {
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Button Trigger */
.eoc-trigger-button .eoc-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2271b1;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eoc-trigger-button .eoc-button:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

/* Icon & Floating Trigger */
.eoc-trigger-icon .eoc-icon-trigger,
.eoc-trigger-floating .eoc-icon-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #2271b1;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eoc-trigger-floating {
    position: fixed;
    z-index: 999;
}

.eoc-trigger-floating.eoc-floating-top-left {
    top: 20px;
    left: 20px;
}

.eoc-trigger-floating.eoc-floating-top-right {
    top: 20px;
    right: 20px;
}

.eoc-trigger-floating.eoc-floating-bottom-left {
    bottom: 20px;
    left: 20px;
}

.eoc-trigger-floating.eoc-floating-bottom-right {
    bottom: 20px;
    right: 20px;
}

.eoc-icon-trigger:hover {
    background: #135e96;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(34, 113, 177, 0.4);
}

/* Text Trigger */
.eoc-trigger-text .eoc-text-trigger {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.eoc-trigger-text .eoc-text-trigger:hover {
    color: #135e96;
    border-bottom-color: #135e96;
}

/* Image Trigger */
.eoc-trigger-image .eoc-image-trigger {
    display: inline-block;
    transition: transform 0.3s ease;
}

.eoc-trigger-image .eoc-image-trigger:hover {
    transform: scale(1.05);
}

.eoc-trigger-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Hamburger Trigger */
.eoc-trigger-hamburger .eoc-hamburger {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.eoc-hamburger span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--hamburger-color, #000);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.eoc-trigger.active .eoc-hamburger span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.eoc-trigger.active .eoc-hamburger span:nth-child(2) {
    opacity: 0;
}

.eoc-trigger.active .eoc-hamburger span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ==================================
   OVERLAY
================================== */

.eoc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--eoc-z-index-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--eoc-transition-duration) ease,
                visibility var(--eoc-transition-duration) ease;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.eoc-overlay.active {
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* ==================================
   OFFCANVAS PANEL
================================== */

.eoc-offcanvas {
    position: fixed;
    background: #ffffff;
    z-index: var(--eoc-z-index-offcanvas);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--eoc-transition-duration) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Position Variants */
.eoc-offcanvas.eoc-position-left {
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
}

.eoc-offcanvas.eoc-position-right {
    top: 0;
    right: 0;
    height: 100vh;
    transform: translateX(100%);
}

.eoc-offcanvas.eoc-position-top {
    top: 0;
    left: 0;
    width: 100%;
    transform: translateY(-100%);
}

.eoc-offcanvas.eoc-position-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    transform: translateY(100%);
}

/* Active State */
.eoc-offcanvas.active {
    transform: translate(0, 0) !important;
}

/* ==================================
   ANIMATION STYLES
================================== */

/* Slide (default - already defined above) */

/* Push */
body.eoc-push-active {
    transition: margin var(--eoc-transition-duration) ease;
}

body.eoc-push-active .eoc-position-left.active {
    margin-left: 350px; /* Will be overridden by inline styles */
}

body.eoc-push-active .eoc-position-right.active {
    margin-right: 350px;
}

/* Overlay - enhanced backdrop */
.eoc-style-overlay.eoc-offcanvas {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

/* Reveal */
body.eoc-reveal-active {
    transition: transform var(--eoc-transition-duration) ease;
    overflow-x: hidden;
}

body.eoc-reveal-active.has-offcanvas-left {
    transform: translateX(350px);
}

body.eoc-reveal-active.has-offcanvas-right {
    transform: translateX(-350px);
}

.eoc-style-reveal.eoc-offcanvas {
    transform: translate(0, 0) !important;
    transition: none;
}

/* Scale & Rotate */
.eoc-style-scale.eoc-offcanvas {
    transform-origin: center;
    transition: transform var(--eoc-transition-duration) cubic-bezier(0.68, -0.55, 0.265, 1.55),
                opacity var(--eoc-transition-duration) ease;
    opacity: 0;
}

.eoc-style-scale.eoc-offcanvas.eoc-position-left {
    transform: translateX(-100%) scale(0.8) rotate(-5deg);
}

.eoc-style-scale.eoc-offcanvas.eoc-position-right {
    transform: translateX(100%) scale(0.8) rotate(5deg);
}

.eoc-style-scale.eoc-offcanvas.active {
    transform: translate(0, 0) scale(1) rotate(0) !important;
    opacity: 1;
}

/* Fade */
.eoc-style-fade.eoc-offcanvas {
    opacity: 0;
    transition: opacity var(--eoc-transition-duration) ease,
                transform 0ms ease var(--eoc-transition-duration);
}

.eoc-style-fade.eoc-offcanvas.active {
    opacity: 1;
    transition-delay: 0ms;
}

/* Bounce */
.eoc-style-bounce.eoc-offcanvas.active {
    animation: eocBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes eocBounceIn {
    0% {
        transform: translateX(-100%) scale(0.5);
    }
    50% {
        transform: translateX(5%) scale(1.05);
    }
    70% {
        transform: translateX(-2%) scale(0.98);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

/* ==================================
   CLOSE BUTTON
================================== */

.eoc-close-button {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10;
}

.eoc-close-button:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.eoc-close-button.eoc-close-top-right {
    top: 15px;
    right: 15px;
}

.eoc-close-button.eoc-close-top-left {
    top: 15px;
    left: 15px;
}

.eoc-close-button.eoc-close-bottom-right {
    bottom: 15px;
    right: 15px;
}

.eoc-close-button.eoc-close-bottom-left {
    bottom: 15px;
    left: 15px;
}

.eoc-close-button.eoc-close-inside-header {
    position: relative;
    top: auto;
    right: auto;
    margin-left: auto;
}

/* ==================================
   CONTENT AREA
================================== */

.eoc-content {
    padding: 20px;
    min-height: 100%;
}

/* Content Items */
.eoc-content-item {
    margin-bottom: 15px;
}

.eoc-content-item:last-child {
    margin-bottom: 0;
}

/* Heading */
.eoc-heading {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 600;
}

/* Text */
.eoc-text {
    color: #666;
    line-height: 1.6;
}

.eoc-text p {
    margin: 0 0 15px 0;
}

.eoc-text p:last-child {
    margin-bottom: 0;
}

/* Button Item */
.eoc-button-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #2271b1;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.eoc-button-item:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

/* Icon */
.eoc-icon-wrapper {
    font-size: 32px;
    color: #2271b1;
    text-align: center;
}

/* Image */
.eoc-image,
.eoc-image-link img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Divider */
.eoc-divider {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 15px 0;
}

/* Spacer */
.eoc-spacer {
    display: block;
}

/* Menu */
.eoc-menu-wrapper {
    margin: 0;
}

.eoc-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.eoc-menu li {
    margin: 0;
}

.eoc-menu a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.eoc-menu a:hover {
    background: rgba(34, 113, 177, 0.1);
    color: #2271b1;
    padding-left: 20px;
}

.eoc-menu .current-menu-item > a,
.eoc-menu .current_page_item > a {
    background: rgba(34, 113, 177, 0.15);
    color: #2271b1;
    font-weight: 600;
}

/* Sub-menu */
.eoc-menu .sub-menu {
    list-style: none;
    padding-left: 20px;
    margin-top: 5px;
}

.eoc-menu .sub-menu a {
    padding: 8px 15px;
    font-size: 14px;
}

/* Search Form */
.eoc-search-form {
    display: flex;
    gap: 10px;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
}

.eoc-search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.eoc-search-input:focus {
    outline: none;
    border-color: #2271b1;
}

.eoc-search-submit {
    padding: 10px 20px;
    background: #2271b1;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eoc-search-submit:hover {
    background: #135e96;
}

/* Social Icons */
.eoc-social-icons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.eoc-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    color: #333;
    border-radius: 50%;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.3s ease;
}

.eoc-social-icon:hover {
    background: #2271b1;
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

/* ==================================
   PRESET STYLES
================================== */

/* Mobile Menu Preset */
.eoc-preset-mobile-menu .eoc-offcanvas {
    background: #1a1a1a;
    color: #ffffff;
}

.eoc-preset-mobile-menu .eoc-menu a {
    color: #ffffff;
    font-size: 18px;
    padding: 15px 20px;
}

.eoc-preset-mobile-menu .eoc-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 30px;
}

/* Shopping Cart Preset */
.eoc-preset-shopping-cart .eoc-offcanvas {
    background: #f8f9fa;
}

.eoc-preset-shopping-cart .eoc-heading {
    color: #2271b1;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

/* Contact Sidebar Preset */
.eoc-preset-contact-sidebar .eoc-offcanvas {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.eoc-preset-contact-sidebar .eoc-heading {
    color: #ffffff;
}

.eoc-preset-contact-sidebar .eoc-text {
    color: rgba(255, 255, 255, 0.9);
}

/* Filter Panel Preset */
.eoc-preset-filter-panel .eoc-offcanvas {
    background: #ffffff;
}

.eoc-preset-filter-panel .eoc-heading {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 10px;
}

/* Newsletter Preset */
.eoc-preset-newsletter .eoc-offcanvas {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.eoc-preset-newsletter .eoc-heading {
    color: #856404;
}

/* Social Links Preset */
.eoc-preset-social-links .eoc-offcanvas {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    text-align: center;
    padding: 40px 20px;
}

.eoc-preset-social-links .eoc-social-icons {
    justify-content: center;
    gap: 15px;
}

.eoc-preset-social-links .eoc-social-icon {
    width: 50px;
    height: 50px;
    font-size: 22px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.eoc-preset-social-links .eoc-social-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1) translateY(-5px);
}

/* Search Panel Preset */
.eoc-preset-search-panel .eoc-offcanvas {
    background: #2c3e50;
    color: #ffffff;
}

.eoc-preset-search-panel .eoc-search-input {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.eoc-preset-search-panel .eoc-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* User Account Preset */
.eoc-preset-user-account .eoc-offcanvas {
    background: #ffffff;
}

.eoc-preset-user-account .eoc-menu a {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

/* Quick Links Preset */
.eoc-preset-quick-links .eoc-button-item {
    width: 100%;
    justify-content: center;
    padding: 15px;
    margin-bottom: 10px;
    font-size: 16px;
}

/* Notification Preset */
.eoc-preset-notification .eoc-offcanvas {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.eoc-preset-notification .eoc-heading {
    color: #155724;
}

.eoc-preset-notification .eoc-text {
    color: #155724;
}

/* ==================================
   BODY SCROLL LOCK
================================== */

body.eoc-no-scroll {
    overflow: hidden;
    padding-right: var(--eoc-scrollbar-width);
}

/* ==================================
   RESPONSIVE
================================== */

@media (max-width: 1024px) {
    .eoc-offcanvas.eoc-position-left,
    .eoc-offcanvas.eoc-position-right {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .eoc-offcanvas.eoc-position-left,
    .eoc-offcanvas.eoc-position-right {
        width: 85vw;
        max-width: 400px;
    }
    
    .eoc-content {
        padding: 15px;
    }
    
    .eoc-menu a {
        font-size: 16px;
    }
    
    .eoc-trigger-floating {
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .eoc-offcanvas.eoc-position-left,
    .eoc-offcanvas.eoc-position-right {
        width: 90vw;
    }
    
    .eoc-content {
        padding: 12px;
    }
}

/* ==================================
   ACCESSIBILITY
================================== */

@media (prefers-reduced-motion: reduce) {
    .eoc-offcanvas,
    .eoc-overlay,
    .eoc-trigger,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.eoc-offcanvas:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .eoc-offcanvas {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .eoc-heading {
        color: #ffffff;
    }
    
    .eoc-text {
        color: rgba(255, 255, 255, 0.8);
    }
    
    .eoc-menu a {
        color: #ffffff;
    }
    
    .eoc-divider {
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* Print Styles */
@media print {
    .eoc-wrapper,
    .eoc-overlay {
        display: none !important;
    }
}

/* ==================================
   CUSTOM SCROLLBAR
================================== */

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

.eoc-offcanvas::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.eoc-offcanvas::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.eoc-offcanvas::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ==================================
   LOADING STATE
================================== */

.eoc-offcanvas.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.eoc-offcanvas.is-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(34, 113, 177, 0.3);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: eocSpin 0.8s linear infinite;
}

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