/* Cart styles - Mobile First */

/* ==========================================
   БАЗОВЫЕ СТИЛИ (Мобильные устройства < 480px)
   ========================================== */

/* Уведомления корзины */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    color: #1a1a1a;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 15px;
    border-left: 4px solid #b77b3b;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 320px;
}

.cart-notification.show {
    transform: translateX(0);
}

.cart-notification i {
    font-size: 20px;
    color: #28a745;
}

/* Мобильный стиль уведомления */
@media (max-width: 480px) {
    .cart-notification {
        top: auto;
        bottom: 20px;
        right: 16px;
        left: 16px;
        transform: translateY(150%);
        max-width: none;
        border-left: none;
        border-bottom: 4px solid #b77b3b;
    }
    
    .cart-notification.show {
        transform: translateY(0);
    }
}

/* Кнопка корзины в шапке */
.cart-icon {
    position: relative;
    display: inline-block;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: 20px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    margin-top: 8px;
}

/* Cart page layout - мобильный */
.cart-page {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 0.75rem;
}

.cart-header {
    margin-bottom: 2rem;
}

.cart-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cart-header h1 i {
    color: #b77b3b;
}

/* Пустая корзина - мобильный */
.cart-empty {
    padding: 3rem 1.5rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.empty-cart-icon {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.cart-empty p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Основной контент - мобильный (1 колонка) */
.cart-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

/* Товары */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Товар - мобильный layout (вертикальный) */
.cart-item {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 0.875rem;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.3s ease;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.item-image-wrapper {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f8f8;
}

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

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.item-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin: 0;
}

.item-price {
    color: #888;
    font-size: 0.875rem;
}

/* Item actions - мобильный grid */
.item-actions {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.item-actions .quantity-controls {
    margin-top: 0;
    justify-content: flex-start;
}

.item-total {
    font-weight: 700;
    font-size: 1.125rem;
    color: #b77b3b;
    text-align: center;
}

.remove-item {
    background: rgba(220, 53, 69, 0.1);
    border: none;
    color: #dc3545;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
}

.remove-item:hover {
    background: #dc3545;
    color: #fff;
}

/* Итоговая сводка - мобильный */
.cart-summary {
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 1.25rem;
    height: fit-content;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: static;
}

.summary-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 1rem 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin: 0.75rem 0;
    font-size: 0.925rem;
    color: #666;
}

.summary-row span:last-child {
    font-weight: 600;
    color: #333;
}

.summary-divider {
    height: 1px;
    background: #eee;
    margin: 1rem 0;
}

.summary-row.total {
    font-size: 1.125rem;
    font-weight: 700;
    margin-top: 1rem;
    color: #333;
}

.summary-row.total span:last-child {
    color: #b77b3b;
}

/* Кнопки - мобильный */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    background: #b77b3b;
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.925rem;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
}

.btn:hover {
    background: #a06a30;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(183, 123, 59, 0.3);
}

.btn-catalog {
    background: #333;
}

.btn-catalog:hover {
    background: #555;
}

.btn-primary {
    background: #b77b3b;
}

/* Order form */
.order-form {
    margin-top: 1.5rem;
    display: grid;
    gap: 1rem;
}

.order-form .form-row {
    display: grid;
    gap: 0.5rem;
}

.order-form label {
    font-size: 0.95rem;
    color: #444;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-form label i {
    color: #b77b3b;
}

.order-form input {
    padding: 0.875rem 1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.order-form input:focus {
    outline: none;
    border-color: #b77b3b;
    box-shadow: 0 0 0 3px rgba(183, 123, 59, 0.1);
}

/* Кнопки товаров */
.add-to-cart {
    transition: all 0.3s ease;
    position: relative;
}

.add-to-cart.in-cart {
    background: #6c757d;
    border-color: #6c757d;
    font-size: 0.8em;
    padding: 6px 10px;
    min-height: 38px;
}

.add-to-cart.in-cart:hover {
    background: #5a6268;
    border-color: #5a6268;
}

/* Контролы количества - мобильный */
.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 0;
    flex-wrap: nowrap;
}

.quantity-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #b77b3b;
    background: white;
    color: #b77b3b;
    font-weight: bold;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    vertical-align: middle;
}

.quantity-btn:hover {
    background: #b77b3b;
    color: white;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-display {
    font-weight: bold;
    color: #333;
    min-width: 30px;
    text-align: center;
    font-size: 15px;
    line-height: 34px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Success overlay */
.order-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.18), rgba(255,255,255,0) 60%), linear-gradient(135deg, #dff6e7 0%, #b9eaca 100%);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.35s ease forwards;
}

.order-success-overlay.active {
    display: flex;
}

.order-success-modal {
    background: transparent;
    border-radius: 0;
    padding: 24px;
    width: min(680px, 92vw);
    box-shadow: none;
    text-align: center;
    animation: modalPopIn 0.4s ease forwards;
}

