/**
 * custom.css - Кастомные стили для SnackMarket56
 * Включает: стили товаров, PWA баннеры, модальные окна, валидацию
 */

/* Product Images */
.product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease-in-out;
}

.product-image:hover {
    transform: scale(1.1);
}

#imageModal .modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
}

#imageModal .modal-body {
    padding: 0;
    text-align: center;
    background: transparent;
}

#modalImage {
    border-radius: 0 !important;
    max-height: 80vh;
    width: auto;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .product-image {
        width: 60px;
        height: 60px;
    }
    .product-image-container {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 576px) {
    .product-qty::placeholder {
        font-size: 12px;
    }
}

.input-group .product-btn:disabled {
    background-color: #E9ECEF;
    border-color: #CED4DA;
    color: #6c757d;
    cursor: not-allowed;
}

/* Selected Items */
#selectedItems {
    display: none;
}

#selectedItemsList {
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
}

#selectedItemsList li {
    padding: 10px 15px;
}

#selectedItemsList .product-name {
    white-space: normal;
    word-break: break-word;
}

#selectedItemsList .badge {
    font-size: 12px;
    padding: 4px 6px;
    margin-left: 5px;
    white-space: nowrap;
}

/* New Product Badge */
.new-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff5722;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge[title="Только наличка"] {
    background-color: #dc3545;
    color: white;
    border: 1px solid #c82333;
}

.cash-only-product {
    border-left: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.05) !important;
}

.product-image-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin-right: 15px;
}

.new-product {
    border-left: 4px solid #ff5722;
    background-color: rgba(255, 87, 34, 0.05) !important;
    animation: pulse 2s infinite;
}

.new-product:hover {
    animation: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Form Validation */
.form-check.is-invalid {
    border: 2px solid #dc3545 !important;
    border-radius: 8px !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
    padding: 10px !important;
    transition: all 0.3s ease;
}

.form-check.is-invalid .form-check-input {
    border-color: #dc3545 !important;
}

.is-invalid {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.invalid-feedback {
    display: none;
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
    font-weight: bold;
}

.is-invalid + .invalid-feedback,
.form-check.is-invalid .invalid-feedback {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.is-invalid {
    animation: shake 0.5s ease-in-out;
}

/* Promo Code Section */
.promo-code-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.discount-badge {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

/* PWA Install Banner */
#pwaInstallBanner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    border-radius: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

#pwaInstallBanner .close {
    color: white;
    opacity: 0.8;
}

#pwaInstallBanner .close:hover {
    opacity: 1;
}

#pwaInstallSuccess {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: none;
}

@media (max-width: 768px) {
    #pwaInstallSuccess {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#pwaInstallBanner.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

/* Assortment Notice */
.assortment-notice {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    position: relative;
    overflow: hidden;
}

.assortment-notice::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.assortment-notice i {
    font-size: 1.5rem;
    margin-right: 10px;
    vertical-align: middle;
}

.assortment-notice strong {
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

/* Tips Highlight */
.tips-highlight {
    background: #f0f6ff;
    border-left: 4px solid #0d6efd;
    border-radius: 12px;
    padding: 16px;
}

/* Push Notification Button */
#enable-push-btn {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Push Modal */
.push-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.push-modal-overlay.show {
    opacity: 1;
}

.push-modal-dialog {
    max-width: 320px;
    width: 90%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.push-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.push-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.push-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.push-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.push-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}

.push-modal-text {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.push-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.push-modal-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.push-modal-btn-allow {
    background: #2196F3;
    color: white;
}

.push-modal-btn-allow:hover {
    background: #1976D2;
}

/* Push Instructions */
.push-instructions {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin: 0 0 20px 0;
    text-align: left;
}

.push-instruction-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #333;
}

.push-instruction-item:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}

.push-instruction-icon {
    font-size: 18px;
    margin-right: 12px;
    min-width: 24px;
}
