/* ==========================================================================
   Empowering Cards Widget - CSS
   ========================================================================== */

/* CSS Variables */
:root {
    --ec-bg: #f8f9fa;
    --ec-text-primary: #1a1a1a;
    --ec-text-secondary: #666666;
    --ec-card-bg: #ffffff;
    --ec-card-border: rgba(0, 0, 0, 0.08);
    --ec-circle-color: rgba(0, 0, 0, 0.06);
    --ec-dot-color: rgba(0, 0, 0, 0.15);
    --ec-shadow: 
        0 0.78px 0.78px rgba(0,0,0,0.04),
        0 1.92px 1.92px rgba(0,0,0,0.04),
        0 3.64px 3.64px rgba(0,0,0,0.04),
        0 6.35px 6.35px rgba(0,0,0,0.04),
        0 11.05px 11.05px rgba(0,0,0,0.04),
        0 20.24px 20.24px rgba(0,0,0,0.03),
        0 40px 40px rgba(0,0,0,0.02);
}

/* ==========================================================================
   Section
   ========================================================================== */
.ec-section {
    position: relative;
    min-height: 700px;
    background-color: var(--ec-bg);
    padding: 80px 40px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Background Circles
   ========================================================================== */
.ec-circles-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.ec-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px dashed var(--ec-circle-color);
    border-radius: 50%;
}

.ec-circle-outer {
    width: 90%;
    max-width: 800px;
    aspect-ratio: 1;
}

.ec-circle-middle {
    width: 75%;
    max-width: 680px;
    aspect-ratio: 1;
}

.ec-circle-inner {
    width: 60%;
    max-width: 560px;
    aspect-ratio: 1;
}

/* Circle Rotation Animation */
[data-animate-circles="true"] .ec-circle-outer {
    animation: ec-rotate-clockwise var(--rotation-duration, 60s) linear infinite;
}

[data-animate-circles="true"] .ec-circle-middle {
    animation: ec-rotate-counter var(--rotation-duration, 48s) linear infinite;
}

[data-animate-circles="true"] .ec-circle-inner {
    animation: ec-rotate-clockwise var(--rotation-duration, 36s) linear infinite;
}

@keyframes ec-rotate-clockwise {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes ec-rotate-counter {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* Circle Flags */
.ec-circle-flag {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #ffffff;
    background: #f0f0f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-sizing: border-box;
}

.ec-circle-flag img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 2px;
}

.ec-circle-flag:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

/* Counter-rotate flags to keep them upright during circle rotation */
[data-animate-circles="true"] .ec-circle-outer .ec-circle-flag {
    animation: ec-counter-rotate-outer var(--rotation-duration, 60s) linear infinite;
}

[data-animate-circles="true"] .ec-circle-middle .ec-circle-flag {
    animation: ec-counter-rotate-middle var(--rotation-duration, 48s) linear infinite;
}

[data-animate-circles="true"] .ec-circle-inner .ec-circle-flag {
    animation: ec-counter-rotate-inner var(--rotation-duration, 36s) linear infinite;
}

@keyframes ec-counter-rotate-outer {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(-360deg); }
}

