/*
 * Shared components for blog, shop, and events templates.
 */

.sidebar-widget {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--dch-shadow-card);
    border: 1px solid rgba(15, 23, 42, 0.04);
    margin-bottom: 24px;
}

.sidebar-widget__title {
    margin: 0 0 18px;
    font-size: var(--text-lg);
    font-weight: var(--dch-font-bold);
    color: var(--dch-primary);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--dch-border);
}

.sidebar-search__input-wrapper {
    position: relative;
}

.sidebar-search__input,
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--dch-border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.sidebar-search__input:focus,
.form-input:focus {
    border-color: var(--dch-primary);
    box-shadow: 0 0 0 2px rgba(38, 57, 151, 0.1);
}

.sidebar-categories {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-categories a {
    display: flex;
    align-items: center;
    color: #475569;
    padding: 8px 0;
    font-size: var(--text-sm);
    font-weight: var(--dch-font-normal);
    transition: color 0.2s ease;
}

.sidebar-categories a i {
    margin-right: 8px;
    color: var(--dch-accent);
    font-size: 0.7rem;
    transition: color 0.2s ease;
}

.sidebar-categories a span {
    margin-left: auto;
    background: #eef2f7;
    color: #64748b;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: var(--dch-font-bold);
}

.sidebar-categories a:hover {
    color: var(--dch-primary);
}

.sidebar-categories a:hover i {
    color: var(--dch-primary);
}

.sidebar-posts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-post,
.sidebar-event-card {
    display: flex;
    gap: 14px;
}

.sidebar-post__image,
.sidebar-event-img {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.sidebar-post__image img,
.sidebar-event-img img,
.sidebar-event-img > img {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    object-fit: cover;
    display: block;
}

.sidebar-post__content h4,
.sidebar-event-info h4 {
    margin: 0 0 6px;
    font-size: var(--text-sm);
    line-height: var(--dch-leading-snug);
    color: var(--dch-primary);
    font-weight: var(--dch-font-bold);
    transition: color 0.2s ease;
}

.sidebar-post:hover .sidebar-post__content h4,
.sidebar-event-card:hover .sidebar-event-info h4 {
    color: var(--dch-accent);
}

.sidebar-post__content span,
.sidebar-event-date {
    color: var(--dch-text-muted);
    font-size: 0.75rem;
}

.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    background: #ffffff;
    color: var(--dch-primary);
    font-weight: var(--dch-font-medium);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.pagination__item.current,
.pagination__item:hover {
    background: var(--dch-primary);
    color: #ffffff;
}

.share-buttons {
    display: flex;
    gap: 12px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: var(--text-lg);
    transition: all 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
    color: #ffffff;
}

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

/* â”€â”€ Product Badges â”€â”€ */
.dch-badge {
    position: absolute;
    z-index: 10;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.dch-badge i {
    margin-inline-end: 4px;
}

.dch-badge--offer {
    top: 15px;
    right: -35px;
    padding: 7px 40px;
    background: linear-gradient(45deg, #bf2527, #ef4444);
    color: #fff;
    transform: rotate(45deg);
    border: 1px solid rgba(255,255,255,0.2);
}

.dch-badge--coming_soon {
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #fff;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.3);
}

.dch-badge--new {
    top: 12px;
    left: 12px;
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #10b981, #34d399);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    border: 2px solid #fff;
}

.dch-badge--new i {
    font-size: 9px;
    margin-inline-end: 0;
}

.dch-badge--best_seller {
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #263997, #4338ca);
    color: #fff;
    border-radius: 6px;
    border-right: 3px solid #fbbf24; /* Golden accent */
}

/* â”€â”€ Single Product Badge Wrapper â”€â”€ */
.dch-single-badge-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    pointer-events: none;
}
.dch-single-badge-wrapper .dch-badge {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    display: inline-block;
    margin: 12px;
}


/* â”€â”€ Modal System â”€â”€ */
.dch-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dch-modal.active {
    display: flex;
}

.dch-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
}

.dch-modal__container {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.dch-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: all 0.2s ease;
}

.dch-modal__close:hover {
    background: var(--dch-accent);
    color: #fff;
}

.dch-modal__content {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
}

.dch-modal__loader {
    display: none;
    justify-content: center;
    padding: 60px;
}

.dch-modal.loading .dch-modal__loader {
    display: flex;
}

.dch-modal.loading #quick-view-target {
    display: none;
}

.dch-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f1f5f9;
    border-top-color: var(--dch-primary);
    border-radius: 50%;
    animation: dch-spin 0.8s linear infinite;
}

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