/**
 * MegaPrice Theme - Widgets Stylesheet
 * Version: 1.0.0
 * 
 * Styling for custom widgets and widget areas
 */

/* =============================================================================
   WIDGET AREAS - BASE
   ============================================================================= */
.widget-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.widget {
    background: var(--color-white, #fff);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-gray-800, #1f2937);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-gray-100, #f3f4f6);
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--color-primary, #ff6b35);
}

/* =============================================================================
   POPULAR PRODUCTS WIDGET
   ============================================================================= */
.widget-popular-products .popular-product-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--color-gray-100, #f3f4f6);
    transition: transform 0.2s ease;
}

.widget-popular-products .popular-product-item:first-child {
    padding-top: 0;
}

.widget-popular-products .popular-product-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.widget-popular-products .popular-product-item:hover {
    transform: translateX(5px);
}

.widget-popular-products .popular-product-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--color-gray-50, #f9fafb);
}

.widget-popular-products .popular-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.widget-popular-products .popular-product-item:hover .popular-product-image img {
    transform: scale(1.1);
}

.widget-popular-products .popular-product-info {
    flex: 1;
    min-width: 0;
}

.widget-popular-products .popular-product-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-gray-800, #1f2937);
    margin: 0 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.widget-popular-products .popular-product-title a {
    color: inherit;
    text-decoration: none;
}

.widget-popular-products .popular-product-title a:hover {
    color: var(--color-primary, #ff6b35);
}

.widget-popular-products .popular-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary, #ff6b35);
}

.widget-popular-products .popular-product-price .woocommerce-Price-amount {
    font-weight: inherit;
}

/* =============================================================================
   PRICE DROPS WIDGET
   ============================================================================= */
.widget-price-drops .price-drop-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--color-gray-100, #f3f4f6);
    position: relative;
}

.widget-price-drops .price-drop-item:first-child {
    padding-top: 0;
}

.widget-price-drops .price-drop-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.widget-price-drops .discount-badge {
    position: absolute;
    top: 15px;
    left: 0;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 1;
}

.widget-price-drops .price-drop-item:first-child .discount-badge {
    top: 0;
}

.widget-price-drops .price-drop-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--color-gray-50, #f9fafb);
}

.widget-price-drops .price-drop-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.widget-price-drops .price-drop-info {
    flex: 1;
    min-width: 0;
}

.widget-price-drops .price-drop-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-gray-800, #1f2937);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.widget-price-drops .price-drop-title a {
    color: inherit;
    text-decoration: none;
}