@keyframes ec-counter-rotate-middle {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes ec-counter-rotate-inner {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* Position flags around the circles */
.ec-circle-outer .ec-circle-flag:nth-child(1) { top: 0; left: 50%; }
.ec-circle-outer .ec-circle-flag:nth-child(2) { top: 50%; left: 100%; }
.ec-circle-outer .ec-circle-flag:nth-child(3) { top: 100%; left: 50%; }
.ec-circle-outer .ec-circle-flag:nth-child(4) { top: 50%; left: 0; }

.ec-circle-middle .ec-circle-flag:nth-child(1) { top: 15%; left: 85%; }
.ec-circle-middle .ec-circle-flag:nth-child(2) { top: 85%; left: 85%; }
.ec-circle-middle .ec-circle-flag:nth-child(3) { top: 85%; left: 15%; }

.ec-circle-inner .ec-circle-flag:nth-child(1) { top: 20%; left: 20%; }
.ec-circle-inner .ec-circle-flag:nth-child(2) { top: 80%; left: 80%; }

/* ==========================================================================
   Floating Cards
   ========================================================================== */
.ec-cards-container {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.ec-card {
    position: absolute;
    left: var(--pos-x, 50%);
    top: var(--pos-y, 50%);
    transform: translate(-50%, -50%) rotate(var(--card-rotation, 0deg));
    width: var(--card-width, 150px);
    height: var(--card-height, 200px);
    pointer-events: auto;
    animation: ec-float 6s ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.ec-card.ec-visible {
    opacity: 1;
}

@keyframes ec-float {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(var(--card-rotation, 0deg)) translateY(0);
    }
    50% {
        transform: translate(-50%, -50%) rotate(var(--card-rotation, 0deg)) translateY(-12px);
    }
}

.ec-card-inner {
    width: 100%;
    height: 100%;
    background-color: var(--ec-card-bg);
    border: 1px solid var(--ec-card-border);
    border-radius: 32px;
    padding: 4px;
    box-sizing: border-box;
}

.ec-card-image {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--ec-shadow);
    background-color: #f0f0f0;
}

.ec-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card Hover Effect */
.ec-card:hover {
    z-index: 10;
}

.ec-card:hover .ec-card-inner {
    transform: scale(1.05);
    transition: transform 0.3s ease-out;
}

/* ==========================================================================
   Center Heading
   ========================================================================== */
.ec-heading {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 500px;
    padding: 40px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.ec-heading.ec-visible {
    opacity: 1;
    transform: scale(1);
}

.ec-globe {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    animation: ec-globe-pulse 4s ease-in-out infinite;
}

@keyframes ec-globe-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.ec-globe img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ec-title {
    color: var(--ec-text-primary);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}

.ec-description {
    color: var(--ec-text-secondary);
    font-size: clamp(15px, 2vw, 17px);
    line-height: 1.6;
    margin: 0;
    max-width: 400px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
    .ec-section {
        min-height: 600px;
        padding: 60px 30px;
    }

    .ec-card {
        --card-width: calc(var(--card-width) * 0.85) !important;
        --card-height: calc(var(--card-height) * 0.85) !important;
    }

    .ec-circle-outer { max-width: 650px; }
    .ec-circle-middle { max-width: 550px; }
    .ec-circle-inner { max-width: 450px; }

    .ec-circle-flag {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 768px) {
    .ec-section {
        min-height: 550px;
        padding: 50px 20px;
    }

    .ec-card {
        --card-width: calc(var(--card-width) * 0.7) !important;
        --card-height: calc(var(--card-height) * 0.7) !important;
    }

    .ec-card-inner {
        border-radius: 20px;
    }

    .ec-card-image {
        border-radius: 16px;
    }

    .ec-heading {
        padding: 30px 20px;
    }

    .ec-globe {
        width: 60px;
        height: 60px;
    }

    .ec-circle-outer { max-width: 500px; }
    .ec-circle-middle { max-width: 420px; }
    .ec-circle-inner { max-width: 340px; }

    .ec-circle-flag {
        width: 28px;
        height: 28px;
        border-width: 1.5px;
    }
}

@media (max-width: 480px) {
    .ec-section {
        min-height: 500px;
        padding: 40px 16px;
    }

    .ec-card {
        --card-width: calc(var(--card-width) * 0.55) !important;
        --card-height: calc(var(--card-height) * 0.55) !important;
    }

    .ec-card-inner {
        border-radius: 16px;
        padding: 3px;
    }

    .ec-card-image {
        border-radius: 12px;
    }

    .ec-globe {
        width: 50px;
        height: 50px;
        margin-bottom: 16px;
    }

    .ec-title {
        font-size: 24px;
    }

    .ec-description {
        font-size: 14px;
    }

    /* Hide some cards on mobile for cleaner look */
    .ec-card:nth-child(n+6) {
        display: none;
    }

    .ec-circles-container {
        opacity: 0.7;
    }

    .ec-circle-flag {
        width: 24px;
        height: 24px;
        border-width: 1px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ec-card,
    .ec-circle,
    .ec-circle-flag,
    .ec-globe {
        animation: none;
    }

    .ec-card {
        opacity: 1;
    }

    .ec-heading {
        opacity: 1;
        transform: scale(1);
    }

    .ec-circle-flag {
        transform: translate(-50%, -50%);
    }
}

/* ==========================================================================
   Elementor Editor
   ========================================================================== */
.elementor-editor-active .ec-card {
    opacity: 1;
}

.elementor-editor-active .ec-heading {
    opacity: 1;
    transform: scale(1);
}

.elementor-editor-active .ec-card,
.elementor-editor-active .ec-circle,
.elementor-editor-active .ec-circle-flag,
.elementor-editor-active .ec-globe {
    animation-play-state: paused;
}

/* ==========================================================================
   Dark Theme Variant
   ========================================================================== */
.ec-section[data-theme="dark"] {
    --ec-bg: #0f0f0f;
    --ec-text-primary: #f5f5f5;
    --ec-text-secondary: #a0a0a0;
    --ec-card-bg: #1a1a1a;
    --ec-card-border: rgba(255, 255, 255, 0.1);
    --ec-circle-color: rgba(255, 255, 255, 0.08);
    --ec-dot-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Gradient Overlay (optional)
   ========================================================================== */
.ec-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        var(--ec-bg) 80%
    );
    pointer-events: none;
    z-index: 3;
}
