/**
 * Cart Page Styles
 * AMEYZE Shop - Warenkorb-Seite mit Card-Design
 * 
 * Farbpalette:
 * - Primary: #7f4d5a
 * - Secondary: #d8a9b4  
 * - Light: #fff9f9
 * - Background: #ffffff
 */

/* Page Title */
.cart-page-section .page-title {
    color: #7f4d5a;
    font-weight: 600;
    margin-bottom: 2rem;
}

.cart-page-section .page-title i {
    color: #d8a9b4;
}

/* Debug Info (nur im Debug-Modus sichtbar) */
.cart-debug-info {
    background-color: #fff9f9;
    border: 1px solid #d8a9b4;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #666;
}

/* Unavailable Items Alert */
#unavailable-alert {
    background-color: #fff9f9;
    border-color: #d8a9b4;
    color: #7f4d5a;
}

#unavailable-alert .alert-heading {
    color: #7f4d5a;
    font-size: 1.125rem;
}

#unavailable-alert .btn-warning {
    background-color: #d8a9b4;
    border-color: #d8a9b4;
    color: #fff;
}

#unavailable-alert .btn-warning:hover {
    background-color: #7f4d5a;
    border-color: #7f4d5a;
}

/* Unavailable Items Section */
.unavailable-items-section {
    background-color: #fff9f9;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.unavailable-items-section h5 {
    color: #7f4d5a;
    font-weight: 600;
}

.unavailable-item-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    padding: 1rem;
    opacity: 0.7;
}

.unavailable-item-card .badge {
    background-color: #d8a9b4;
}

/* Old Cart Item Cards - Keep for backwards compatibility */
.cart-item-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.cart-item-card:hover {
    box-shadow: 0 4px 12px rgba(127, 77, 90, 0.08);
    border-color: #d8a9b4;
}

/* Remove Button - New Card Layout */
.cart-product-card .btn-remove-cart {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(127, 77, 90, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #7f4d5a;
}

.cart-product-card .btn-remove-cart i {
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-product-card .btn-remove-cart:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
    transform: translateY(-2px);
}

@media (max-width: 576px) {
    .cart-product-card .btn-remove-cart {
        width: 32px;
        height: 32px;
        top: 0.625rem;
        left: 0.625rem;
    }

    .cart-product-card .btn-remove-cart i {
        font-size: 0.95rem;
    }
}

@media (min-width: 576px) {
    .cart-product-card .btn-remove-cart {
        width: 36px;
        height: 36px;
        top: 12px;
        left: 12px;
    }

    .cart-product-card .btn-remove-cart i {
        font-size: 1.1rem;
    }
}

.cart-product-card .quantity-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.cart-product-card .quantity-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: #6c757d;
    text-transform: uppercase;
    text-align: center;
}

.cart-product-card .quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 0;
    max-width: 140px;
    margin: 0;
}

.cart-product-card .quantity-wrapper .quantity-controls {
    align-self: center;
}

.cart-product-card .quantity-controls .btn {
    border-radius: 8px;
    padding: 0.28rem 0.55rem;
}

.cart-product-card .quantity-controls .btn:first-child {
    border-radius: 8px 0 0 8px;
}

.cart-product-card .quantity-controls .btn:last-child {
    border-radius: 0 8px 8px 0;
}

.cart-product-card .quantity-controls .quantity-input {
    border-radius: 0;
    text-align: center;
    width: 54px;
    border-left: 0;
    border-right: 0;
    font-size: 0.88rem;
    padding: 0.28rem 0.4rem;
    -moz-appearance: textfield;
}

.cart-product-card .quantity-controls .quantity-input::-webkit-outer-spin-button,
.cart-product-card .quantity-controls .quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-product-card .quantity-subtotal {
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}


/* Old Cart Item Image - Keep for backwards compatibility */
.cart-item-image-container {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
}

.cart-item-placeholder i {
    font-size: 2rem;
    color: #dee2e6;
}

/* Small image for unavailable items */
.unavailable-item-card .cart-item-image {
    width: 50px;
    height: 50px;
}