.order-success-icon {
    width: 140px;
    height: 140px;
    margin: 0 auto 16px;
    animation: glowPulse 1.6s ease-in-out infinite;
}

.order-success-title {
    font-size: 2rem;
    margin: 0 0 10px;
    color: #0f5132;
    font-weight: 800;
}

.order-success-subtitle {
    font-size: 1.1rem;
    color: #2f6f45;
    margin: 0 0 18px;
}

/* Success icon animations */
.order-success-icon svg {
    animation: iconPop 0.35s ease;
}

.order-success-icon svg .ring {
    transform-origin: 50% 50%;
    animation: ringPop 0.35s ease;
}

.order-success-icon svg .check {
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    animation: checkDraw 0.8s ease forwards 0.25s;
}

@keyframes iconPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes ringPop {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

@keyframes checkDraw {
    from { stroke-dashoffset: 220; }
    to { stroke-dashoffset: 0; }
}

.order-success-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPopIn {
    from { transform: translateY(12px) scale(0.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes glowPulse {
    0% { filter: drop-shadow(0 0 0 rgba(46,125,50,0)); }
    50% { filter: drop-shadow(0 0 12px rgba(46,125,50,0.35)); }
    100% { filter: drop-shadow(0 0 0 rgba(46,125,50,0)); }
}

/* ==========================================
   МАЛЕНЬКИЕ ЭКРАНЫ (>= 481px)
   ========================================== */
@media (min-width: 481px) {
    .cart-header h1 {
        font-size: 1.5rem;
    }
    
    .cart-item {
        padding: 1rem;
        gap: 1rem;
    }
    
    .item-image-wrapper {
        height: 200px;
    }
    
    .item-name {
        font-size: 1.1rem;
    }
    
    .item-price {
        font-size: 0.9rem;
    }
    
    .item-actions {
        gap: 1rem;
    }
    
    .item-total {
        font-size: 1.25rem;
    }
    
    .remove-item {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .summary-title {
        font-size: 1.25rem;
    }
    
    .summary-row {
        font-size: 1rem;
    }
    
    .summary-row.total {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .quantity-controls {
        gap: 8px;
        margin-top: 0.5rem;
    }
    
    .quantity-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .quantity-display {
        font-size: 16px;
        min-width: 32px;
        line-height: 36px;
    }
    
    .add-to-cart.in-cart {
        min-height: 40px;
        font-size: 0.85em;
        padding: 8px 12px;
    }
}

/* ==========================================
   ПЛАНШЕТЫ (>= 769px)
   ========================================== */
@media (min-width: 769px) {
    /* Уведомления - десктопный стиль */
    .cart-notification {
        top: 20px;
        right: 20px;
        left: auto;
        max-width: 300px;
        min-width: 200px;
    }
    
    .cart-badge {
        right: -8px;
        margin-top: 0;
    }
    
    .cart-page {
        margin: 2rem auto;
        padding: 0 1rem;
    }
    
    .cart-header h1 {
        font-size: 2rem;
    }
    
    .cart-empty {
        padding: 4rem 2rem;
    }
    
    .empty-cart-icon {
        font-size: 4rem;
    }
    
    .cart-empty p {
        font-size: 1.25rem;
    }
    
    /* Сводка */
    .cart-summary {
        padding: 1.5rem;
    }
    
    .summary-title {
        font-size: 1.5rem;
    }
    
    .summary-row.total {
        font-size: 1.5rem;
    }
    
    /* Контролы количества */
    .quantity-controls {
        gap: 8px;
        justify-content: center;
    }
    
    .quantity-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .quantity-display {
        min-width: 30px;
        font-size: 16px;
        line-height: 32px;
    }
    
    .add-to-cart.in-cart {
        font-size: 0.9em;
        padding: 8px 16px;
        min-height: 40px;
    }
}

/* ==========================================
   ДЕСКТОП (>= 901px) - 2 колонки
   ========================================== */
@media (min-width: 901px) {
    /* Основной контент - 2 колонки */
    .cart-content {
        grid-template-columns: 1fr 380px;
    }
    
    /* Товар - горизонтальный grid layout */
    .cart-item {
        display: grid;
        grid-template-columns: 120px 1fr auto;
        gap: 1.25rem;
        padding: 1.25rem;
    }
    
    .item-image-wrapper {
        width: 120px;
        height: 120px;
        border-radius: 10px;
    }
    
    .item-name {
        font-size: 1.1rem;
    }
    
    .item-price {
        font-size: 0.95rem;
    }
    
    /* Item actions - горизонтальный flex */
    .item-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        justify-content: flex-end;
        padding-top: 0;
        border-top: none;
    }
    
    .item-total {
        font-size: 1.25rem;
        text-align: right;
    }
    
    .remove-item {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
        justify-self: auto;
    }
    
    /* Сводка - sticky */
    .cart-summary {
        position: sticky;
        top: 2rem;
    }
}
