/**
 * Hestia Cart - Frontend Styles
 */

/* ============================================
   Variables
   ============================================ */
:root {
    --hc-primary: #243F2C;
    --hc-accent: #B39590;
    --hc-accent-light: #E1BDB8;
    --hc-blush: #FDF8F6;
    --hc-text: #333333;
    --hc-text-light: #666666;
    --hc-border: #e5e5e5;
    --hc-white: #ffffff;
    --hc-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --hc-radius: 12px;
    --hc-radius-sm: 8px;
    --hc-transition: 0.3s ease;
}

/* ============================================
   Backdrop
   ============================================ */
.hc-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--hc-transition), visibility var(--hc-transition);
}

.hc-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Drawer
   ============================================ */
.hc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: var(--hc-white);
    box-shadow: var(--hc-shadow);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--hc-transition);
}

.hc-drawer.open {
    transform: translateX(0);
}

body.hc-drawer-open {
    overflow: hidden;
}

/* Drawer Header */
.hc-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--hc-border);
    flex-shrink: 0;
}

.hc-drawer-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.hc-drawer-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0;
    font-family: inherit;
}

.hc-item-count {
    background: var(--hc-blush);
    color: var(--hc-primary);
    font-size: 13px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
}

.hc-close-btn {
    width: 48px;
    height: 48px;
    border: 2px solid var(--hc-border);
    background: var(--hc-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--hc-transition);
    flex-shrink: 0;
}

.hc-close-btn:hover {
    background: var(--hc-blush);
    border-color: var(--hc-accent);
}

.hc-close-btn svg {
    width: 28px;
    height: 28px;
    color: var(--hc-text);
    stroke-width: 2.5;
}

/* Drawer Content */
.hc-drawer-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Scrollable Body */
.hc-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Loading State */
.hc-drawer.loading .hc-drawer-content,
.hc-cart-page.loading,
.hc-addons-widget.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================
   Empty Cart
   ============================================ */
.hc-empty-cart {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
}

.hc-empty-icon {
    width: 100px;
    height: 100px;
    background: var(--hc-blush);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.hc-empty-icon svg {
    width: 45px;
    height: 45px;
    color: var(--hc-accent);
}

.hc-empty-cart h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 8px 0;
}

.hc-empty-cart p {
    font-size: 14px;
    color: var(--hc-text-light);
    margin: 0 0 24px 0;
}

/* ============================================
   Cart Items
   ============================================ */
.hc-items-section {
    margin-bottom: 16px;
}

.hc-cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--hc-white);
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    margin-bottom: 10px;
    transition: opacity var(--hc-transition), transform var(--hc-transition);
}

.hc-cart-item:last-child {
    margin-bottom: 0;
}

.hc-cart-item:hover {
    border-color: var(--hc-accent-light);
}

.hc-cart-item.removing {
    opacity: 0;
    transform: translateX(20px);
}

.hc-item-image {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--hc-blush);
    border: 1px solid var(--hc-border);
}

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

.hc-item-details {
    flex: 1;
    min-width: 0;
}

.hc-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.hc-item-variation {
    font-size: 11px;
    color: var(--hc-text-light);
    margin: 0 0 4px 0;
}

.hc-item-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 8px 0;
}

/* Quantity Controls */
.hc-quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--hc-border);
    border-radius: 25px;
    padding: 4px;
    background: var(--hc-white);
}

.hc-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--hc-blush);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--hc-transition);
    padding: 0;
    color: var(--hc-primary);
    font-size: 16px;
    font-weight: 600;
}

.hc-qty-btn:hover {
    background: var(--hc-accent);
    color: var(--hc-white);
}

.hc-qty-btn svg {
    width: 14px;
    height: 14px;
}

.hc-qty-value {
    font-size: 14px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
    color: var(--hc-text);
}

/* Remove Button */
.hc-remove-item {
    align-self: flex-start;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hc-text-light);
    transition: color var(--hc-transition);
    padding: 0;
}

.hc-remove-item:hover {
    color: #c00;
}

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

/* ============================================
   Drawer Footer
   ============================================ */
.hc-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--hc-border);
    background: var(--hc-white);
    flex-shrink: 0;
}

.hc-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--hc-border);
}

/* ============================================
   Add-ons
   ============================================ */
.hc-addons-section {
    background: var(--hc-white);
    padding: 14px;
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    margin-bottom: 12px;
}

.hc-addons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.hc-addon-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid var(--hc-border);
    background: var(--hc-white);
    border-radius: var(--hc-radius-sm);
    cursor: pointer;
    transition: all var(--hc-transition);
    text-align: left;
}

.hc-addon-btn:hover {
    background: var(--hc-accent);
    border-color: var(--hc-accent);
    color: var(--hc-white);
}