.unavailable-item-card .cart-item-placeholder {
    width: 50px;
    height: 50px;
}

/* Cart Item Title */
.cart-item-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cart-item-title a {
    color: #333;
    transition: color 0.3s ease;
}

.cart-item-title a:hover {
    color: #7f4d5a;
}

/* Cart Item Attributes */
.cart-item-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.attribute-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: #fff9f9;
    border: 1px solid #d8a9b4;
    border-radius: 20px;
    font-size: 0.875rem;
}

.attribute-name {
    color: #666;
    margin-right: 0.25rem;
}

.attribute-value {
    color: #7f4d5a;
    font-weight: 500;
}

/* Cart Item Price */
.cart-item-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-label {
    color: #666;
    font-size: 0.875rem;
}

.price-value {
    color: #333;
    font-weight: 600;
    font-size: 1.125rem;
}

/* Quantity Controls */
.quantity-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d8a9b4;
    border-radius: 25px;
    overflow: hidden;
    background: #fff;
}

.quantity-controls .btn {
    border: none;
    background: transparent;
    color: #7f4d5a;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.quantity-controls .btn:hover {
    background-color: #fff9f9;
}

.quantity-controls .quantity-input {
    border: none;
    text-align: center;
    width: 60px;
    font-weight: 600;
    color: #333;
    background: transparent;
    -moz-appearance: textfield;
}

.quantity-controls .quantity-input::-webkit-outer-spin-button,
.quantity-controls .quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-controls .quantity-input:focus {
    outline: none;
    box-shadow: none;
}

/* Remove old input-group styles */
.quantity-input-group {
    display: none;
}

/* Cart Item Subtotal */
.cart-item-subtotal {
    text-align: right;
}

.subtotal-label {
    color: #666;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.subtotal-value {
    color: #7f4d5a;
    font-weight: 700;
    font-size: 1.25rem;
}

/* Remove Button */
.btn-remove-item {
    color: #dc3545;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.btn-remove-item:hover {
    color: #a02530;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 50%;
}

/* Cart Summary Card */
.cart-summary-card {
    position: sticky;
    top: 100px; /* Erhöht um Platz für Header zu lassen */
    z-index: 10; /* Sicherstellen, dass es über anderen Elementen bleibt */
    margin-bottom: 2rem; /* Abstand nach unten */
}

/* Verhindere Überlappung mit Footer */
@supports (position: sticky) {
    .cart-summary-card {
        max-height: none;
        overflow: visible;
    }
}

.cart-summary-card .card {
    border: 2px solid #fff9f9;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    background-color: #ffffff; /* Expliziter Hintergrund */
}

.cart-summary-card .card-title {
    color: #7f4d5a;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Summary Rows */
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 0.95rem;
}

.summary-row span:first-child {
    color: #666;
}

.summary-row span:last-child {
    color: #333;
    font-weight: 500;
}

.summary-total {
    font-size: 1.125rem;
    font-weight: 600;
}

.summary-total span:first-child {
    color: #333;
}

.summary-total span:last-child {
    color: #7f4d5a;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Cart Action Buttons */
.cart-summary-card .btn-primary {
    background-color: #7f4d5a;
    border-color: #7f4d5a;
    font-weight: 600;
    padding: 0.75rem 2rem;
    font-size: 1.125rem;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.cart-summary-card .btn-primary:hover:not(:disabled) {
    background-color: #5a3640;
    border-color: #5a3640;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 77, 90, 0.25);
}

.cart-summary-card .btn-primary:disabled {
    background-color: #d8a9b4;
    border-color: #d8a9b4;
    opacity: 0.6;
}

.cart-summary-card .btn-outline-secondary {
    color: #7f4d5a;
    border-color: #d8a9b4;
    font-weight: 500;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.cart-summary-card .btn-outline-secondary:hover {
    background-color: #fff9f9;
    border-color: #7f4d5a;
    color: #7f4d5a;
}

/* Trust Badges */
.trust-badges {
    padding: 1rem;
    background: #fff9f9;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.trust-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.trust-badge i {
    font-size: 1.5rem;
    color: #7f4d5a;
}

.trust-badge small {
    color: #666;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.2;
}

/* Empty Cart */
.empty-cart-message {
    padding: 4rem 0;
}

.empty-cart-icon {
    font-size: 5rem;
    color: #d8a9b4;
    margin-bottom: 1.5rem;
}

.empty-cart-message h3 {
    color: #7f4d5a;
    font-weight: 600;
}

.empty-cart-message .text-muted {
    color: #999;
}

.empty-cart-message .btn-primary {
    background-color: #7f4d5a;
    border-color: #7f4d5a;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.empty-cart-message .btn-primary:hover {
    background-color: #5a3640;
    border-color: #5a3640;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 77, 90, 0.25);
}

/* Checkout Modal */
#checkoutModal .modal-content {
    border: none;
    border-radius: 0.75rem;
}

#checkoutModal .modal-header {
    background-color: #fff9f9;
    border-bottom: 2px solid #d8a9b4;
    border-radius: 0.75rem 0.75rem 0 0;
}

#checkoutModal .modal-title {
    color: #7f4d5a;
    font-weight: 600;
}

