/* ================================================
   SIDEBAR STYLES - Inheriting from style.css
   Version: 1.0 - CSS Variables Integration
   ================================================ */

/* Sidebar Wrapper */
.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Base Widget Styles */
.sidebar-widget {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.sidebar-widget:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Widget Header */
.sidebar-widget-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    color: var(--text-white);
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 3px solid var(--primary-dark);
}

.sidebar-widget-header i {
    font-size: var(--text-xl);
    flex-shrink: 0;
}

.sidebar-widget-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin: 0;
    color: var(--text-white);
}

/* Widget Body */
.sidebar-widget-body {
    padding: var(--space-5);
}

/* ================================================
   POPULAR POSTS WIDGET
   ================================================ */

.sidebar-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.sidebar-post-item {
    display: flex;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.sidebar-post-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-post-item:hover {
    transform: translateX(4px);
}

.sidebar-post-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.sidebar-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.sidebar-post-image:hover img {
    transform: scale(1.1);
}

.sidebar-post-content {
    flex: 1;
    min-width: 0;
}

.sidebar-post-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    margin: 0 0 var(--space-2) 0;
    line-height: var(--leading-snug);
}

.sidebar-post-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-base);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-post-title a:hover {
    color: var(--primary-blue);
}

.sidebar-post-date {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.sidebar-post-date i {
    font-size: var(--text-xs);
}

/* ================================================
   LINKS LIST (Tools, etc.)
   ================================================ */

.sidebar-links-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-links-list li {
    position: relative;
}

.sidebar-links-list a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    border-left: 3px solid transparent;
}

.sidebar-links-list a:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
    border-left-color: var(--primary-blue);
    transform: translateX(4px);
    text-decoration: none;
}

.sidebar-links-list a i {
    color: var(--primary-blue);
    font-size: var(--text-base);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ================================================
   TERMS GRID
   ================================================ */

.sidebar-terms-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.sidebar-term-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.sidebar-term-badge:hover {
    background: var(--primary-blue);
    color: var(--text-white);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.sidebar-term-badge i {
    font-size: var(--text-xs);
    flex-shrink: 0;
}

.sidebar-term-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================
   DOWNLOAD WIDGET
   ================================================ */

.sidebar-download-widget {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(251, 113, 133, 0.05));
    border: 2px dashed var(--error-red);
}

.sidebar-download-content {
    text-align: center;
}

.sidebar-download-content i {
    font-size: var(--text-5xl);
    color: var(--error-red);
    margin-bottom: var(--space-4);
}

.sidebar-download-content h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.sidebar-download-content p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
    line-height: var(--leading-relaxed);
}

.sidebar-download-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: linear-gradient(135deg, var(--error-red), #dc2626);
    color: var(--text-white);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    transition: all var(--transition-base);
}

.sidebar-download-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--text-white);
    text-decoration: none;
}

/* ================================================
   CTA WIDGET
   ================================================ */

.sidebar-cta-widget {
    background: linear-gradient(135deg, var(--bg-dark), #0f172a);
    border: none;
    position: relative;
    overflow: hidden;
}

.sidebar-cta-widget::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    animation: sidebarPulse 3s ease-in-out infinite;
}

@keyframes sidebarPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.sidebar-cta-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.sidebar-cta-content i {
    font-size: var(--text-5xl);
    color: var(--text-white);
    margin-bottom: var(--space-4);
    opacity: 0.9;
}

.sidebar-cta-content h3 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-white);
    margin-bottom: var(--space-3);
}

.sidebar-cta-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--text-base);
    margin-bottom: var(--space-5);
    line-height: var(--leading-relaxed);
}

.sidebar-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    text-decoration: none;
    transition: all var(--transition-base);
    margin-bottom: var(--space-3);
    border: 2px solid transparent;
}

.sidebar-cta-btn:last-child {
    margin-bottom: 0;
}

.sidebar-cta-btn-primary {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    color: var(--text-white);
    border-color: var(--accent-orange);
}

