/* Иконка корзины */
#cart-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;    
}

/* Эффект при наведении */
#cart-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

#cart-icon.empty {
    background: url("/uploads/icons/cart-icon-gray.svg") center/45px no-repeat;
    backdrop-filter: blur(10px);
}

#cart-icon.active {
    background: rgb(40, 167, 69) url("/uploads/icons/cart-icon.svg") center/45px no-repeat;
    opacity: 1;
    animation: pulse 2s infinite; /* Добавляем анимацию пульсации */
}

#cart-icon.x {
    background: rgb(255, 255, 255) url("/uploads/icons/close-icon.svg") center/45px no-repeat;
}

/* Определение анимации пульсации */
@keyframes pulse {
    0% {
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(0.9);
    }
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: rgb(255, 255, 0);
    color: #000000;
    font-size: 16px;
    padding: 2px 8px;
    border-radius: 50%;
    display: none;
}

/* Боковая панель корзины */
.cart-sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 999;
    top: 0;
    right: 0;
    background-color: #fff;
    overflow-x: hidden;
    transition: width 0.3s ease;
    box-shadow: -10px 0 20px rgba(0, 0, 0, 0.1);
}

.cart-sidebar.open {
    width: clamp(250px, 100%, 350px);
}

.cart-content {
    width: 100%;
    max-width: 350px;
    height: 100%;
    background: #fff;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
}

/* Товар в корзине */
.cart-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 10px;
}

.cart-item-info {
    flex: 1;
}

.item-name {
    font-weight: normal;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 5px;
}

.item-details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 2px;
}

.quantity-button {
    width: 30px;
    height: 30px;
    background-color: #ffffff;
    border: 1px solid #ffffff;
    color: #28a745;
    border-radius: 8px;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.quantity-button:hover {
    background-color: #ffffff;
}

.quantity-button:disabled {
    color: #d2d2d2;
}

.quantity-display {
    font-size: 0.9rem;
    font-weight: bold;
    padding: 4px 10px;
    border: 1px solid #d2d2d2;
    border-radius: 8px;
}

.total-price {
    font-size: 0.9rem;
    color: #28a745;
}

.delete-item {
    margin-left: 10px;
    padding: 5px;
    background-color: transparent;
    color: #888;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s ease;
}

.delete-item:hover {
    color: #dc3545;
}

.cart-total {
    padding: 20px 0;
    font-size: 1rem;
    text-align: center;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.cart-total .total-amount b {
    color: #28a745;
}

.checkout-button, .checkout-button-fin, .back-button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    text-align: center;
}

.checkout-button {
    font-weight: bold;
    color: #28a745;
    background: none;
    border: 2px solid #28a745;
}

.checkout-button-fin {
    font-weight: bold;
    color: #ffffff;
    background: #28a745;
    border: 2px solid #28a745;
}

.back-button {
    font-weight: normal;
    background: none;
    border: none;
    color: #333333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.checkout-button:hover, .checkout-button-fin:hover {
    color: #ffffff;
    background-color: #218838;
    border: 2px solid #218838;
}

.checkout-button:active, .checkout-button-fin:active {
    color: #ffffff;
    background-color: #218838;
    border: 2px solid #218838;
}

.cart-item-info .item-details {
    display: flex;
    align-items: center;
}

/* Pop-up сообщение */
#popup-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745;
    color: #fff;
    padding: 16px;
    border-radius: 16px;
    font-size: 14px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1000;
    animation: slide-down 0.3s ease;
}

/* checkout */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.form-section, .nova-poshta-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-section h3 {
    margin: 10px 0 5px;
    font-size: 16px;
}

.checkout-form input,
.checkout-form select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}
.autocomplete-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
    display: none;
}
.suggestion-item {
    padding: 5px 10px;
    cursor: pointer;
}
.suggestion-item:hover {
    background-color: #f0f0f0;
}
.cart-message {
    display: none;
    text-align: center;
    padding: 10px;
    color: #28a745; /* Зеленый цвет для успеха */
    font-weight: bold;
}
.checkout-form input,
.checkout-form select {
    transition: background-color 0.3s ease; /* Плавное изменение фона */
}
/* checkout */

.order-success-message {
    padding: 20px;
    text-align: center;
    background-color: #e6ffe6;
    border-radius: 5px;
    margin: 10px 0;
}

.order-success-message h3 {
    color: #2ecc71;
    margin-bottom: 10px;
}

.order-success-message p {
    color: #333;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-50px) translateX(-50%); }
    to { opacity: 1; transform: translateY(0) translateX(-50%); }
}

#popup-message.fadeOut {
    animation: fade-out 0.3s ease forwards;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}