#checkoutModal .bi-tools {
    color: #d8a9b4;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .cart-summary-card {
        position: relative; /* Kein sticky auf kleineren Bildschirmen */
        top: auto;
        margin-top: 2rem;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .cart-item-card {
        padding: 1rem;
    }
    
    .cart-item-image-container {
        width: 80px;
        height: 80px;
    }
    
    .cart-item-title {
        font-size: 1rem;
    }
    
    .price-value {
        font-size: 1rem;
    }
    
    .subtotal-value {
        font-size: 1.125rem;
    }
    
    .quantity-controls {
        transform: scale(0.9);
    }
    
    .trust-badges {
        margin-top: 1rem;
    }
    
    .trust-badge small {
        font-size: 0.625rem;
    }
}

@media (max-width: 576px) {
    .cart-item-card .row {
        gap: 0;
    }
    
    .cart-item-image-container {
        width: 60px;
        height: 60px;
    }
    
    .cart-item-attributes {
        margin-bottom: 0.75rem;
    }
    
    .attribute-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .price-label,
    .subtotal-label {
        display: inline-block;
        margin-right: 0.5rem;
    }
    
    .cart-summary-card .btn {
        font-size: 1rem;
        padding: 0.625rem 1.5rem;
    }
}

/* Loading State */
.cart-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.cart-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7f4d5a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animations */
.cart-item-card {
    animation: fadeInUp 0.3s ease;
}

.cart-item-card.removing {
    animation: fadeOutLeft 0.3s ease;
    opacity: 0;
    transform: translateX(-20px);
}

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

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

.unavailable-item-card {
    animation: slideInLeft 0.5s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 0.7;
        transform: translateX(0);
    }
}

/* Tooltips */
[data-bs-toggle="tooltip"] {
    cursor: pointer;
}

/* Print Styles */
@media print {
    .btn,
    .btn-group,
    .alert,
    .cart-debug-info,
    .unavailable-items-section,
    .trust-badges {
        display: none;
    }
    
    .cart-item-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .cart-summary-card .card {
        box-shadow: none;
        border: 2px solid #333;
        page-break-inside: avoid;
    }
}

/* Cart Item Row - for backwards compatibility during transition */
.cart-item-row {
    display: none;
}
/* Visual feedback for automatic quantity adjustment */
.cart-product-card.quantity-adjusted {
    animation: pulse-highlight 0.5s ease-in-out;
    position: relative;
}

.cart-product-card.quantity-adjusted::after {
    content: '✓ Menge angepasst';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    animation: fadeInOut 2s ease-in-out;
    z-index: 10;
}

@keyframes pulse-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(127, 77, 90, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(127, 77, 90, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(127, 77, 90, 0);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    20% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Stock Warning Modal Styles - Responsiv */
#stockWarningModal .modal-dialog {
    max-width: 540px;
    margin: 1rem auto;
}

#stockWarningModal .modal-content {
    border-radius: 0.75rem;
    overflow: hidden;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
}

#stockWarningModal .modal-header {
    background: linear-gradient(135deg, #fff9f9 0%, #ffffff 100%);
    padding: 1rem 1.25rem;
    min-height: auto;
}

