/**
 * Bluefin Payment Gateway - Clean Professional Styles
 *
 * @version 2.0.0
 */

/* ========================================
   Payment Form Container
   ======================================== */
#wc-bluefin-cc-form {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

#bluefin-direct-form {
    background: #ffffff !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 24px !important;
    margin: 0 !important;
}

/* ========================================
   Test Mode Notice
   ======================================== */
.bluefin-test-notice {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #7d6608;
    line-height: 1.6;
}

.bluefin-test-notice strong {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

/* ========================================
   Fallback Warning
   ======================================== */
#bluefin-direct-form > p:first-of-type {
    background: #fff3cd !important;
    border: 1px solid #ffc107 !important;
    border-left: 4px solid #ffc107 !important;
    border-radius: 4px !important;
    padding: 12px 16px !important;
    margin-bottom: 20px !important;
    font-size: 13px !important;
    color: #856404 !important;
    line-height: 1.5 !important;
}

/* ========================================
   Form Labels
   ======================================== */
#bluefin-direct-form label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 6px;
}

#bluefin-direct-form .required {
    color: #e53935;
}

/* ========================================
   Input Fields - Clean & Professional
   ======================================== */
#bluefin-direct-form .input-text {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    background: #ffffff !important;
    background-repeat: no-repeat !important;
    color: #1f2937 !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

#bluefin-direct-form .input-text:hover {
    border-color: #9ca3af !important;
}

#bluefin-direct-form .input-text:focus {
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

#bluefin-direct-form .input-text::placeholder {
    color: #9ca3af;
    opacity: 1;
}

/* Card Number Field - Monospace for better readability */
#bluefin_card_number {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace !important;
    letter-spacing: 0.5px !important;
    padding-right: 50px !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 10px) center !important;
    background-size: 32px 20px !important;
}

/* ========================================
   Card Brand Icons (SVG inline)
   ======================================== */
#bluefin_card_number.card-visa {
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"%3E%3Crect width="32" height="20" rx="3" fill="%231434CB"/%3E%3Ctext x="6" y="14" fill="white" font-family="Arial Black" font-size="8" font-weight="bold"%3EVISA%3C/text%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 10px) center !important;
    background-size: 32px 20px !important;
}

#bluefin_card_number.card-mastercard {
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"%3E%3Crect width="32" height="20" rx="3" fill="%23EB001B"/%3E%3Ccircle cx="12" cy="10" r="6" fill="%23FF5F00" opacity="0.8"/%3E%3Ccircle cx="20" cy="10" r="6" fill="%23F79E1B"/%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 10px) center !important;
    background-size: 32px 20px !important;
}

#bluefin_card_number.card-amex {
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"%3E%3Crect width="32" height="20" rx="3" fill="%23006FCF"/%3E%3Ctext x="4" y="14" fill="white" font-family="Arial" font-size="7" font-weight="bold"%3EAMEX%3C/text%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 10px) center !important;
    background-size: 32px 20px !important;
}

#bluefin_card_number.card-discover {
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="32" height="20" viewBox="0 0 32 20"%3E%3Crect width="32" height="20" rx="3" fill="%23FF6000"/%3E%3Ccircle cx="24" cy="10" r="7" fill="%23FFA500"/%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 10px) center !important;
    background-size: 32px 20px !important;
}

/* ========================================
   Input Validation States
   ======================================== */
#bluefin-direct-form .input-text.valid {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
    padding-right: 40px !important;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2310b981" stroke-width="3"%3E%3Cpolyline points="20 6 9 17 4 12"/%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 12px) center !important;
    background-size: 16px !important;
}

#bluefin_card_number.valid {
    padding-right: 60px !important;
    background-repeat: no-repeat, no-repeat !important;
    background-position: calc(100% - 12px) center, calc(100% - 40px) center !important;
    background-size: 16px, 32px 20px !important;
}

#bluefin-direct-form .input-text.invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* ========================================
   Two Column Layout for Expiry & CVV
   ======================================== */
#bluefin-direct-form > div[style*="flex"] {
    display: flex !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
}

#bluefin-direct-form > div[style*="flex"] > p {
    flex: 1 !important;
    margin: 0 !important;
    min-width: 0 !important;
}

#bluefin-direct-form > p {
    margin-bottom: 16px !important;
}

/* ========================================
   Secure Badge - Clean Design
   ======================================== */
#bluefin-direct-form > p:last-of-type {
    background: #f0fdf4 !important;
    border: 1px solid #86efac !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
    margin-top: 20px !important;
    margin-bottom: 0 !important;
    font-size: 12px !important;
    color: #166534 !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

#bluefin-direct-form > p:last-of-type::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%23166534" stroke-width="2"%3E%3Crect x="5" y="11" width="14" height="10" rx="2"/%3E%3Cpath d="M7 11V7a5 5 0 0 1 10 0v4"/%3E%3C/svg%3E');
    background-size: contain;
    flex-shrink: 0;
}

/* ========================================
   Error Messages
   ======================================== */
#bluefin-card-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    padding: 12px 16px;
    margin-top: 16px;
    border-radius: 6px;
    display: none;
    font-size: 13px;
    line-height: 1.5;
}

#bluefin-card-errors strong {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* ========================================
   iFrame Container
   ======================================== */
#bluefin-iframe-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    min-height: 200px;
    margin: 20px 0;
}

#bluefin-payment-iframe {
    width: 100%;
    min-height: 180px;
}

#bluefin-payment-iframe iframe {
    border: none;
    width: 100%;
    min-height: 180px;
    border-radius: 4px;
}

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

.wc-bluefin-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: bluefin-spin 0.6s linear infinite;
}

@keyframes bluefin-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Responsive Design
   ======================================== */
@media screen and (max-width: 768px) {
    #bluefin-direct-form {
        padding: 20px !important;
    }

    #bluefin-direct-form .input-text {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    #bluefin-direct-form > div[style*="flex"] {
        flex-direction: column !important;
        gap: 0 !important;
    }

    #bluefin-direct-form > div[style*="flex"] > p {
        margin-bottom: 16px !important;
    }

    #bluefin-direct-form > div[style*="flex"] > p:last-child {
        margin-bottom: 0 !important;
    }
}

/* ========================================
   Payment Method
   ======================================== */
.payment_method_bluefin .payment_box {
    background: transparent;
    padding: 0;
    margin: 0;
}

.payment_method_bluefin .payment_box p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Accessibility
   ======================================== */
#bluefin-direct-form .input-text:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    #wc-bluefin-cc-form,
    #bluefin-iframe-container,
    .bluefin-test-notice {
        display: none !important;
    }
}

/* ========================================
   Fix Overflow Issues
   ======================================== */
#bluefin-direct-form,
#bluefin-direct-form *,
#bluefin-direct-form *::before,
#bluefin-direct-form *::after {
    box-sizing: border-box !important;
}

#bluefin-direct-form > p,
#bluefin-direct-form > div {
    max-width: 100% !important;
    overflow: hidden !important;
}
