/**
 * WC Blocks Remove in Checkout - Styles
 * Dodaje style dla przycisków usuwania pozycji w Checkout Block
 */

/* Główny kontener */
.wcbric-remove-box {
    border-top: 1px solid var(--wp--preset--color--contrast-2, rgba(0, 0, 0, 0.06));
    padding-top: 16px;
    margin-top: 16px;
    background: #fff;
    border-radius: 4px;
}

.wcbric-remove-box .wc-block-components-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--wp--preset--color--contrast, #000);
}

/* Lista pozycji */
.wcbric-remove-list {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.wcbric-remove-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.wcbric-remove-item:last-child {
    border-bottom: none;
}

.wcbric-remove-item:hover {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding-left: 8px;
    padding-right: 8px;
}

/* Informacje o produkcie */
.wcbric-item-info {
    flex: 1;
    min-width: 0; /* Pozwala na skracanie długich nazw */
}

.wcbric-item-name {
    font-weight: 500;
    color: var(--wp--preset--color--contrast, #000);
    display: block;
    margin-bottom: 4px;
    word-wrap: break-word;
}

.wcbric-item-details {
    font-size: 0.9em;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Przycisk usuwania */
.wcbric-remove-btn {
    background: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.wcbric-remove-btn:hover {
    background: #c82333;
    border-color: #bd2130;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.wcbric-remove-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(220, 53, 69, 0.3);
}

.wcbric-remove-btn:disabled,
.wcbric-remove-btn.wcbric-removing {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.wcbric-remove-btn:disabled:hover,
.wcbric-remove-btn.wcbric-removing:hover {
    background: #6c757d;
    border-color: #6c757d;
    transform: none;
    box-shadow: none;
}

/* Animacja ładowania */
.wcbric-removing {
    position: relative;
}

.wcbric-removing::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: wcbric-spin 1s linear infinite;
}

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

/* Responsywność */
@media (max-width: 768px) {
    .wcbric-remove-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .wcbric-remove-btn {
        align-self: flex-end;
        width: 100%;
        max-width: 120px;
    }
    
    .wcbric-item-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wcbric-remove-box {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .wcbric-remove-item {
        border-color: #333;
    }
    
    .wcbric-remove-item:hover {
        background-color: #2a2a2a;
    }
    
    .wcbric-item-name {
        color: #fff;
    }
    
    .wcbric-item-details {
        color: #ccc;
    }
}

/* Integracja z WooCommerce Blocks */
.wc-block-checkout .wcbric-remove-box {
    margin-top: 24px;
}

.wc-block-cart .wcbric-remove-box {
    margin-top: 16px;
}

/* Dostępność */
.wcbric-remove-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.wcbric-remove-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Animacja pojawiania się */
.wcbric-remove-box {
    animation: wcbric-fadeIn 0.3s ease-in-out;
}

@keyframes wcbric-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Inline remove icons (X buttons next to product names) */
.wcbric-inline-container {
    display: inline-flex !important;
    align-items: center;
    margin-left: 8px;
}

.wcbric-remove-icon {
    background: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.wcbric-remove-icon:hover {
    background: #c82333;
    border-color: #bd2130;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.wcbric-remove-icon:active {
    transform: scale(0.95);
}

.wcbric-remove-icon:disabled,
.wcbric-remove-icon.wcbric-removing {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.wcbric-icon-x {
    display: block;
    line-height: 1;
}

/* Animacja ładowania dla ikon */
.wcbric-remove-icon.wcbric-removing .wcbric-icon-x {
    animation: wcbric-pulse 1s ease-in-out infinite;
}

@keyframes wcbric-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsywność dla ikon */
@media (max-width: 768px) {
    .wcbric-remove-icon {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
    
    .wcbric-inline-container {
        margin-left: 4px;
    }
}

/* Dark mode dla ikon */
@media (prefers-color-scheme: dark) {
    .wcbric-remove-icon {
        background: #bec929;
        border-color: #bec929;
    }
    
    .wcbric-remove-icon:hover {
        background: #c82333;
        border-color: #bd2130;
    }
    
    .wcbric-remove-icon:disabled,
    .wcbric-remove-icon.wcbric-removing {
        background: #6c757d;
        border-color: #6c757d;
    }
}
