/**
 * DataFirefly SideCart - Styles
 * @author DataFirefly
 */

.dfsc-sidecart {
    --dfsc-primary: #2fb5d2;
    --dfsc-primary-hover: color-mix(in srgb, var(--dfsc-primary) 85%, black);
    --dfsc-bg: #ffffff;
    --dfsc-text: #333333;
    --dfsc-text-light: #666666;
    --dfsc-border: #e5e5e5;
    --dfsc-success-bg: #d4edda;
    --dfsc-success-text: #155724;
    --dfsc-width: 420px;
    --dfsc-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --dfsc-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dfsc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dfsc-transition), visibility var(--dfsc-transition);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

.dfsc-overlay.dfsc-active {
    opacity: 1;
    visibility: visible;
}

.dfsc-sidecart {
    position: fixed;
    top: 0;
    height: 100%;
    width: var(--dfsc-width);
    max-width: 100vw;
    background: var(--dfsc-bg);
    box-shadow: var(--dfsc-shadow);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--dfsc-transition);
}

.dfsc-sidecart.dfsc-right {
    right: 0;
    transform: translateX(100%);
}

.dfsc-sidecart.dfsc-left {
    left: 0;
    transform: translateX(-100%);
}

.dfsc-sidecart.dfsc-active {
    transform: translateX(0);
}

.dfsc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--dfsc-border);
    flex-shrink: 0;
}

.dfsc-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--dfsc-text);
}

.dfsc-icon {
    width: 24px;
    height: 24px;
    color: var(--dfsc-primary);
}

.dfsc-badge {
    background: var(--dfsc-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.dfsc-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: background var(--dfsc-transition);
    color: var(--dfsc-text-light);
}

.dfsc-close:hover {
    background: var(--dfsc-border);
}

.dfsc-close svg {
    width: 20px;
    height: 20px;
}

.dfsc-success {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--dfsc-success-bg);
    color: var(--dfsc-success-text);
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.dfsc-success.dfsc-show {
    display: flex;
    animation: dfsc-slideDown 0.3s ease;
}

.dfsc-success svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

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

.dfsc-products {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.dfsc-products::-webkit-scrollbar {
    width: 6px;
}

.dfsc-products::-webkit-scrollbar-track {
    background: transparent;
}

.dfsc-products::-webkit-scrollbar-thumb {
    background: var(--dfsc-border);
    border-radius: 3px;
}

.dfsc-product {
    display: flex;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid var(--dfsc-border);
    position: relative;
    animation: dfsc-fadeIn 0.3s ease;
}

@keyframes dfsc-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dfsc-product-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

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

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

.dfsc-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dfsc-text);
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.dfsc-product-name:hover {
    color: var(--dfsc-primary);
}

.dfsc-product-attributes {
    font-size: 12px;
    color: var(--dfsc-text-light);
    margin: 0 0 8px;
}

.dfsc-product-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--dfsc-primary);
    margin-bottom: 10px;
}

.dfsc-product-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dfsc-quantity {
    display: flex;
    align-items: center;
    border: 1px solid var(--dfsc-border);
    border-radius: 6px;
    overflow: hidden;
}

.dfsc-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--dfsc-text);
    transition: background var(--dfsc-transition);
    font-size: 16px;
    font-weight: 600;
}

.dfsc-qty-btn:hover {
    background: var(--dfsc-border);
}

.dfsc-qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dfsc-qty-value {
    width: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--dfsc-text);
    border-left: 1px solid var(--dfsc-border);
    border-right: 1px solid var(--dfsc-border);
    padding: 6px 0;
}

.dfsc-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--dfsc-text-light);
    padding: 5px;
    border-radius: 4px;
    transition: color var(--dfsc-transition), background var(--dfsc-transition);
}

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

.dfsc-remove svg {
    width: 18px;
    height: 18px;
}

.dfsc-product-total {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 15px;
    font-weight: 700;
    color: var(--dfsc-text);
}

.dfsc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.dfsc-empty svg {
    width: 80px;
    height: 80px;
    color: var(--dfsc-border);
    margin-bottom: 20px;
}

.dfsc-empty-text {
    font-size: 16px;
    color: var(--dfsc-text-light);
    margin: 0 0 20px;
}

.dfsc-footer {
    padding: 20px;
    border-top: 1px solid var(--dfsc-border);
    background: #fafafa;
    flex-shrink: 0;
}

.dfsc-totals {
    margin-bottom: 20px;
}

.dfsc-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--dfsc-text-light);
}

.dfsc-total-final {
    border-top: 2px solid var(--dfsc-border);
    margin-top: 10px;
    padding-top: 15px;
    font-size: 18px;
    font-weight: 700;
    color: var(--dfsc-text);
}

.dfsc-actions {
    display: flex;
    gap: 10px;
}

.dfsc-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--dfsc-transition);
    cursor: pointer;
    border: none;
}

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

.dfsc-btn-primary:hover {
    background: var(--dfsc-primary-hover);
    color: white;
}

.dfsc-btn-primary svg {
    width: 18px;
    height: 18px;
}

.dfsc-btn-outline {
    background: white;
    color: var(--dfsc-text);
    border: 1px solid var(--dfsc-border);
}

.dfsc-btn-outline:hover {
    background: var(--dfsc-border);
    color: var(--dfsc-text);
}

.dfsc-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.dfsc-loading.dfsc-active {
    display: flex;
}

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

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

@media (max-width: 480px) {
    .dfsc-sidecart {
        --dfsc-width: 100vw;
    }
    
    .dfsc-product {
        gap: 12px;
        padding: 15px;
    }
    
    .dfsc-product-image {
        width: 70px;
        height: 70px;
    }
    
    .dfsc-actions {
        flex-direction: column;
    }
}

.dfsc-subtotal-row.dfsc-hidden,
.dfsc-taxes-row.dfsc-hidden,
.dfsc-shipping-row.dfsc-hidden {
    display: none;
}
