/**
 * Saltwater Slam Payments - Frontend Styles
 */

/* Payment Container */
.swsp-payment-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Main Payment Button */
.swsp-main-button {
    display: inline-block;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #1a3a5c;
    background: #ffffff;
    border: 2px solid #1a3a5c;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.swsp-main-button:hover {
    background: #1a3a5c;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.swsp-main-button:active {
    transform: translateY(0);
}

/* Error Message */
.swsp-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* Field-specific inline errors */
.swsp-field-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.swsp-field-error::before {
    content: '⚠';
    font-size: 12px;
}

.swsp-form-group.has-error input {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Modal Styles */
.swsp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.swsp-modal {
    background: #ffffff;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: swspModalIn 0.3s ease;
}

@keyframes swspModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.swsp-modal-header {
    background: #1a3a5c;
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.swsp-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.swsp-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.swsp-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.swsp-modal-body {
    padding: 24px;
}

/* Payment Amount Display */
.swsp-payment-amount {
    background: #f5f7fa;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: center;
}

.swsp-amount-label {
    font-size: 14px;
    color: #64748b;
    display: block;
    margin-bottom: 4px;
}

.swsp-amount-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a3a5c;
}

/* Form Styles */
.swsp-payment-form {
    margin-bottom: 20px;
}

.swsp-form-group {
    margin-bottom: 16px;
}

.swsp-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 6px;
}

.swsp-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.swsp-form-group input:focus {
    outline: none;
    border-color: #1a3a5c;
    box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.1);
}

.swsp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Payment Methods */
.swsp-payment-methods {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.swsp-methods-label {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 16px;
}

/* Wallet Buttons */
.swsp-wallet-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swsp-wallet-btn svg {
    flex-shrink: 0;
}

/* Apple Pay Button */
.swsp-apple-pay {
    background: #000000;
    color: #ffffff;
}

.swsp-apple-pay:hover {
    background: #333333;
}

/* Google Pay Button */
.swsp-google-pay {
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
}

.swsp-google-pay:hover {
    background: #f8f9fa;
}

/* Card Pay Button */
.swsp-card-pay {
    background: #1a3a5c;
    color: #ffffff;
}

.swsp-card-pay:hover {
    background: #0f2338;
}

/* Card Form */
.swsp-card-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.swsp-card-form h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #1e293b;
}

/* Card Number Input with Type Indicator */
.swsp-card-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.swsp-card-input-wrapper input {
    width: 100%;
    padding-right: 80px; /* Space for card type badge */
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.swsp-card-type {
    position: absolute;
    right: 12px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e2e8f0;
    color: #475569;
}

/* Card Type Specific Styles */
.swsp-card-type.swsp-card-visa {
    background: #1a1f71;
    color: #ffffff;
}

.swsp-card-type.swsp-card-mastercard {
    background: #eb001b;
    color: #ffffff;
}

.swsp-card-type.swsp-card-amex {
    background: #016fd0;
    color: #ffffff;
}

.swsp-card-type.swsp-card-discover {
    background: #ff6000;
    color: #ffffff;
}

/* Mobile responsive styles for card type badge */
@media (max-width: 480px) {
    .swsp-card-input-wrapper input {
        padding-right: 90px; /* More space for card type badge on mobile */
        font-size: 14px; /* Slightly smaller font to fit better */
    }

    .swsp-card-type {
        right: 8px;
        font-size: 10px; /* Smaller badge text */
        padding: 3px 6px;
        max-width: 80px; /* Limit badge width */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .swsp-card-input-wrapper input {
        padding-right: 85px;
    }

    .swsp-card-type {
        font-size: 9px;
        padding: 2px 4px;
    }
}

.swsp-submit-card-btn {
    width: 100%;
    padding: 14px 20px;
    background: #16a34a;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 12px;
}

.swsp-submit-card-btn:hover {
    background: #15803d;
}

.swsp-cancel-btn {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.swsp-cancel-btn:hover {
    background: #f1f5f9;
    color: #475569;
}

/* Payment Result Messages */
.swsp-payment-result {
    margin-top: 20px;
    padding: 16px;
    border-radius: 6px;
    font-size: 15px;
    text-align: center;
}

.swsp-payment-result.swsp-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.swsp-payment-result.swsp-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.swsp-payment-result.swsp-loading {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.swsp-error-message::before {
    content: '⚠ ';
}

.swsp-success-message::before {
    content: '✓ ';
}

.swsp-loading-message::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #cbd5e1;
    border-top-color: #1a3a5c;
    border-radius: 50%;
    animation: swsp-spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 480px) {
    .swsp-modal {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .swsp-modal-body {
        padding: 16px;
    }

    .swsp-form-row {
        grid-template-columns: 1fr;
    }

    .swsp-amount-value {
        font-size: 28px;
    }

    .swsp-wallet-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Accessibility */
.swsp-wallet-btn:focus,
.swsp-main-button:focus,
.swsp-close-btn:focus,
.swsp-form-group input:focus {
    outline: 2px solid #1a3a5c;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .swsp-main-button {
        border-width: 3px;
    }

    .swsp-modal-header {
        border-bottom: 3px solid #ffffff;
    }
}

/* Button Spinner */
.swsp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: swsp-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .swsp-main-button,
    .swsp-wallet-btn,
    .swsp-close-btn,
    .swsp-submit-card-btn,
    .swsp-cancel-btn {
        transition: none;
    }

    .swsp-modal {
        animation: none;
    }

    .swsp-loading-message::after,
    .swsp-spinner {
        animation: none;
        border-top-color: #cbd5e1;
    }
}