.widget-price-drops .price-drop-title a:hover {
    color: var(--color-primary, #ff6b35);
}

.widget-price-drops .price-drop-prices {
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-price-drops .old-price {
    font-size: 0.875rem;
    color: var(--color-gray-400, #9ca3af);
    text-decoration: line-through;
}

.widget-price-drops .new-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-success, #10b981);
}

/* =============================================================================
   CATEGORIES WIDGET
   ============================================================================= */
.widget-categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-categories li {
    border-bottom: 1px solid var(--color-gray-100, #f3f4f6);
}

.widget-categories li:last-child {
    border-bottom: none;
}

.widget-categories a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    color: var(--color-gray-700, #374151);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.widget-categories a:hover {
    color: var(--color-primary, #ff6b35);
    padding-left: 10px;
}

.widget-categories .cat-icon {
    margin-right: 10px;
    opacity: 0.7;
}

.widget-categories .cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    background: var(--color-gray-100, #f3f4f6);
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-gray-500, #6b7280);
    transition: all 0.2s ease;
}

.widget-categories a:hover .cat-count {
    background: var(--color-primary, #ff6b35);
    color: white;
}

/* =============================================================================
   NEWSLETTER WIDGET
   ============================================================================= */
.widget-newsletter {
    background: linear-gradient(135deg, var(--color-primary, #ff6b35) 0%, var(--color-primary-dark, #e55a2b) 100%);
    color: white;
}

.widget-newsletter .widget-title {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.widget-newsletter .widget-title::after {
    background: rgba(255, 255, 255, 0.5);
}

.widget-newsletter .newsletter-description {
    font-size: 0.9375rem;
    opacity: 0.9;
    margin-bottom: 20px;
    line-height: 1.6;
}

.widget-newsletter .newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.widget-newsletter .newsletter-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.widget-newsletter .newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.widget-newsletter .newsletter-input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.15);
}

.widget-newsletter .newsletter-submit {
    width: 100%;
    padding: 14px 20px;
    background: white;
    color: var(--color-primary, #ff6b35);
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-newsletter .newsletter-submit:hover {
    background: var(--color-gray-100, #f3f4f6);
    transform: translateY(-2px);
}

.widget-newsletter .newsletter-privacy {
    font-size: 0.8125rem;
    opacity: 0.7;
    margin-top: 10px;
}

.widget-newsletter .newsletter-privacy a {
    color: inherit;
    text-decoration: underline;
}

/* Newsletter Message States */
.widget-newsletter .newsletter-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-top: 12px;
    display: none;
}

.widget-newsletter .newsletter-message.success {
    display: block;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.widget-newsletter .newsletter-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* =============================================================================
   PRICE FILTER WIDGET
   ============================================================================= */
.widget-price-filter {
    padding: 24px;
}

.widget-price-filter .price-range-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: var(--color-gray-600, #4b5563);
}

.widget-price-filter .price-range-value {
    font-weight: 600;
    color: var(--color-gray-800, #1f2937);
}

.widget-price-filter .price-slider-wrap {
    position: relative;
    height: 6px;
    margin: 30px 0;
}

.widget-price-filter .price-slider-track {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--color-gray-200, #e5e7eb);
    border-radius: 3px;
}

.widget-price-filter .price-slider-range {
    position: absolute;
    height: 100%;
    background: var(--color-primary, #ff6b35);
    border-radius: 3px;
}

.widget-price-filter .price-slider-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--color-primary, #ff6b35);
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.widget-price-filter .price-slider-handle:hover,
.widget-price-filter .price-slider-handle:active {
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.2);
}

.widget-price-filter .price-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.widget-price-filter .price-input-group {
    flex: 1;
}

.widget-price-filter .price-input-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-gray-600, #4b5563);
    margin-bottom: 6px;
}

.widget-price-filter .price-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-gray-300, #d1d5db);
    border-radius: 8px;
    font-size: 0.9375rem;
    color: var(--color-gray-800, #1f2937);
    transition: border-color 0.2s ease;
}

.widget-price-filter .price-input:focus {
    outline: none;
    border-color: var(--color-primary, #ff6b35);
}

.widget-price-filter .price-filter-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--color-primary, #ff6b35);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-price-filter .price-filter-btn:hover {
    background: var(--color-primary-dark, #e55a2b);
}

/* =============================================================================
   SIDEBAR SPECIFIC STYLES
   ============================================================================= */

/* Blog Sidebar */
.sidebar-blog .widget {
    background: var(--color-gray-50, #f9fafb);
}

/* Shop Sidebar */
.sidebar-shop .widget {
    border: 1px solid var(--color-gray-200, #e5e7eb);
}

.sidebar-shop .widget-title {
    font-size: 1rem;
}

/* Page Sidebar */
.sidebar-page .widget {
    padding: 20px;
}

/* =============================================================================
   FOOTER WIDGETS
   ============================================================================= */
.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.footer-widget-area .widget {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.footer-widget-area .widget-title {
    color: white;
    font-size: 1rem;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.footer-widget-area .widget-title::after {
    background: var(--color-primary, #ff6b35);
}

.footer-widget-area ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-widget-area li {
    margin-bottom: 10px;
}

.footer-widget-area a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.footer-widget-area a:hover {
    color: white;
    padding-left: 5px;
}

/* Footer Newsletter */
.footer-widget-area .widget-newsletter {
    background: rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: 12px;
}

/* =============================================================================
   RESPONSIVE STYLES
   ============================================================================= */
@media (max-width: 1200px) {
    .footer-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .widget {
        padding: 20px;
    }

    .widget-title {
        font-size: 1rem;
    }

    .footer-widgets {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .widget-popular-products .popular-product-item,
    .widget-price-drops .price-drop-item {
        gap: 12px;
    }

    .widget-popular-products .popular-product-image,
    .widget-price-drops .price-drop-image {
        width: 60px;
        height: 60px;
    }

    .widget-price-filter .price-inputs {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .widget {
        padding: 16px;
        border-radius: 12px;
    }

    .widget-popular-products .popular-product-title,
    .widget-price-drops .price-drop-title {
        font-size: 0.875rem;
    }
}

/* =============================================================================
   ANIMATION STATES
   ============================================================================= */
.widget {
    animation: fadeInUp 0.5s ease;
}

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

/* Loading State */
.widget.loading {
    opacity: 0.6;
    pointer-events: none;
}

.widget.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--color-gray-200, #e5e7eb);
    border-top-color: var(--color-primary, #ff6b35);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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