/* ============================================
   KLUKVA CAFE - CART MODAL STYLES
   Mobile-First Responsive Design
   ============================================ */

:root {
    --cart-orange: linear-gradient(135deg, #C8102E 0%, #FF6B35 100%);
    --cart-orange-hover: linear-gradient(135deg, #C8102E 0%, #FF6B35 100%);
    --cart-orange-light: #FFF5ED;
    --cart-gray: #F9F9F9;
    --cart-text: #000000;
    --cart-text-secondary: #92929D;
    --cart-border: #E8E8E8;
    --cart-success: #1AC84B;
    --cart-error: #F03226;
    --cart-radius: 16px;
    --cart-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    --cart-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   MODAL OVERLAY
   ============================================ */

.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-modal.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.cart-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: cartFadeIn 0.3s ease;
}

@keyframes cartFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   CART CONTAINER - MOBILE FIRST
   ============================================ */

.cart-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    background: #FFFFFF;
    border-radius: 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-modal.show .cart-container {
    transform: translateY(0);
}

/* Desktop: &#24333;&#20162;&#20174;&#20162;&#20110;&#33298;&#65533; &#20183;&#33298;&#20166;&#20128;&#20173;&#65533; &#65533;&#20183;&#65533;&#33298;&#20110;&#33298; */
@media (min-width: 768px) {
    .cart-container {
        top: 0;
        right: 0;
        left: auto;
        bottom: auto;
        width: 100%;
        max-width: 480px;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
    }
    
    .cart-modal.show .cart-container {
        transform: translateX(0);
    }
}

/* ============================================
   HEADER
   ============================================ */

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cart-border);
    background: #FFFFFF;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .cart-header {
        padding: 20px 24px;
    }
}

.cart-back,
.cart-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--cart-transition);
    color: var(--cart-text-secondary);
    -webkit-tap-highlight-color: transparent;
}

.cart-back:hover,
.cart-close:hover {
    background: var(--cart-gray);
    color: var(--cart-text);
}

.cart-back:active,
.cart-close:active {
    transform: scale(0.95);
}

.cart-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--cart-text);
    letter-spacing: -0.5px;
}

@media (min-width: 768px) {
    .cart-title {
        font-size: 24px;
    }
}

/* ============================================
   BODY (&#24332;&#65533;&#65533;&#24332;&#65533;&#65533; &#19984;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;)
   ============================================ */

.cart-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

.cart-body::-webkit-scrollbar {
    width: 6px;
}

.cart-body::-webkit-scrollbar-track {
    background: transparent;
}

.cart-body::-webkit-scrollbar-thumb {
    background: var(--cart-border);
    border-radius: 3px;
}

.cart-body::-webkit-scrollbar-thumb:hover {
    background: var(--cart-text-secondary);
}

@media (min-width: 768px) {
    .cart-body::-webkit-scrollbar {
        width: 8px;
    }
    
    .cart-body::-webkit-scrollbar-thumb {
        border-radius: 4px;
    }
}

.cart-items {
    padding: 12px 16px;
}

@media (min-width: 768px) {
    .cart-items {
        padding: 16px 24px;
    }
}

/* ============================================
   &#65533;&#19989;&#24332;&#19984;&#65533;&#20106; &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
   ============================================ */

.cart-empty {
    text-align: center;
    padding: 60px 30px;
    animation: cartFadeIn 0.5s ease;
}

@media (min-width: 768px) {
    .cart-empty {
        padding: 80px 40px;
    }
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--cart-text-secondary);
    opacity: 0.3;
}

@media (min-width: 768px) {
    .empty-icon {
        width: 80px;
        height: 80px;
        margin: 0 auto 24px;
    }
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--cart-text);
    margin-bottom: 6px;
}

@media (min-width: 768px) {
    .empty-text {
        font-size: 20px;
        margin-bottom: 8px;
    }
}

.empty-subtext {
    font-size: 14px;
    color: var(--cart-text-secondary);
}

@media (min-width: 768px) {
    .empty-subtext {
        font-size: 16px;
    }
}

/* ============================================
   &#19984;&#65533;&#65533;&#65533;&#65533; &#65533; &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
   ============================================ */

.cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--cart-border);
    animation: cartSlideIn 0.3s ease;
}

@keyframes cartSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (min-width: 768px) {
    .cart-item {
        gap: 16px;
        padding: 16px 0;
    }
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 64px;
    height: 64px;
    min-width: 64px;
    max-width: 64px;
    min-height: 64px;
    max-height: 64px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--cart-gray);
}

@media (min-width: 768px) {
    .item-image {
        width: 80px;
        height: 80px;
        border-radius: 12px;
    }
}

