/* Dima Shop Widgets Styles */

/* Common Widget Styles */
.dima-widget-search,
.dima-mini-cart-widget,
.dima-categories-widget,
.dima-products-widget,
.dima-flash-sale-widget,
.dima-rewards-widget,
.dima-wishlist-widget {
    font-family: 'Vazir', Tahoma, sans-serif;
    direction: rtl;
}

.widget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 15px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
    color: #1a1a2e;
}

.widget-title .dashicons {
    color: #667eea;
    font-size: 20px;
}

.cart-count-badge,
.wishlist-count-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    margin-right: auto;
}

/* 1. Search Widget */
.dima-search-widget {
    position: relative;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.dima-widget-search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.dima-widget-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-loader {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.dima-search-category {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}

.dima-widget-search-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 5px;
    display: none;
}

.dima-widget-search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background: #f9fafb;
}

.search-result-item img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.search-result-price {
    color: #667eea;
    font-weight: 700;
    font-size: 13px;
}

.popular-searches {
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
}

.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.popular-tag {
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s;
}

.popular-tag:hover {
    background: #667eea;
    color: white;
}

/* 2. Mini Cart Widget */
.mini-cart-empty {
    text-align: center;
    padding: 20px 10px;
    color: #6b7280;
}

.mini-cart-empty p {
    margin: 10px 0 15px;
}

.mini-cart-items {
    margin-bottom: 15px;
}

.mini-cart-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.mini-cart-item:last-child {
    border-bottom: none;
}

.mini-cart-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.mini-cart-item .item-info {
    flex: 1;
}

.mini-cart-item .item-info a {
    font-weight: 600;
    font-size: 13px;
    color: #1a1a2e;
    text-decoration: none;
    display: block;
    margin-bottom: 5px;
}

.mini-cart-item .item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
}

.mini-cart-item .price {
    color: #667eea;
    font-weight: 700;
}

.more-items {
    text-align: center;
    color: #6b7280;
    font-size: 12px;
    margin: 10px 0;
}

