/* ===========================================
   Warenkorb CSS - Zentralisierte Styles
   =========================================== */

/* Warenkorb-Widget Styles */
#cart-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1050;
}

#cart-widget .toast {
    max-width: 300px;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#cart-widget .toast-header {
    border-bottom: none;
    padding: 0.5rem 1rem;
    background-color: var(--brand-primary) !important;
    color: white;
}

#cart-widget .toast-body {
    padding: 0.75rem 1rem;
}

/* Mobile Styles für Warenkorb-Widget */
@media (max-width: 576px) {
    #cart-widget {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
    }

    #cart-widget .toast {
        max-width: none;
        margin: 0;
        border-radius: 0;
    }
}

/* Toast-Container für Benachrichtigungen */
.toast-container {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1060;
    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: 9999;
}

.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;
    }
}