/* Variables */
:root {
    --csc-primary: #2a0d0d;
    --csc-secondary: #c41e3a;
    --csc-success: #78c257;
    --csc-danger: #c41e3a;
    --csc-light: #f2f2f2;
    --csc-border: #eee;
    --csc-text: #333;
    --csc-text-dark: #111;
    --csc-shadow: 0 2px 20px rgba(0,0,0,0.1);
    --csc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Overlay */
.csc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: var(--csc-transition);
}

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

/* Sidebar - 320px როგორც აღწერაში */
.csc-sidebar {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100%;
    background: #fff;
    z-index: 999999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--csc-shadow);
    border-radius: 10px 0 0 10px;
    font-family: 'Noto Sans Georgian', sans-serif;
}

.csc-sidebar.active {
    right: 0;
}

/* Loader */
.csc-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}

.csc-sidebar.loading .csc-loader {
    display: flex;
}

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

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

/* =============== 1. Header Section =============== */
.csc-header {
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--csc-border) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #fff !important;
    flex-shrink: 0 !important;
}

.csc-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.csc-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--csc-text-dark);
    display: flex;
    align-items: center;
    gap: 0;
}

.csc-clear-all {
    background: none !important;
    border: none !important;
    color: #999 !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    transition: color 0.2s !important;
    font-size: 12px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.csc-clear-all svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    visibility: visible !important;
}

.csc-clear-all span {
    font-size: 12px !important;
    display: inline !important;
    visibility: visible !important;
}

.csc-clear-all:hover {
    color: var(--csc-danger) !important;
}

.csc-title svg {
    display: none; /* აღწერაში svg არ იყო */
}

.csc-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    font-size: 24px;
    line-height: 1;
}

.csc-close:hover {
    color: var(--csc-text-dark);
}

.csc-close svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

/* =============== 2. Items Container =============== */
.csc-items {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.csc-items::-webkit-scrollbar {
    width: 6px;
}

.csc-items::-webkit-scrollbar-track {
    background: transparent;
}

.csc-items::-webkit-scrollbar-thumb {
    background: var(--csc-border);
    border-radius: 10px;
}

/* Empty Cart */
.csc-empty {
    text-align: center;
    padding: 60px 20px;
}

.csc-empty svg {
    opacity: 0.15;
    margin-bottom: 15px;
}

.csc-empty p {
    color: #999;
    margin-bottom: 20px;
    font-size: 15px;
}

.csc-continue-shopping {
    display: inline-block;
    padding: 12px 24px;
    background:#fff;
    border:1px solid #000 !important;
    color: #000;
    border: none;
    text-decoration: none;
    transition: var(--csc-transition);
    font-weight: 600;
    font-size: 14px;
}

.csc-continue-shopping:hover {
    background:#000;
    color:#fff;
}

/* =============== 3. Product Items (40x40px) =============== */
.csc-items-wrapper {
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

.csc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--csc-light);
    position: relative;
}

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

/* პროდუქტის სურათი - 40x40px */
.csc-item-image {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 4px;
    background: var(--csc-light);
}

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

/* პროდუქტის დეტალები */
.csc-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.csc-item-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 500;
    color: var(--csc-text-dark);
}