#stockWarningModal .modal-body {
    background-color: #ffffff;
    overflow-y: auto;
    max-height: calc(70vh - 120px);
    max-height: calc(70dvh - 120px);
    padding: 1rem 1.25rem;
}

#stockWarningModal .modal-footer {
    background-color: #f8f9fa;
    padding: 1rem 1.25rem;
    min-height: auto;
}

/* Details/Summary für Info-Text */
#stockWarningModal .stock-info-details summary {
    cursor: pointer;
    list-style: none;
}

#stockWarningModal .stock-info-details summary::-webkit-details-marker {
    display: none;
}

#stockWarningModal .stock-info-details[open] summary i::before {
    content: "\F282"; /* bi-chevron-down */
}

/* Stock-Warning Items */
#stockWarningModal .stock-warning-item {
    margin-bottom: 0.75rem;
}

#stockWarningModal .stock-warning-item:last-child {
    margin-bottom: 0;
}

#stockWarningModal .stock-warning-item .card {
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
}

#stockWarningModal .stock-warning-item .card-body {
    padding: 0.875rem;
}

#stockWarningModal .stock-warning-item h6 {
    color: #2c3e50;
    font-size: 0.9375rem;
    margin-bottom: 0;
}

#stockWarningModal .stock-warning-item img {
    width: 64px;
    height: 64px;
    border-radius: 0.375rem;
    object-fit: cover;
}

/* Stock arrow icon between quantities */
#stockWarningModal .stock-arrow-icon {
    font-size: 0.7rem;
}

/* Qty-Chips */
#stockWarningModal .qty-chip {
    background-color: #f8f9fa;
    border: 1px solid #edf0f2;
    border-radius: 0.375rem;
    padding: 0.35rem 0.6rem;
    min-width: 55px;
    font-size: 0.875rem;
    text-align: center;
}

#stockWarningModal .qty-chip strong {
    font-size: 0.9375rem;
}

#stockWarningModal .qty-chip .text-muted {
    font-size: 0.75rem;
}

/* Badges */
#stockWarningModal .badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    font-weight: 500;
}

#stockWarningModal .badge.bg-danger.bg-opacity-10 {
    background-color: rgba(220, 53, 69, 0.12) !important;
    color: #c1121f;
}

#stockWarningModal .badge.bg-success.bg-opacity-10 {
    background-color: rgba(25, 135, 84, 0.12) !important;
}

#stockWarningModal .badge.bg-warning {
    background-color: rgba(255, 193, 7, 0.9) !important;
}

/* Animation */
#stockWarningModal.show .modal-dialog {
    animation: dropIn 0.25s ease-out both;
}

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

/* Status wenn alle Artikel entfernt - Button wird versteckt */
#stockWarningModal.all-removed .modal-footer [data-action="proceed-checkout"] {
    display: none !important;
}

#stockWarningModal.all-removed .modal-footer [data-action="back-to-cart"] {
    flex-grow: 1;
}

/* Mobile-spezifische Anpassungen */
@media (max-width: 576px) {
    #stockWarningModal .modal-dialog {
        max-width: calc(100% - 1rem);
        margin: 0.5rem;
    }

    #stockWarningModal .modal-body {
        max-height: calc(70vh - 100px);
        max-height: calc(70dvh - 100px);
        padding: 0.875rem;
    }

    #stockWarningModal .modal-header {
        padding: 0.75rem;
    }

    #stockWarningModal .modal-footer {
        padding: 0.75rem;
    }

    #stockWarningModal .stock-warning-item .card-body {
        padding: 0.625rem;
    }

    #stockWarningModal .stock-warning-item img {
        width: 48px;
        height: 48px;
    }

    #stockWarningModal .stock-warning-item h6 {
        font-size: 0.8125rem;
    }

    #stockWarningModal .qty-chip {
        min-width: 48px;
        padding: 0.25rem 0.4rem;
        font-size: 0.8125rem;
    }

    #stockWarningModal .qty-chip strong {
        font-size: 0.875rem;
    }
}