.mini-cart-footer {
    border-top: 2px solid #f0f0f0;
    padding-top: 15px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.total-amount {
    color: #667eea;
    font-size: 16px;
}

.cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-view-cart,
.btn-checkout {
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-view-cart {
    background: #f3f4f6;
    color: #374151;
}

.btn-view-cart:hover {
    background: #e5e7eb;
}

.btn-checkout {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 3. Categories Widget */
.dima-categories-widget {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dima-categories-widget .cat-item {
    margin-bottom: 8px;
}

.cat-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 10px;
    text-decoration: none;
    color: #1a1a2e;
    transition: all 0.3s;
}

.cat-link:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateX(-5px);
}

.cat-image {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid;
    flex-shrink: 0;
}

.cat-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.cat-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.cat-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cat-name {
    font-weight: 600;
    font-size: 14px;
}

.cat-count {
    color: #9ca3af;
    font-size: 12px;
}

.cat-arrow {
    color: #9ca3af;
    transition: transform 0.3s;
}

.cat-link:hover .cat-arrow {
    transform: translateX(-5px);
    color: #667eea;
}

.cat-children {
    list-style: none;
    padding: 5px 0 5px 20px;
    margin: 0;
}

.cat-children li {
    padding: 4px 0;
}

.cat-children a {
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.cat-children a:hover {
    color: #667eea;
}

/* 4-8. Products Widgets (Recent, Best Selling, Most Viewed, Featured) */
.dima-products-widget {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.product-item:last-child {
    border-bottom: none;
}

.product-thumb {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.product-thumb:hover {
    transform: scale(1.05);
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.product-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
    text-decoration: none;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-title:hover {
    color: #667eea;
}

.product-price {
    color: #667eea;
    font-weight: 700;
    font-size: 14px;
}

.product-price small {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
}

.mini-add-to-cart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin-top: 5px;
}

.mini-add-to-cart:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Rank badge for best selling / most viewed */
.dima-products-widget.best_selling .product-item:nth-child(1) .product-thumb::before,
.dima-products-widget.most_viewed .product-item:nth-child(1) .product-thumb::before {
    content: '🥇';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 20px;
}

.dima-products-widget.best_selling .product-item:nth-child(2) .product-thumb::before,
.dima-products-widget.most_viewed .product-item:nth-child(2) .product-thumb::before {
    content: '🥈';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 20px;
}

.dima-products-widget.best_selling .product-item:nth-child(3) .product-thumb::before,
.dima-products-widget.most_viewed .product-item:nth-child(3) .product-thumb::before {
    content: '🥉';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 20px;
}

.dima-products-widget .product-thumb {
    position: relative;
}

/* 7. Flash Sale Widget */
.dima-flash-sale-widget {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.flash-item {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #fecaca;
    transition: all 0.3s;
}

.flash-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.15);
}

.flash-link {
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.flash-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.flash-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.discount-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ef4444;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.flash-info {
    flex: 1;
    min-width: 0;
}

.flash-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flash-prices {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.original-price {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 12px;
}

.sale-price {
    color: #ef4444;
    font-weight: 700;
    font-size: 14px;
}

.flash-timer {
    margin-bottom: 8px;
}

.timer-label {
    font-size: 11px;
    color: #6b7280;
    display: block;
    margin-bottom: 4px;
}

.timer-display {
    display: flex;
    gap: 3px;
    align-items: center;
}

.timer-unit {
    background: #1a1a2e;
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    min-width: 25px;
    text-align: center;
    font-family: monospace;
}

.timer-sep {
    color: #1a1a2e;
    font-weight: 700;
}

.flash-progress {
    position: relative;
    height: 6px;
    background: #fecaca;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.flash-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f97316 100%);
    transition: width 0.3s;
}

.progress-text {
    font-size: 10px;
    color: #6b7280;
    display: block;
    margin-top: 3px;
}

/* 9. Rewards Widget */
.dima-rewards-widget {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #fbbf24;
}

.rewards-user-info {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #fbbf24;
}

.user-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 3px;
}

.user-points {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.points-value {
    font-size: 20px;
    font-weight: 900;
    color: #92400e;
}

.points-label {
    font-size: 12px;
    color: #92400e;
}

.rewards-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.6);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #92400e;
}

.stat-label {
    font-size: 11px;
    color: #78350f;
}

.rewards-progress {
    margin-bottom: 15px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
    color: #78350f;
}

.progress-bar-wrapper {
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-wrapper .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
    transition: width 0.5s;
}

.redeem-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.3s;
    font-size: 14px;
}

.redeem-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.view-all-rewards {
    display: block;
    text-align: center;
    color: #92400e;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.view-all-rewards:hover {
    color: #78350f;
}

/* 10. Wishlist Widget */
.dima-wishlist-empty {
    text-align: center;
    padding: 20px 10px;
    color: #6b7280;
}

.dima-wishlist-widget {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wishlist-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.wishlist-item:last-child {
    border-bottom: none;
}

.wishlist-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.wishlist-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wishlist-info {
    flex: 1;
    min-width: 0;
}

.wishlist-title {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #1a1a2e;
    text-decoration: none;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wishlist-title:hover {
    color: #667eea;
}

.wishlist-price {
    color: #667eea;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
}

.wishlist-price small {
    font-size: 10px;
    color: #9ca3af;
    font-weight: 400;
}

.wishlist-actions {
    display: flex;
    gap: 5px;
}

.wishlist-actions button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wishlist-actions .mini-add-to-cart {
    background: #667eea;
    color: white;
    margin: 0;
    width: 28px;
    height: 28px;
}

.wishlist-actions .remove-from-wishlist {
    background: #fee2e2;
    color: #ef4444;
}

.wishlist-actions button:hover {
    transform: scale(1.1);
}

.wishlist-actions .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.view-all-wishlist {
    display: block;
    text-align: center;
    margin-top: 12px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
}

.view-all-wishlist:hover {
    background: #667eea;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .flash-link {
        flex-direction: column;
    }
    
    .flash-image {
        width: 100%;
        height: 120px;
    }
}