/**
 * Premium Dropcart Styling
 * 
 * Stunning, modern, premium mini-cart dropdown
 * Scoped to .dropcart only - does not affect cart page
 * 
 * This stylesheet enhances the existing dropcart markup
 * with premium design, better spacing, and SimpleBar scrolling
 */

/* Override any conflicting styles from style.css */
.dropcart {
    /* Ensure our styles take precedence */
    position: relative;
}

/* ============================================
   CONTAINER & SCROLLING
   ============================================ */

.dropcart__products-list {
    /* SimpleBar wrapper */
    position: relative;
    max-height: 360px;
    padding: 16px 0 !important; /* Override style.css padding */
    margin: 0;
}

@media (max-width: 767px) {
    .dropcart__products-list {
        max-height: 300px;
    }
}

/* SimpleBar scrollbar styling */
.dropcart__products-list .simplebar-scrollbar:before {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.dropcart__products-list .simplebar-scrollbar:hover:before {
    opacity: 1;
}

.dropcart__products-list .simplebar-track.simplebar-vertical {
    width: 6px;
    right: 8px;
}

.dropcart__products-list .simplebar-content-wrapper {
    padding-right: 12px;
    padding-left: 12px;
}

.dropcart__products-list .simplebar-content {
    padding: 0 20px;
}

/* ============================================
   PRODUCT ITEM CARD ROW
   ============================================ */

.dropcart__product {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    position: relative;
    transition: background-color 0.2s ease;
    border-radius: 8px;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
}

.dropcart__product:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dropcart__product + .dropcart__product {
    margin-top: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 16px;
}

/* ============================================
   PRODUCT IMAGE
   ============================================ */

.dropcart__product-image {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
}

.dropcart__product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dropcart__product-image a {
    display: block;
    width: 100%;
    height: 100%;
    transition: opacity 0.2s;
}

.dropcart__product-image a:hover {
    opacity: 0.9;
}

/* ============================================
   PRODUCT INFO
   ============================================ */

.dropcart__product-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Product Name */
.dropcart__product-name {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
}

.dropcart__product-name a {
    color: inherit;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.dropcart__product-name a:hover {
    color: rgba(17, 112, 118, 1);
}

/* Variation attributes (meta) */
.dropcart__product-options {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #6c757d;
}

.dropcart__product-options li {
    margin: 0;
    padding: 0;
}

.dropcart__product-options li + li {
    margin-top: 2px;
}

/* Product Meta (Quantity + Price) */
.dropcart__product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* Quantity Pill */
.dropcart__product-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    background-color: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 28px;
    text-align: center;
}

/* Price */
.dropcart__product-price {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.dropcart__product-price .woocommerce-Price-amount {
    font-weight: 600;
}

/* Remove "x" text from meta */
.dropcart__product-meta {
    font-size: 0; /* Hide the "x" text */
}

.dropcart__product-meta > * {
    font-size: 12px; /* Restore font size for children */
}

.dropcart__product-meta > .dropcart__product-price {
    font-size: 15px;
}

/* ============================================
   REMOVE BUTTON
   ============================================ */

.dropcart__product-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    position: relative;
    top: -2px; /* Align with product name */
}

.dropcart__product-remove:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: scale(1.1);
}

.dropcart__product-remove:active {
    transform: scale(0.95);
}

.dropcart__product-remove svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.dropcart__product-remove:hover svg {
    transform: rotate(90deg);
}

/* Remove button classes if using theme button classes */
.dropcart__product-remove.btn {
    background: transparent;
    border: none;
    padding: 0;
}

.dropcart__product-remove.btn.btn-light {
    color: #6c757d;
}

.dropcart__product-remove.btn.btn-light:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: transparent;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.dropcart__empty {
    text-align: center;
    padding: 48px 24px;
    color: #6c757d;
}

.dropcart__empty p {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.5;
}

.dropcart__empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.4;
    fill: currentColor;
}

.dropcart__empty-cta {
    margin-top: 16px;
}

.dropcart__empty-cta .btn {
    min-width: 140px;
}

/* ============================================
   TOTALS SECTION
   ============================================ */

.dropcart__totals {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 20px;
    background-color: #f8f9fa;
    margin: 0;
}

.dropcart__totals table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dropcart__totals tr {
    border: none;
}

.dropcart__totals th {
    text-align: left;
    font-weight: 500;
    color: #6c757d;
    padding: 6px 0;
    font-size: 14px;
}

.dropcart__totals td {
    text-align: right;
    font-weight: 600;
    color: #2c3e50;
    padding: 6px 0;
    font-size: 14px;
}

.dropcart__totals tr:last-child th,
.dropcart__totals tr:last-child td {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 12px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 700;
    color: rgba(17, 112, 118, 1);
}

.dropcart__totals tr:last-child th {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

/* ============================================
   BUTTONS SECTION
   ============================================ */

.dropcart__buttons {
    display: flex;
    gap: 12px;
    padding: 20px;
    margin: 0;
    background-color: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.dropcart__buttons > * {
    flex: 1;
    margin: 0;
}

.dropcart__buttons .btn {
    width: 100%;
    justify-content: center;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropcart__buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropcart__buttons .btn:active {
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    .dropcart__product-image {
        width: 56px;
        height: 56px;
    }
    
    .dropcart__product {
        gap: 10px;
    }
    
    .dropcart__product-name {
        font-size: 13px;
    }
    
    .dropcart__product-price {
        font-size: 14px;
    }
    
    .dropcart__product-remove {
        width: 28px;
        height: 28px;
    }
    
    .dropcart__totals,
    .dropcart__buttons {
        padding: 16px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes dropcart-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropcart__product {
    animation: dropcart-fade-in 0.3s ease backwards;
}

.dropcart__product:nth-child(1) {
    animation-delay: 0.05s;
}

.dropcart__product:nth-child(2) {
    animation-delay: 0.1s;
}

.dropcart__product:nth-child(3) {
    animation-delay: 0.15s;
}

.dropcart__product:nth-child(n+4) {
    animation-delay: 0.2s;
}