.csc-item-title a {
    color: var(--csc-text-dark);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.csc-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.csc-item-price {
    font-weight: 500;
    color: var(--csc-text);
    font-size: 13px;
    white-space: nowrap;
}

.csc-item-separator {
    color: #999;
    font-size: 12px;
}

/* რაოდენობის ბლოკი − 1 + */
.csc-quantity {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid var(--csc-border) !important;
    border-radius: 4px !important;
    overflow: visible !important;
    background: #fff !important;
}

.csc-qty-minus,
.csc-qty-plus {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
    font-weight: 400 !important;
    color: var(--csc-text) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    padding: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.csc-qty-minus:hover,
.csc-qty-plus:hover {
    background: var(--csc-light) !important;
}

.csc-qty-input {
    width: 32px !important;
    height: 28px !important;
    border: none !important;
    border-left: 1px solid var(--csc-border) !important;
    border-right: 1px solid var(--csc-border) !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--csc-text-dark) !important;
    background: #fff !important;
    -moz-appearance: textfield !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 28px !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.csc-qty-input::-webkit-outer-spin-button,
.csc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ფასი - მარჯვნივ, bold */
.csc-item-subtotal {
    position: absolute;
    top: 10px;
    right: 0;
    font-weight: 600;
    color: var(--csc-text-dark);
    font-size: 14px;
}

/* წაშლის ღილაკი - პატარა X */
.csc-item-remove {
    position: absolute;
    top: 10px;
    right: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    display: none; /* დავმალოთ, თუ დიზაინში არ გჭირდება */
}

.csc-item:hover .csc-item-remove {
    opacity: 1;
}

.csc-item-remove:hover {
    color: var(--csc-danger);
}

/* =============== 4. Footer Section =============== */
.csc-footer {
    border-top: 1px solid var(--csc-border);
    padding: 16px 20px 20px;
    background: #fff;
    flex-shrink: 0;
}

/* Progress Bar - უფასო მიტანა */
.csc-progress-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.csc-progress-title {
    font-size: 13px;
    color: #444;
    margin-bottom: 6px;
    font-weight: 500;
}

.csc-progress {
    width: 100%;
    height: 8px;
    background: var(--csc-border);
    border-radius: 20px;
    overflow: hidden;
}

.csc-progress-bar {
    height: 8px;
    background: var(--csc-success);
    width: 70%; /* დინამიური იქნება JS-ით */
    border-radius: 20px;
    transition: width 0.3s ease;
}

/* =============== 5. Totals Section =============== */
.csc-totals {
    margin-bottom: 15px;
    border-top: 1px solid var(--csc-border);
    padding-top: 10px;
}

.csc-subtotal,
.csc-shipping,
.csc-discount,
.csc-total {
    display: flex;  
    justify-content: space-between;
    margin: 6px 0;
    font-size: 14px;
    color: var(--csc-text);
}

.csc-discount {
    color: var(--csc-danger);
}

.csc-total {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    padding-top: 8px;
    border-top: 1px solid var(--csc-border);
    margin-top: 8px;
}

/* =============== 6. Buttons Section =============== */
.csc-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.csc-btn {
    width: 100%;
    padding: 12px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    transition: var(--csc-transition);
    font-size: 15px;
    display: inline-block;
    cursor: pointer;
    border: none;
}

/* კალათის ნახვა - თეთრი ფონი, წითელი ტექსტი */
.csc-btn-cart {
    background: #fff;
    color: var(--csc-secondary);
    border: 1px solid var(--csc-secondary);
}

.csc-btn-cart:hover {
    background: var(--csc-secondary);
    color: #fff;
}

/* გადახდა - მუქი ყავისფერი */
.csc-btn-checkout {
    background:#fff;
    border:1px solid #000 !important;
    color: #000;
    border: none;
}

.csc-btn-checkout:hover {
    background:#000;
    color:#fff;
}

/* =============== Header Cart Icon (Woodmart Style) =============== */
.csc-custom-cart {
    display: inline-flex !important;
    align-items: center;
}

.csc-custom-cart .csc-header-trigger {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

.csc-custom-cart .csc-header-trigger:hover {
    opacity: 0.7;
}

.csc-custom-cart .wd-tools-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.csc-custom-cart .wd-tools-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.csc-custom-cart .wd-cart-number {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--csc-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1.2;
    white-space: nowrap;
    min-width: 20px;
    text-align: center;
}

.csc-custom-cart .wd-cart-number span {
    font-size: 9px;
    font-weight: 400;
    margin-left: 2px;
}

.csc-custom-cart .wd-tools-text {
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.csc-custom-cart .wd-cart-subtotal {
    font-weight: 600;
    color: inherit;
}

/* Woodmart-ის original cart-ის დამალვა */
.wd-header-cart.cart-widget-opener:not(.csc-custom-cart) {
    display: none !important;
}

/* Body when cart is open */
body.csc-open {
    overflow: hidden;
}

/* =============== Responsive =============== */
@media (max-width: 768px) {
    .csc-sidebar {
        width: 100%;
        right: -100%;
        border-radius: 0;
    }
    
    .csc-custom-cart .wd-tools-text {
        display: none;
    }
    
    .csc-custom-cart .wd-tools-icon {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .csc-item {
        padding: 8px 0;
    }
    
    .csc-item-image {
        width: 35px;
        height: 35px;
    }
    
    .csc-item-title {
        font-size: 13px;
    }
    
    .csc-buttons {
        gap: 8px;
    }
}

/* Animations */
.csc-item {
    animation: csc-fadeIn 0.3s ease;
}

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

/* Counter bounce animation */
.csc-bounce {
    animation: csc-count-bounce 0.5s ease;
}

@keyframes csc-count-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ეს უზრუნველყოფს, რომ თქვენი SVG გამოიყურებოდეს ისე, როგორც ადრე */
.csc-custom-cart .csc-tools-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* სხვა საჭირო სტილები */
}