.hc-addon-btn:hover .hc-addon-name,
.hc-addon-btn:hover .hc-addon-price {
    color: var(--hc-white);
}

.hc-addon-btn.selected {
    border-color: var(--hc-primary);
    background: var(--hc-blush);
}

.hc-addon-btn.selected:hover {
    background: var(--hc-primary);
    border-color: var(--hc-primary);
}

.hc-addon-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.hc-addon-info {
    flex: 1;
    min-width: 0;
}

.hc-addon-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--hc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hc-addon-price {
    display: block;
    font-size: 12px;
    color: var(--hc-text-light);
}

.hc-addons-total {
    font-size: 12px;
    color: var(--hc-text-light);
    text-align: right;
    margin: 12px 0 0 0;
}

/* ============================================
   Gift Section
   ============================================ */
.hc-gift-section {
    background: var(--hc-white);
    padding: 14px;
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    margin-bottom: 0;
}

.hc-gift-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.hc-gift-toggle input {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    accent-color: var(--hc-primary);
}

.hc-gift-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--hc-text);
}

.hc-gift-icon {
    font-size: 18px;
}

.hc-gift-note-wrapper {
    margin-top: 16px;
}

.hc-gift-note-label {
    display: block;
    font-size: 12px;
    color: var(--hc-text-light);
    margin-bottom: 8px;
}

.hc-gift-note-label small {
    opacity: 0.8;
}

.hc-gift-note-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    font-family: inherit !important;
    font-size: 14px !important;
    font-style: normal !important;
    line-height: 1.5;
    resize: none;
    transition: border-color var(--hc-transition);
}

.hc-gift-note-textarea::placeholder {
    font-family: inherit !important;
    font-style: normal !important;
    color: var(--hc-text-light);
}

.hc-gift-note-textarea:focus {
    outline: none;
    border-color: var(--hc-primary);
}

.hc-gift-note-counter {
    font-size: 11px;
    color: var(--hc-text-light);
    text-align: right;
    margin: 6px 0 0 0;
}

/* ============================================
   Totals
   ============================================ */
.hc-totals {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--hc-blush);
    border-radius: var(--hc-radius-sm);
}

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

.hc-addons-total-row {
    color: var(--hc-accent);
}

.hc-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--hc-border);
}

.hc-subtotal-row span:first-child {
    font-size: 14px;
    font-weight: 600;
    color: var(--hc-text);
}

.hc-subtotal-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--hc-text);
}

.hc-shipping-note {
    font-size: 11px;
    color: var(--hc-text-light);
    margin: 6px 0 0 0;
}

/* ============================================
   Buttons
   ============================================ */
.hc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: var(--hc-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--hc-transition);
    border: none;
    width: 100%;
    text-align: center;
}

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

.hc-btn-primary:hover {
    background: #1a2e20;
    color: var(--hc-white);
}

.hc-btn-secondary {
    background: transparent;
    color: var(--hc-text);
    border: 1px solid var(--hc-border);
}

.hc-btn-secondary:hover {
    border-color: var(--hc-primary);
    color: var(--hc-primary);
}

.hc-checkout-btn {
    margin-bottom: 8px;
}

.hc-btn-large {
    padding: 18px 24px;
    font-size: 16px;
}

/* ============================================
   Cart Page
   ============================================ */
.hc-cart-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.hc-cart-empty {
    text-align: center;
    padding: 80px 20px;
}

.hc-cart-empty .hc-empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
}

.hc-cart-empty .hc-empty-icon svg {
    width: 55px;
    height: 55px;
}

.hc-cart-empty h2 {
    font-size: 24px;
    margin: 0 0 12px 0;
}

.hc-cart-empty p {
    font-size: 16px;
    margin: 0 0 32px 0;
}

.hc-cart-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    align-items: start;
}

/* Cart Items Column */
.hc-cart-items-column {
    background: var(--hc-white);
    border-radius: var(--hc-radius);
    padding: 24px;
    border: 1px solid var(--hc-border);
}

.hc-page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 24px 0;
}

.hc-page-count {
    font-weight: 400;
    color: var(--hc-text-light);
}

.hc-page-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto auto;
    gap: 20px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--hc-border);
}

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

.hc-page-item.removing {
    opacity: 0;
}

.hc-page-item-image {
    width: 100px;
    height: 100px;
    border-radius: var(--hc-radius-sm);
    overflow: hidden;
    background: var(--hc-blush);
}

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

.hc-page-item-info {
    min-width: 0;
}

.hc-page-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 4px 0;
}

.hc-page-item-variation {
    font-size: 13px;
    color: var(--hc-text-light);
    margin: 0 0 8px 0;
}

.hc-page-item-price {
    font-size: 15px;
    color: var(--hc-primary);
    font-weight: 600;
    margin: 0;
}