.cart-item-image img {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    object-fit: cover;
    display: block;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

@media (min-width: 768px) {
    .item-details {
        gap: 8px;
    }
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cart-text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (min-width: 768px) {
   .item-image {
        width: 80px;
        height: 80px;
        min-width: 80px;
        max-width: 80px;
        min-height: 80px;
        max-height: 80px;
        border-radius: 12px;
    }
    
    .item-image img {
        width: 80px !important;
        height: 80px !important;
        max-width: 80px !important;
        max-height: 80px !important;
    }
}

.cart-item-options {
    font-size: 12px;
    color: var(--cart-text-secondary);
    line-height: 1.4;
}

@media (min-width: 768px) {
    .item-options {
        font-size: 14px;
    }
}

.cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.cart-item-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--cart-text);
}

@media (min-width: 768px) {
    .cart-item-price {
        font-size: 18px;
    }
}

/* ============================================
   &#24332;&#20028;&#65533;&#19984;&#20028;&#65533;&#65533; &#65533;&#65533;&#65533;&#65533;&#20028;&#65533;&#24332;&#19984;&#65533;&#65533;
   ============================================ */

/* ============================================
   КНОПКА ЗАКРЫТИЯ (крестик)
   ============================================ */

.cart-header .close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cart-gray);
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--cart-transition);
    color: var(--cart-text-secondary);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.cart-header .close:hover {
    background: var(--cart-error);
    color: #fff;
    transform: rotate(90deg);
}

.cart-header .close:active {
    transform: scale(0.95);
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--cart-gray);
    border-radius: 10px;
    padding: 4px;
}

@media (min-width: 768px) {
    .cart-item-quantity {
        border-radius: 12px;
    }
}

.qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--cart-transition);
    color: var(--cart-orange);
    font-size: 18px;
    font-weight: 700;
    -webkit-tap-highlight-color: transparent;
}

.qty-btn:hover {
    background: rgba(255, 105, 0, 0.1);
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-value {
    min-width: 28px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--cart-text);
}

@media (min-width: 768px) {
    .qty-value {
        min-width: 32px;
        font-size: 16px;
    }
}

.cart-item-remove {
    position: absolute;
    top: 8px;
    right: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cart-text-secondary);
    font-size: 20px;
    border-radius: 50%;
    transition: var(--cart-transition);
    -webkit-tap-highlight-color: transparent;
}

.cart-item-remove:hover {
    background: var(--cart-gray);
    color: var(--cart-error);
}

.cart-item {
    position: relative;
}


/* ============================================
   FOOTER (&#65533;&#19984;&#65533;&#65533;&#65533;)
   ============================================ */

.cart-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--cart-border);
    background: #FFFFFF;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .cart-footer {
        padding: 24px;
    }
}

/* Safe area &#20127;&#20173;&#65533; iPhone */
@supports (padding: max(0px)) {
    .cart-footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

.cart-summary {
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .cart-summary {
        margin-bottom: 20px;
    }
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

@media (min-width: 768px) {
    .summary-row {
        padding: 8px 0;
    }
}

.summary-label {
    font-size: 14px;
    color: var(--cart-text-secondary);
}

@media (min-width: 768px) {
    .summary-label {
        font-size: 16px;
    }
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--cart-text);
}

@media (min-width: 768px) {
    .summary-value {
        font-size: 16px;
    }
}

.summary-total {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--cart-border);
}

@media (min-width: 768px) {
    .summary-total {
        padding-top: 16px;
        margin-top: 12px;
    }
}

.summary-total .summary-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--cart-text);
}

@media (min-width: 768px) {
    .summary-total .summary-label {
        font-size: 18px;
    }
}

.summary-total .summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--cart-text);
}

@media (min-width: 768px) {
    .summary-total .summary-value {
        font-size: 24px;
    }
}

/* ============================================
   &#65533;&#65533;&#65533;&#65533;&#65533;&#65533; &#65533;&#20010;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#20106;
   ============================================ */

.checkout-btn {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--cart-orange);
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cart-transition);
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
    .checkout-btn {
        height: 56px;
        gap: 12px;
        font-size: 18px;
    }
}

.checkout-btn:hover:not(:disabled) {
    background: var(--cart-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 105, 0, 0.3);
}

.checkout-btn:active:not(:disabled) {
    transform: translateY(0);
    transform: scale(0.98);
}

.checkout-btn:disabled {
    background: var(--cart-border);
    color: var(--cart-text-secondary);
    cursor: not-allowed;
}

.checkout-btn svg {
    transition: transform 0.3s ease;
}

.checkout-btn:hover:not(:disabled) svg {
    transform: translateX(4px);
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .cart-modal,
    .cart-container,
    .cart-backdrop,
    .cart-item,
    .quantity-btn,
    .checkout-btn,
    .checkout-btn svg {
        transition: none;
        animation: none;
    }
}






