/* Warenkorb styles */

/* Ersparnis-Darstellung in der Warenkorb-Zusammenfassung */
.cart-total-row.savings {
    color: #28a745;
    font-weight: 600;
}

.savings-amount {
    color: #28a745;
    font-weight: bold;
}

.cart-total-savings-highlight {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

/* Artikel-Preisdarstellung mit Rabatt */
.cart-item-price-discount {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.cart-original-price-line {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9em;
}

.cart-discounted-price {
    color: #28a745;
    font-weight: bold;
    font-size: 1.1em;
}

.cart-discount-badge {
    background-color: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.cart-regular-price {
    font-weight: 600;
    color: #333;
}

.cart-message {
    text-align: center;
    padding: 30px;
    margin: 20px 0;
    background-color: #f5f5f5;
    border-radius: 5px;
}

.cart-container {
    margin: 20px 0;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cart-table th, 
.cart-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.cart-table th {
    background-color: #c0c0c0;
    font-weight: bold;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.cart-item-image-container {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.cart-item-details {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.cart-item-info {
    flex: 1;
    padding-left: 10px;
    min-width: 0; /* Verhindert Überlauf bei langen Texten */
}

.cart-item-name {
    font-weight: bold;
    word-break: break-word; /* Ermöglicht Zeilenumbrüche bei langen Wörtern */
}

.cart-item-quantity {
    display: flex;
    align-items: center;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.quantity-input {
    width: 40px;
    height: 30px;
    text-align: center;
    margin: 0 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.remove-item {
    background-color: transparent;
    border: none;
    color: #ef770b;
    cursor: pointer;
    font-size: 16px;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 5px;
    box-sizing: border-box;
    width: 100%;
}

.cart-totals {
    flex: 1;
    min-width: 250px;
    margin-right: 20px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cart-total-row.total {
    font-weight: bold;
    font-size: 18px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-top: 10px;
}

.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #ef770b;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #d86c0a;
}

.button.secondary {
    background-color: #6c757d;
}

.button.secondary:hover {
    background-color: #5a6268;
}

/* Checkout styles */
.checkout-container {
    display: none;
    margin: 30px 0 150px 0; /* Stark erhöhter Abstand nach unten für die Fußleiste */
    max-width: 100%;
    box-sizing: border-box;
    border-top: 2px solid #f0f0f0;
    padding-top: 20px;
    position: relative;
    z-index: 1; /* Stellt sicher, dass der Container über anderen Elementen liegt */
}

.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 5px;
    box-sizing: border-box;
    width: 100%;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.form-group {
    margin-bottom: 15px;
    flex: 1;
    min-width: 200px;
    box-sizing: border-box;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

.form-group input.invalid,
.form-group select.invalid {
    border: 2px solid #ff0000;
    background-color: #ffeeee;
}

/* AGB-Checkbox Hervorhebung */
.checkbox-container.invalid {
    border: 2px solid #ff4444;
    background-color: #fff5f5;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
    animation: shake 0.5s ease-in-out;
    /* Responsive Optimierung - verhindert Überlauf */
    box-sizing: border-box;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.checkbox-container.invalid label {
    /* Rote Schrift entfernt - weniger aufdringlich */
    font-weight: 600;
}

/* Shake-Animation für AGB-Checkbox */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Toast-Benachrichtigung für AGB-Fehler */
.toast-notification.error {
    background-color: #ff4444;
    color: white;
    border-left: 4px solid #cc0000;
}

.toast-notification.error::before {
    content: '⚠️ ';
    font-size: 16px;
    margin-right: 8px;
}

/* Mobile Responsive-Optimierung für AGB-Checkbox */
@media (max-width: 768px) {
    .checkbox-container.invalid {
        margin-left: -5px;
        margin-right: -5px;
        padding: 10px;
        border-radius: 6px;
    }
    
    .checkbox-container.invalid label {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* Bereich "Sie sparen heute" auf Mobilgeräten ausblenden */
    .cart-total-savings-highlight {
        display: none !important;
    }
}

label.required:after {
    content: " *";
    color: #ff0000;
}

.form-group select {
    background-color: white;
    height: 42px; /* Gleiche Höhe wie die Eingabefelder */
    appearance: auto; /* Standardmäßiges Dropdown-Aussehen */
}

/* Checkbox-Container und Gruppe Styling */
.checkbox-container {
    width: 100%;
    text-align: left;
    margin: 15px 0;
}

.checkbox-group {
    margin: 0;
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 0;
    justify-content: flex-start; /* Links ausrichten */
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
}

.checkbox-group label {
    font-size: 14px;
    line-height: 1.4;
}

.checkbox-group a {
    color: #ff8c00; /* Orange Farbe für Links */
    text-decoration: underline;
}

.checkbox-group a:hover {
    text-decoration: none;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: sticky;
    top: 0;
    background-color: #fefefe;
    padding: 0 5px;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.payment-methods {
    margin-top: 20px;
    margin-bottom: 30px; /* Zusätzlicher Abstand nach unten */
    position: relative;
    z-index: 5; /* Höher als der Container, aber niedriger als die Fußleiste */
}

#paypal-button-container {
    margin-bottom: 30px; /* Zusätzlicher Abstand nach unten */
    position: relative;
    z-index: 5;
}

.checkout-actions {
    margin-top: 20px;
}

/* Toast-Benachrichtigung */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(51, 51, 51, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    max-width: 350px;
    display: inline-block;
}

.toast-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toast-notification-message {
    font-size: 13px;
    font-weight: normal;
    line-height: 1.3;
    margin: 0;
}

/* Responsive styles */
@media (max-width: 768px) {
    /* Tabellenkopf ausblenden */
    .cart-table thead {
        display: none;
    }
    
    /* Tabellenzeilen als Karten darstellen */
    .cart-table tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 20px;
        padding: 15px;
        background-color: #f9f9f9;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    /* Tabellenzellen anpassen */
    .cart-table td {
        display: flex;
        padding: 8px 0;
        border-bottom: none;
        align-items: center;
    }
    
    /* Artikel-Zelle (erste Zelle) */
    .cart-table td:first-child {
        flex-direction: row;
        align-items: flex-start;
        width: 100%;
    }
    
    /* Artikeldetails */
    .cart-item-details {
        display: flex;
        align-items: flex-start;
        width: 100%;
        margin-top: 10px;
    }
    
    /* Artikelname */
    .cart-item-name {
        font-size: 16px;
        margin-bottom: 5px;
        width: 100%;
        word-break: break-word; /* Ermöglicht Zeilenumbrüche bei langen Wörtern */
    }
    
    /* Variante */
    .cart-item-variant {
        font-size: 14px;
        color: #666;
        margin-bottom: 5px;
        word-break: break-word; /* Ermöglicht Zeilenumbrüche bei langen Wörtern */
    }
    
    /* Vor jeder Zelle (außer der ersten) ein Label einfügen */
    .cart-table td:nth-child(2):before {
        content: "Preis: ";
        font-weight: bold;
        margin-right: 5px;
    }
    
    .cart-table td:nth-child(3):before {
        content: "Menge: ";
        font-weight: bold;
        margin-right: 5px;
    }
    
    .cart-table td:nth-child(4):before {
        content: "Gesamt: ";
        font-weight: bold;
        margin-right: 5px;
    }
    
    /* Mengen-Eingabe optimieren */
    .cart-item-quantity {
        margin-left: 5px;
    }
    
    /* Entfernen-Button rechts ausrichten */
    .cart-table td:last-child {
        justify-content: flex-end;
    }
    
    /* Zusammenfassung und Aktionen */
    .cart-summary {
        flex-direction: column;
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .cart-actions {
        margin-top: 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .cart-actions .button {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    /* Checkout-Container */
    .cart-container, .checkout-container {
        padding: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
}
