/* ============================================
   PRZYCISKI GUS - NOWOCZESNE STYLE
   ============================================ */

/* KLASYCZNY CHECKOUT - Przycisk .get_gus */
.get_gus {
    display: block !important;
    clear: both;
    margin-top: 12px;
    width: 100%;
    text-align: right;
}

/* Link przycisku dla klasycznego checkout */
a.open_gus {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

/* Efekt hover */
a.open_gus:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.35);
    background: linear-gradient(135deg, #5a67d8 0%, #6b42a0 100%);
}

/* Efekt active (kliknięcie) */
a.open_gus:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Animacja ładowania - kontener */
.ladowanie_danych {
    display: inline-block;
    vertical-align: middle;
    margin-left: 12px;
}

/* CSS Spinner - zamiast GIF */
.ladowanie_danych img {
    display: none; /* Ukryj stary GIF */
}

.ladowanie_danych::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gus-spinner 0.8s linear infinite;
}

/* Keyframe dla animacji spinner */
@keyframes gus-spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stan ładowania - przycisk pulsuje */
a.open_gus.loading {
    animation: gus-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes gus-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Efekt focus dla dostępności */
a.open_gus:focus {
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

/* Responsywność - mobile dla klasycznego checkout */
@media (max-width: 768px) {
    .get_gus {
        text-align: center;
        margin-top: 10px;
    }
    
    a.open_gus {
        display: block;
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .ladowanie_danych {
        display: block;
        text-align: center;
        margin-left: 0;
        margin-top: 8px;
    }
}

div#response {
    margin-top: 8px;
}

.optional {
    display: none;
}

/* Ukryj pole NIP domyślnie - TYLKO dla klasycznego checkoutu */
#gus_nip_value_field {
    display: none;
}

/* Dla WooCommerce Blocks - NIE stosujemy żadnych ukryć przez CSS */
/* Widoczność pola NIP jest kontrolowana przez React w index.js */
/* React sam decyduje czy pokazać pole NIP na podstawie stanu checkboxa */

/* ============================================
   BLOKOWY CHECKOUT - Przycisk .woogus-fetch-button
   ============================================ */

/* Kontener przycisku */
.woogus-fetch-button-container {
    margin-top: 12px;
    margin-bottom: 8px;
}

/* Przycisk dla blokowego checkout */
button.woogus-fetch-button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
    text-align: center;
}

/* Efekt hover */
button.woogus-fetch-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.35);
    background: linear-gradient(135deg, #5a67d8 0%, #6b42a0 100%);
}

/* Efekt focus (dostępność) */
button.woogus-fetch-button:focus {
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

/* Efekt active (kliknięcie) */
button.woogus-fetch-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Stan disabled */
button.woogus-fetch-button:disabled {
    background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

/* Stan ładowania - animacja pulsowania */
button.woogus-fetch-button.is-loading {
    animation: gus-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

/* Spinner wewnątrz przycisku podczas ładowania */
button.woogus-fetch-button.is-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gus-spinner 0.8s linear infinite;
    vertical-align: middle;
}

/* Responsywność - mobile */
@media (max-width: 768px) {
    button.woogus-fetch-button {
        padding: 16px 20px;
        font-size: 15px;
    }
    
    .woogus-fetch-button-container {
        margin-top: 10px;
    }
}

/* WooCommerce Blocks – sekcja GUS w głównym obszarze checkoutu */
.woogus-checkout-section {
    margin-bottom: 24px;
    padding: 0;
}

/* WooCommerce Blocks – kontener rozszerzenia GUS */
.woogus-blocks-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Nagłówek sekcji GUS */
.woogus-blocks-header {
    margin-bottom: 16px;
}

.woogus-blocks-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    padding: 0;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.woogus-blocks-description {
    margin: 8px 0 0 0;
    padding: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* WooCommerce Blocks – sekcja NIP z przyciskiem */
.woogus-blocks-nip-flex {
    gap: 12px;
    align-items: flex-end;
}

.woogus-blocks-nip-input {
    flex: 1;
    min-width: 0;
}

.woogus-blocks-nip-input .components-base-control__field {
    margin-bottom: 0;
}

.woogus-blocks-nip-input .components-text-control__input {
    width: 100%;
}

/* WooCommerce Blocks – przycisk pobierania danych */
.woogus-blocks-nip-actions {
    flex-shrink: 0;
}

.woogus-blocks-nip-actions .components-button {
    min-width: 140px;
    white-space: nowrap;
    height: 40px;
}

.woogus-blocks-spinner {
    margin-right: 6px;
}

.woogus-blocks-spinner-label {
    vertical-align: middle;
}

/* WooCommerce Blocks – komunikaty */
.woogus-blocks-notice {
    margin-top: 12px;
}

.woogus-blocks-notice .components-notice__content {
    margin: 0;
}

/* Responsywność dla urządzeń mobilnych */
@media (max-width: 768px) {
    .woogus-blocks-nip-flex {
        flex-direction: column;
        align-items: stretch;
    }
    
    .woogus-blocks-nip-actions {
        width: 100%;
    }
    
    .woogus-blocks-nip-actions .components-button {
        width: 100%;
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

/* Kontener dla wszystkich toastów */
.woogus-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    pointer-events: none;
}

/* Pojedynczy toast */
.woogus-toast {
    display: flex;
    align-items: center;
    min-width: 300px;
    max-width: 500px;
    margin-bottom: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Toast widoczny */
.woogus-toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Toast znikający */
.woogus-toast.hide {
    transform: translateX(400px);
    opacity: 0;
}

/* Ikona toasta */
.woogus-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Toast sukces */
.woogus-toast.success .woogus-toast-icon {
    background: #10b981;
    color: #ffffff;
}

.woogus-toast.success {
    border-left: 4px solid #10b981;
}

/* Toast błąd */
.woogus-toast.error .woogus-toast-icon {
    background: #ef4444;
    color: #ffffff;
}

.woogus-toast.error {
    border-left: 4px solid #ef4444;
}

/* Toast info */
.woogus-toast.info .woogus-toast-icon {
    background: #3b82f6;
    color: #ffffff;
}

.woogus-toast.info {
    border-left: 4px solid #3b82f6;
}

/* Toast ostrzeżenie */
.woogus-toast.warning .woogus-toast-icon {
    background: #f59e0b;
    color: #ffffff;
}

.woogus-toast.warning {
    border-left: 4px solid #f59e0b;
}

/* Treść toasta */
.woogus-toast-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

/* Tytuł toasta */
.woogus-toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #1f2937;
}

/* Wiadomość toasta */
.woogus-toast-message {
    font-size: 13px;
    color: #6b7280;
}

/* Przycisk zamknięcia */
.woogus-toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-left: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.woogus-toast-close:hover {
    color: #374151;
}

/* Progress bar */
.woogus-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    transition: width linear;
}

.woogus-toast.success .woogus-toast-progress {
    color: #10b981;
}

.woogus-toast.error .woogus-toast-progress {
    color: #ef4444;
}

.woogus-toast.info .woogus-toast-progress {
    color: #3b82f6;
}

.woogus-toast.warning .woogus-toast-progress {
    color: #f59e0b;
}

/* Responsywność mobile */
@media (max-width: 768px) {
    .woogus-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .woogus-toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

/* Ikony SVG (inline) */
.woogus-toast-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

