/* =========================================
   Mini Cart Styles
   ========================================= */

/* --- Header Widget --- */
.header-cart {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 15px;
    cursor: pointer;
    padding: 5px;
}

.cart-icon-box {
    width: 40px;
    height: 40px;
    background-color: #E3F2FD; /* Light Blue Background */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: 20px;
    position: relative;
    transition: var(--transition);
}

.header-cart:hover .cart-icon-box {
    background-color: var(--color-primary);
    color: white;
}

/* Mobile Badge on Icon */
.cart-mobile-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #F44336;
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

.cart-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.cart-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-details {
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 700;
    font-family: var(--font-en);
    display: flex;
    align-items: center;
    gap: 5px;
}

.cart-details .fa-chevron-down {
    font-size: 10px;
    color: #999;
    margin-left: 3px;
    transition: transform 0.3s;
}

.header-cart.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* --- Dropdown Container --- */
.mini-cart-dropdown {
    position: absolute;
    top: calc(100% + 15px); /* Offset from header */
    right: -10px; /* Align slightly right */
    width: 360px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-top: 3px solid var(--color-primary);
    z-index: 1100;
    display: none; /* Toggled by JS */
    flex-direction: column;
    animation: slideDownFade 0.3s ease-out;
    cursor: default; /* Reset cursor inside dropdown */
}

/* Force display when active class is present */
.mini-cart-dropdown.show {
    display: flex !important;
}

/* Triangle Arrow */
.mini-cart-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 35px; /* Align with icon area */
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--color-primary);
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Cart Items List --- */
.mini-cart-items {
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.mini-cart-items::-webkit-scrollbar {
    width: 6px;
}
.mini-cart-items::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 3px;
}

.mini-cart-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.2s;
    gap: 15px;
}

.mini-cart-item:hover {
    background-color: #fafafa;
}

.item-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    background-color: #eee;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
    min-width: 0; /* Text truncate fix */
}

.item-category {
    font-size: 10px;
    color: var(--color-primary);
    font-weight: 700;
    text-transform: uppercase;
    margin: 0 0 3px;
    display: block;
}

.item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-secondary);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.item-quantity {
    font-size: 12px;
    color: var(--color-text-light);
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-secondary);
    margin-left: auto;
    font-family: var(--font-en);
}

.item-remove {
    background: none;
    border: none;
    color: #ff5252;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: 5px;
}

.item-remove:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Empty State */
.mini-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-light);
}

.mini-cart-empty i {
    font-size: 40px;
    margin-bottom: 10px;
    color: #eee;
    display: block;
}

/* --- Summary & Actions --- */
.mini-cart-summary {
    padding: 20px;
    background-color: #fcfcfc;
    border-top: 1px solid #eee;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--color-text-light);
}

.summary-row span:last-child {
    font-weight: 600;
    color: var(--color-secondary);
    font-family: var(--font-en);
}

.summary-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 12px 0;
    border: none;
}

.summary-row.total {
    margin-bottom: 0;
    align-items: center;
}

.summary-row.total span:first-child {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-secondary);
}

.summary-row.total span:last-child {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-primary);
}

.mini-cart-actions {
    padding: 0 20px 20px;
    background-color: #fcfcfc;
    display: flex;
    gap: 10px;
}

.btn-mini {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-view-cart {
    background-color: var(--color-accent-orange);
    color: white;
}

.btn-view-cart:hover {
    background-color: #F57C00;
    color: white;
}

.btn-checkout-mini {
    background-color: var(--color-primary);
    color: white;
}

.btn-checkout-mini:hover {
    background-color: var(--color-primary-dark);
    color: white;
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .cart-info {
        display: none; /* Hide label on smaller screens */
    }
    .cart-mobile-badge {
        display: flex;
    }
    .header-cart {
        margin-left: 10px;
    }
}

@media (max-width: 576px) {
    .mini-cart-dropdown {
        width: 300px;
        right: -60px; /* Shift left slightly */
    }
    
    .mini-cart-dropdown::before {
        right: 85px; /* Adjust arrow */
    }
}