/* ===========================================
   Warenkorb CSS - Zentralisierte Styles
   =========================================== */

/* Fixierter Warenkorb-Button am rechten Rand */
.cart-offcanvas-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1040;

    background: linear-gradient(135deg, var(--brand-primary, #68AB03), var(--brand-accent, #70A91E));
    color: white;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 15px 12px;
    width: 60px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;

    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;

    font-size: 1.2rem;
    line-height: 1;
}

.cart-offcanvas-trigger:hover {
    width: 70px;
    box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, var(--brand-accent, #70A91E), var(--brand-primary, #68AB03));
}

.cart-offcanvas-trigger:active {
    transform: translateY(-50%) scale(0.95);
}

.cart-offcanvas-trigger .cart-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cart-offcanvas-trigger .cart-button-text {
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    writing-mode: horizontal-tb;
    margin-top: 2px;
}

/* Offcanvas Customizing */
.cart-offcanvas {
    width: 400px !important;
    max-width: 90vw;
    max-height: 74vh !important; /* Desktop: Erhöht um 10% (von 67vh auf 74vh) */
    height: 74vh !important; /* Desktop: Feste Höhe */
    margin: 2rem auto;
    top: 50% !important;
    transform: translateY(-50%) translateX(100%) !important;
    border-radius: 0.5rem;
    position: fixed;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-origin: center center;
}

/* Langsamere Offcanvas-Animation - smooth für Öffnen */
.cart-offcanvas.showing {
    transform: translateY(-50%) translateX(0) !important;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.cart-offcanvas.show {
    transform: translateY(-50%) translateX(0) !important;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Tablet (768px - 1024px) - 10% höher (81vh → 89vh) */
@media (min-width: 769px) and (max-width: 1024px) {
    .cart-offcanvas {
        max-height: 89vh !important; /* 10% höher (81vh → 89vh) */
        height: 89vh !important; /* Feste Höhe für Tablet */
    }
}

/* Handy (unter 768px) - 5% höher (60vh → 63vh) */
@media (max-width: 768px) {
    .cart-offcanvas {
        max-height: 63vh !important; /* 5% höher (60vh → 63vh) */
        height: 63vh !important; /* Feste Höhe für Handy */
    }
}

/* Smooth Schließen - ohne Springen */
.cart-offcanvas.hiding {
    transform: translateY(-50%) translateX(100%) !important;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Initial State - versteckt (rechts außerhalb) */
.cart-offcanvas:not(.show):not(.showing) {
    transform: translateY(-50%) translateX(100%) !important;
}

/* Backdrop-Animation ebenfalls verlangsamen */
.offcanvas-backdrop {
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.cart-offcanvas .offcanvas-header {
    background: #389950 !important; /* Neue grüne Hintergrundfarbe */
    color: white;
    padding: 0.825rem 1.5rem;
    border-bottom: 3px solid var(--brand-secondary, #DFC184);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cart-offcanvas .offcanvas-header:hover {
    background: #389950 !important; /* Gleiche Farbe beim Hover */
}

.cart-offcanvas .offcanvas-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: white;
}

.cart-offcanvas .btn-close {
    position: absolute;
    right: 1.5rem;
    margin-left: auto;
    filter: brightness(0) invert(1);
    opacity: 0.8;
    width: 0.7em;
    height: 0.7em;
    font-size: 0.7em;
}

.cart-offcanvas .btn-close:hover {
    opacity: 1;
}

.cart-offcanvas .offcanvas-body {
    padding: 1.5rem 1.5rem 0.1rem 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.cart-offcanvas .offcanvas-footer {
    padding: 0.5rem 1.5rem;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* Warenkorb-Items Styling */
.cart-items .list-group-item {
    border-left: 3px solid var(--brand-primary, #68AB03);
    margin-bottom: 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.cart-items .list-group-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(-2px);
}

.cart-items h6 {
    color: #212529;
    font-weight: 600;
    font-size: 0.95rem;
}

.cart-items .btn-outline-danger {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Kontakt-Informationen Styling */
.contact-info .contact-item {
    border-left: 3px solid #28a745;
    padding-left: 0.75rem;
    margin-bottom: 1rem;
}

.contact-info .contact-icon {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f8f4;
    border-radius: 50%;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.contact-info .contact-icon i {
    font-size: 1.1rem;
}

.contact-info a {
    transition: color 0.2s ease;
}

.contact-info a:hover {
    color: #1e7e34 !important;
}

.contact-info .visit-us {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    border-left: 3px solid #28a745;
}

.contact-info .opening-hours {
    background-color: #f0f8f4;
    padding: 0.75rem;
    border-radius: 0.375rem;
    max-width: 85%;
    margin: 0 auto;
}

/* Container mit "Direkte Anfrage" schmaler machen */
.contact-info > .text-center {
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
}

/* Foto-Container schmaler und niedriger machen */
.cart-offcanvas .content-section {
    max-width: 85%;
    margin: 0 auto;
}

.cart-offcanvas .content-section .alert {
    padding: 0.5rem;
}

.cart-offcanvas .gallery-thumbnail {
    width: 80px !important;
    height: 80px !important;
}

.cart-offcanvas .row {
    max-width: 85%;
    margin: 0 auto;
}

.cart-offcanvas .row.mb-1 {
    margin-bottom: 0.25rem !important;
}

.cart-offcanvas .content-section.mb-0 {
    margin-bottom: 0 !important;
}

/* Mobile Styles für Button und Offcanvas */
@media (max-width: 768px) {
    .cart-offcanvas-trigger {
        top: auto;
        bottom: 20px;
        right: 20px;
        transform: none;
        border-radius: 50%;
        width: 60px;
        height: 60px;
        padding: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .cart-offcanvas-trigger:hover {
        width: 60px;
        height: 60px;
        transform: scale(1.05);
    }

    .cart-offcanvas-trigger:active {
        transform: scale(0.95);
    }

    .cart-offcanvas-trigger .cart-button-text {
        display: none;
    }

    .cart-offcanvas-trigger .cart-badge {
        top: -4px;
        right: -4px;
    }

    .cart-offcanvas {
        width: calc(100% - 2rem) !important;
        max-height: 90vh;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 1rem;
        border-radius: 0.5rem;
        position: fixed;
    }

    .cart-offcanvas .offcanvas-header {
        padding: 1rem 1.25rem;
    }

    .cart-offcanvas .offcanvas-body {
        padding: 1.25rem;
    }

    .cart-offcanvas .offcanvas-footer {
        padding: 1rem 1.25rem;
    }
}

/* Toast-Container für Benachrichtigungen */
.toast-container {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1050; /* Unter Modal (1055), aber über backdrop (1050) */
    padding: 1rem;
}

/* Mobile Produkt-Karten Layout */
.mobile-product-cards {
    display: grid;
    gap: 1rem;
}

.mobile-product-cards .card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.mobile-product-cards .card-header {
    background-color: #70A91E;
    color: white;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #dee2e6;
}

.mobile-product-cards .card-body {
    padding: 1rem;
}

.mobile-product-cards dl.row dt {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.mobile-product-cards dl.row dd {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Mobile responsive für Produkt-Karten */
@media (max-width: 768px) {
    .mobile-product-cards .card {
        margin-bottom: 1rem;
    }

    .mobile-product-cards .card-header {
        padding: 0.5rem 1rem;
    }

    .mobile-product-cards .card-body {
        padding: 1rem;
    }

    .mobile-product-cards dl.row dt {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

    .mobile-product-cards dl.row dd {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }
}

/* Input-Group Styles für Warenkorb-Buttons */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group .input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.input-group .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group .btn {
    position: relative;
    z-index: 2;
}

/* Quantity Input Styles */
.quantity-input {
    text-align: center;
    border-radius: 0;
}

.quantity-input:focus {
    border-color: #70A91E;
    box-shadow: 0 0 0 0.2rem rgba(112, 169, 30, 0.25);
}

/* Add-to-Cart Button Styles */
.add-to-cart {
    border-radius: 0 0.25rem 0.25rem 0;
    transition: all 0.15s ease-in-out;
}

.add-to-cart:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.add-to-cart:active {
    transform: translateY(0);
}

/* Button States für Add-to-Cart */
.add-to-cart.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.add-to-cart.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

/* Warenkorb-Seite Styles */
.cart-page .table-responsive {
    margin-bottom: 2rem;
}

.cart-page .cart-item-row {
    transition: background-color 0.15s ease-in-out;
}

.cart-page .cart-item-row:hover {
    background-color: #f8f9fa;
}

.cart-page .quantity-input {
    width: 80px;
    text-align: center;
}

.cart-page .remove-btn {
    color: #dc3545;
    border: none;
    background: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

.cart-page .remove-btn:hover {
    color: #b02a37;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050; /* Unter Modal (1055) */
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Alert Styles für Warenkorb */
.cart-alert {
    border-left: 4px solid #70A91E;
}

.cart-alert .alert-icon {
    color: #70A91E;
    margin-right: 0.5rem;
}

/* Responsive Design für kleine Bildschirme */
@media (max-width: 576px) {
    .cart-page .table-responsive {
        font-size: 0.875rem;
    }

    .cart-page .quantity-input {
        width: 60px;
    }

    .mobile-product-cards {
        grid-template-columns: 1fr;
    }

    /* Input-Groups bleiben in einer Reihe auf Mobile */
    .input-group {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .input-group .input-group-text {
        border-radius: 0.25rem 0 0 0.25rem !important;
        border-right: none !important;
    }

    .input-group .form-control {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }

    .input-group .btn {
        border-radius: 0 0.25rem 0.25rem 0 !important;
        border-left: none !important;
    }
}

/* Toast Animationen */
.toast.show {
    animation: toastSlideIn 0.3s ease-out;
}

.toast.hide {
    animation: toastSlideOut 0.3s ease-in;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Kleine Close-Buttons für Toasts */
.btn-close-sm {
    padding: 0.125rem !important;
    margin: 0 !important;
    width: 1rem !important;
    height: 1rem !important;
    font-size: 0.75rem !important;
}

.btn-close-sm span {
    font-size: 0.75rem !important;
    line-height: 1 !important;
    font-weight: bold;
}

/* Focus States für Accessibility */
.add-to-cart:focus,
.quantity-input:focus,
.remove-btn:focus {
    outline: 2px solid #70A91E;
    outline-offset: 2px;
}

/* Print Styles für Warenkorb */
@media print {
    #cart-widget,
    .toast-container {
        display: none !important;
    }

    .add-to-cart,
    .remove-btn {
        display: none !important;
    }
}

/* Fix für leaveInquiryModal - muss über allen Backdrops liegen */
#leaveInquiryModal {
    z-index: 99999 !important;
    position: fixed !important;
    pointer-events: auto !important;
}

#leaveInquiryModal.show {
    z-index: 99999 !important;
    position: fixed !important;
    pointer-events: auto !important;
    display: block !important;
}

#leaveInquiryModal.fade {
    z-index: 99999 !important;
}

#leaveInquiryModal .modal-dialog {
    pointer-events: auto !important;
    z-index: 100000 !important;
    position: relative !important;
}

#leaveInquiryModal .modal-content {
    pointer-events: auto !important;
    z-index: 100001 !important;
    position: relative !important;
}

/* Backdrop für leaveInquiryModal - unter Modal, aber über allem anderen */
.modal-backdrop.fade.show {
    z-index: 99998 !important;
    pointer-events: auto !important;
}

/* Spezifischer Backdrop für leaveInquiryModal */
body:has(#leaveInquiryModal.show) .modal-backdrop {
    z-index: 99998 !important;
}

/* Sicherstellen, dass das Modal über Cookiebot liegt */
#leaveInquiryModal.modal {
    z-index: 99999 !important;
    pointer-events: auto !important;
}

/* Cookiebot Overlay unter Modal legen - komplett deaktivieren wenn Modal offen */
body:has(#leaveInquiryModal.show) #CybotCookiebotDialog,
body:has(#leaveInquiryModal.show) #CybotCookiebotDialogUnderlay,
body:has(#leaveInquiryModal.show) #CybotCookiebotDialogBodyLevelTertiary {
    z-index: 1040 !important;
    pointer-events: none !important;
    display: none !important;
}

/* Alle anderen Modals sollten normal bleiben (falls vorhanden) */
.modal:not(#leaveInquiryModal) {
    z-index: 1055;
}

.modal-backdrop:not(.show) {
    display: none !important;
}

/* Entferne alle Backdrops außer dem für leaveInquiryModal wenn es geöffnet ist */
body.modal-open:has(#leaveInquiryModal.show) .modal-backdrop:not(:last-of-type) {
    display: none !important;
}

/* Stelle sicher, dass das Modal und sein Backdrop klickbar sind */
body:has(#leaveInquiryModal.show) #leaveInquiryModal,
body:has(#leaveInquiryModal.show) #leaveInquiryModal *,
body:has(#leaveInquiryModal.show) .modal-backdrop {
    pointer-events: auto !important;
}

/* Deaktiviere Cookiebot und andere Overlays wenn Modal offen ist */
body:has(#leaveInquiryModal.show) #CybotCookiebotDialog *,
body:has(#leaveInquiryModal.show) #CybotCookiebotDialogUnderlay * {
    pointer-events: none !important;
}