/**
 * Elementor Widgets Frontend Styles
 * 
 * @package CWE_Agency_Core
 * @since 1.0.0
 */

/* Base Widget Styles */
.cwe-widget {
    margin-bottom: 30px;
}

/* Grid System */
.cwe-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* Post Item */
.cwe-post-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cwe-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.cwe-post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.cwe-post-content {
    padding: 20px;
}

.cwe-post-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.cwe-post-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.cwe-post-excerpt {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.cwe-read-more {
    display: inline-block;
    padding: 8px 16px;
    background: #2271b1;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s;
}

.cwe-read-more:hover {
    background: #135e96;
    color: #fff;
}

/* Filter Buttons */
.cwe-filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.cwe-filter-btn {
    padding: 8px 20px;
    background: #f5f5f5;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
}

.cwe-filter-btn.active,
.cwe-filter-btn:hover {
    background: #2271b1;
    color: #fff;
}

/* Accordion */
.cwe-accordion-item {
    margin-bottom: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

.cwe-accordion-header {
    padding: 15px 20px;
    background: #f9f9f9;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.cwe-accordion-header:hover {
    background: #f0f0f0;
}

.cwe-accordion-header .cwe-icon {
    margin-right: 10px;
}

.cwe-accordion-header .cwe-toggle-icon {
    float: right;
    transition: transform 0.2s;
}

.cwe-accordion-item.active .cwe-toggle-icon {
    transform: rotate(180deg);
}

.cwe-accordion-content {
    display: none;
    padding: 20px;
    background: #fff;
}

.cwe-accordion-item.active .cwe-accordion-content {
    display: block;
}

/* Counter */
.cwe-counter {
    font-size: 48px;
    font-weight: 700;
    color: #2271b1;
    line-height: 1;
}

/* Carousel Navigation */
.cwe-carousel {
    position: relative;
}

.swiper-button-next,
.swiper-button-prev {
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    color: #fff;
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 18px;
}

.swiper-pagination-bullet-active {
    background: #2271b1;
}

/* Lazy Loading */
.cwe-lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.cwe-lazy.cwe-loaded {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .cwe-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cwe-filter-buttons {
        gap: 8px;
    }
    
    .cwe-filter-btn {
        padding: 6px 16px;
        font-size: 14px;
    }
    
    .cwe-counter {
        font-size: 36px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cwe-animate {
    animation: fadeInUp 0.6s ease forwards;
}

/* ============================================
   CWE Hero Widget Styles
   Modern gradient background with abstract shapes
   ============================================ */

.cwe-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    isolation: isolate;
}

/* Container */
.cwe-hero-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Content Wrapper */
.cwe-hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

/* Layout variations */
.cwe-hero-content.left {
    text-align: left;
    margin-right: auto;
}

.cwe-hero-content.center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.cwe-hero-content.right {
    text-align: right;
    margin-left: auto;
}

/* Split Layout */
.cwe-hero-content.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.cwe-hero-split-left,
.cwe-hero-split-right {
    flex: 1;
}

/* Typography */
.cwe-hero-subtitle {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 20px;
    display: inline-block;
}

.cwe-hero-title {
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
}

.cwe-hero-description {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Buttons Container */
.cwe-hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

/* Button Styles */
.cwe-hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

/* Primary Button */
.cwe-hero-button.primary {
    background-color: #64ffda;
    color: #0a192f;
}

.cwe-hero-button.primary:hover {
    background-color: #52d1b5;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(100, 255, 218, 0.2);
}

/* Secondary Button */
.cwe-hero-button.secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.cwe-hero-button.secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Outline Button */
.cwe-hero-button.outline {
    background-color: transparent;
    border-color: #64ffda;
    color: #64ffda;
}

.cwe-hero-button.outline:hover {
    background-color: #64ffda;
    color: #0a192f;
    transform: translateY(-2px);
}

/* Text Only Button */
.cwe-hero-button.text {
    background-color: transparent;
    padding: 14px 0;
    color: #ffffff;
}

.cwe-hero-button.text:hover {
    color: #64ffda;
    transform: translateX(5px);
}

/* Button Icons */
.cwe-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.cwe-button-icon.left {
    margin-right: 8px;
}

.cwe-button-icon.right {
    margin-left: 8px;
}

/* Overlay */
.cwe-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
}

/* Background Image with Parallax */
.cwe-hero.cwe-parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Shape Divider */
.cwe-shape-divider {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
}

.cwe-shape-divider svg {
    display: block;
    width: calc(100% + 1.3px);
    height: 80px;
}

.cwe-shape-divider .shape-fill {
    fill: #ffffff;
}

/* Shape Divider variations */
.cwe-shape-divider svg {
    animation: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation Classes */
.cwe-animate {
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.cwe-fadeIn { animation-name: fadeIn; }
.cwe-fadeInUp { animation-name: fadeInUp; }
.cwe-fadeInDown { animation-name: fadeInDown; }
.cwe-fadeInLeft { animation-name: fadeInLeft; }
.cwe-fadeInRight { animation-name: fadeInRight; }
.cwe-zoomIn { animation-name: zoomIn; }
.cwe-slideInUp { animation-name: slideInUp; }

/* Responsive */
@media (max-width: 1024px) {
    .cwe-hero-content.split {
        flex-direction: column;
        text-align: center;
        gap: 40px;
    }
    
    .cwe-hero-buttons {
        justify-content: center;
    }
    
    .cwe-hero-title {
        font-size: clamp(32px, 5vw, 48px);
    }
    
    .cwe-hero-description {
        font-size: 16px;
    }
    
    .cwe-hero-button {
        padding: 12px 24px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .cwe-hero-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .cwe-hero-button {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .cwe-hero-subtitle {
        font-size: 14px;
        letter-spacing: 1px;
    }
    
    .cwe-hero-description {
        font-size: 15px;
    }
    
    .cwe-shape-divider svg {
        height: 40px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .cwe-animate {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .cwe-hero-button:hover {
        transform: none !important;
    }
}

/* Articles Widget Styles */
.cwe-articles-grid {
    display: grid;
    gap: 30px;
}

.cwe-articles-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.cwe-articles-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.cwe-articles-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }

.cwe-article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cwe-article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.cwe-article-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.cwe-article-content {
    padding: 20px;
}

.cwe-article-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

.cwe-article-meta .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 4px;
}

.cwe-article-title {
    font-size: 18px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.cwe-article-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.cwe-article-title a:hover {
    color: #2271b1;
}

.cwe-article-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.cwe-article-author {
    font-size: 13px;
    color: #888;
    margin-bottom: 15px;
}

.cwe-article-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
    transition: gap 0.2s;
}

.cwe-article-read-more:hover {
    gap: 12px;
}

@media (max-width: 768px) {
    .cwe-articles-grid.columns-2,
    .cwe-articles-grid.columns-3,
    .cwe-articles-grid.columns-4 {
        grid-template-columns: 1fr;
    }
}