.sidebar-cta-btn-primary:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--text-white);
    text-decoration: none;
}

.sidebar-cta-btn-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: var(--text-white);
    border-color: #25d366;
}

.sidebar-cta-btn-whatsapp:hover {
    background: linear-gradient(135deg, #128c7e, #075e54);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--text-white);
    text-decoration: none;
}

/* ================================================
   STICKY WIDGET
   ================================================ */

.sidebar-sticky-widget {
    transition: all var(--transition-slow);
}

.sidebar-sticky-widget.is-sticky {
    box-shadow: var(--shadow-2xl);
}

/* ================================================
   FLOATING SIDEBAR TOGGLE - Progressive Enhancement
   ================================================ */

.sidebar-floating-toggle {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-sticky);
    display: none;
}

@media (max-width: 1439px) {
    .sidebar-floating-toggle {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        padding: var(--space-4) var(--space-5);
        background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
        color: var(--text-white);
        border: none;
        border-radius: var(--radius-full);
        font-size: var(--text-base);
        font-weight: var(--font-semibold);
        cursor: pointer;
        box-shadow: var(--shadow-xl);
        transition: all var(--transition-base);
        font-family: var(--font-primary);
    }
    
    .sidebar-floating-toggle:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-2xl);
    }
    
    .sidebar-floating-toggle i {
        font-size: var(--text-lg);
    }
}

/* Overlay sidebar - slides in from right */
.sidebar-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(400px, 90vw);
    height: 100vh;
    background: var(--bg-white);
    box-shadow: var(--shadow-2xl);
    z-index: var(--z-modal);
    overflow-y: auto;
    transition: right var(--transition-slow);
}

.sidebar-overlay.active {
    right: 0;
}

.sidebar-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.sidebar-overlay-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-overlay-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    color: var(--text-white);
    border-bottom: 3px solid var(--primary-dark);
    z-index: 1;
}

.sidebar-overlay-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    margin: 0;
}

.sidebar-overlay-close {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: var(--text-2xl);
    cursor: pointer;
    padding: var(--space-2);
    line-height: 1;
    transition: transform var(--transition-base);
}

.sidebar-overlay-close:hover {
    transform: rotate(90deg);
}

.sidebar-overlay-content {
    padding: var(--space-5);
}

.sidebar-overlay .sidebar-wrapper {
    gap: var(--space-5);
}

/* ================================================
   RESPONSIVE DESIGN - 1440px Breakpoint
   ================================================ */

/* Below 1440px: Hide static sidebar, show floating button */
@media (max-width: 1439px) {
    .col-xl-4 {
        flex: 0 0 0%;
        max-width: 0%;
        overflow: hidden;
        padding: 0;
        margin: 0;
    }
    
    .col-xl-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .sidebar-wrapper {
        display: none;
    }
}

/* Desktop 1440px+: Show static sidebar */
@media (min-width: 1440px) {
    .col-xl-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    .col-xl-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
    
    .sidebar-wrapper {
        display: flex;
    }
    
    /* Hide floating button and overlay on desktop */
    .sidebar-floating-toggle,
    .sidebar-overlay,
    .sidebar-overlay-backdrop {
        display: none;
    }
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .sidebar-widget-body {
        padding: var(--space-4);
    }
    
    .sidebar-post-image {
        width: 60px;
        height: 60px;
    }
    
    .sidebar-post-title {
        font-size: var(--text-xs);
    }
    
    .sidebar-cta-content h3 {
        font-size: var(--text-xl);
    }
    
    .sidebar-terms-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar-overlay {
        width: 100vw;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .sidebar-widget,
    .sidebar-post-item,
    .sidebar-links-list a,
    .sidebar-term-badge,
    .sidebar-cta-btn,
    .sidebar-overlay,
    .sidebar-floating-toggle {
        transition: none;
    }
    
    .sidebar-cta-widget::before {
        animation: none;
    }
}