.hc-page-item-qty .hc-quantity-controls {
    background: var(--hc-blush);
    padding: 6px;
    border-radius: 30px;
}

.hc-page-item-subtotal {
    font-size: 16px;
    font-weight: 600;
    color: var(--hc-text);
    min-width: 80px;
    text-align: right;
}

.hc-page-remove {
    width: 40px;
    height: 40px;
}

.hc-continue-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--hc-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.hc-continue-link:hover {
    text-decoration: underline;
}

/* Sidebar */
.hc-cart-sidebar {
    position: sticky;
    top: 20px;
}

.hc-sidebar-section {
    background: var(--hc-white);
    border-radius: var(--hc-radius);
    padding: 20px;
    border: 1px solid var(--hc-border);
    margin-bottom: 16px;
}

.hc-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 16px 0;
}

.hc-page-addons .hc-addon-btn {
    padding: 14px;
}

.hc-totals-section .hc-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--hc-text-light);
}

.hc-totals-section .hc-total-final {
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid var(--hc-primary);
    font-size: 18px;
    font-weight: 700;
    color: var(--hc-text);
}

.hc-cart-sidebar .hc-shipping-note {
    margin-top: 12px;
}

.hc-cart-sidebar .hc-btn-primary {
    margin-top: 16px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .hc-cart-layout {
        grid-template-columns: 1fr;
    }

    .hc-cart-sidebar {
        position: static;
    }
}

@media (max-width: 600px) {
    .hc-drawer {
        max-width: 100%;
    }

    .hc-page-item {
        grid-template-columns: 80px 1fr;
        gap: 12px;
    }

    .hc-page-item-qty,
    .hc-page-item-subtotal {
        grid-column: 2;
    }

    .hc-page-remove {
        position: absolute;
        right: 0;
        top: 20px;
    }

    .hc-page-item {
        position: relative;
        padding-right: 50px;
    }

    .hc-addons-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Cart Count Badge
   ============================================ */
.hestia-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    background: var(--hc-primary);
    color: var(--hc-white);
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    padding: 0 6px;
}

/* Hide if empty */
.hestia-cart-count:empty,
.hestia-cart-count[data-count="0"] {
    display: none;
}

/* ============================================
   Add-ons Widget [hestia_addons]
   Styled to match Elementor cart design
   ============================================ */
.hc-addons-widget {
    max-width: 100%;
    margin: 30px 0;
}

.hc-widget-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    padding: 25px 30px;
    margin-bottom: 20px;
}

.hc-widget-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--hc-text);
    margin: 0 0 20px 0;
}

/* Widget Add-ons Grid */
.hc-widget-addons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (max-width: 600px) {
    .hc-widget-addons-grid {
        grid-template-columns: 1fr;
    }
}

.hc-widget-addon-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.hc-widget-addon-btn:hover {
    background: var(--hc-accent);
    border-color: var(--hc-accent);
}

.hc-widget-addon-btn:hover .hc-widget-addon-name,
.hc-widget-addon-btn:hover .hc-widget-addon-price {
    color: #ffffff;
}

.hc-widget-addon-btn.selected {
    border-color: var(--hc-primary);
    background: var(--hc-blush);
}

.hc-widget-addon-btn.selected:hover {
    background: var(--hc-primary);
    border-color: var(--hc-primary);
}

.hc-widget-addon-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.hc-widget-addon-info {
    flex: 1;
}

.hc-widget-addon-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--hc-text);
    margin-bottom: 2px;
}

.hc-widget-addon-price {
    display: block;
    font-size: 13px;
    color: var(--hc-text-light);
}

/* Widget Gift Section */
.hc-widget-gift-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.hc-widget-gift-toggle input {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: var(--hc-primary);
}

.hc-widget-gift-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--hc-text);
}

.hc-widget-gift-icon {
    font-size: 20px;
}

.hc-widget-gift-note-wrapper {
    margin-top: 20px;
}

.hc-widget-gift-note-label {
    display: block;
    font-size: 13px;
    color: var(--hc-text-light);
    margin-bottom: 10px;
}

.hc-widget-gift-note-label small {
    opacity: 0.8;
}

.hc-widget-gift-textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-family: inherit !important;
    font-size: 14px !important;
    font-style: normal !important;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.3s ease;
}

.hc-widget-gift-textarea::placeholder {
    font-family: inherit !important;
    font-style: normal !important;
    color: var(--hc-text-light);
}

.hc-widget-gift-textarea:focus {
    outline: none;
    border-color: var(--hc-primary);
}

.hc-widget-gift-counter {
    font-size: 12px;
    color: var(--hc-text-light);
    text-align: right;
    margin: 8px 0 0 0;
}
