/**
 * Jewish Museum Checkout Plugin Styles
 * Version: 2.0.0
 * Unified Checkout v2 Integration
 */

/* Checkout Container Styles */
.jmc-checkout-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    text-align: center;
}

/* Traditional Container Styles (CyberSource External Iframe) */
.jmc-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Embedded Container Styles */
.jmc-embedded-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* Loading indicator */
.jmc-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 40px;
    border-radius: 6px;
    font-size: 16px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.jmc-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #0066cc;
    border-radius: 50%;
    animation: jmc-spin 1s linear infinite;
}

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

/* Hide loading when iframe/checkout is loaded */
.jmc-container.loaded .jmc-loading,
.jmc-embedded-container.loaded .jmc-loading {
    display: none;
}

/* Iframe styles */
.jmc-iframe {
    display: block;
    width: 100%;
    min-height: 600px;
    border: none;
    background: white;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.jmc-container.loaded .jmc-iframe {
    opacity: 1;
}

/* Responsive iframe */
.jmc-iframe.jmc-responsive {
    max-width: 100%;
}

/* Checkout Button Styles */
.jmc-checkout-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 160px;
    line-height: 1.4;
}

/* Primary Button Style (Blue) */
.jmc-btn-primary {
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
}

.jmc-btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    color: white;
    text-decoration: none;
}

.jmc-btn-primary:focus {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

/* Secondary Button Style (Gray) */
.jmc-btn-secondary {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.jmc-btn-secondary:hover {
    background-color: #545b62;
    border-color: #545b62;
    color: white;
    text-decoration: none;
}

.jmc-btn-secondary:focus {
    outline: 2px solid #545b62;
    outline-offset: 2px;
}

/* Custom Button Style */
.jmc-btn-custom {
    /* Allow custom CSS to override */
    background-color: var(--jmc-button-bg, #28a745);
    color: var(--jmc-button-color, white);
    border: 1px solid var(--jmc-button-border, #28a745);
}

.jmc-btn-custom:hover {
    background-color: var(--jmc-button-hover-bg, #218838);
    border-color: var(--jmc-button-hover-border, #218838);
    color: var(--jmc-button-hover-color, white);
    text-decoration: none;
}

/* Loading State */
.jmc-checkout-btn.jmc-loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.jmc-checkout-btn.jmc-loading::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: jmc-spin 1s linear infinite;
}

/* Embedded Checkout Form */
.jmc-checkout-form {
    padding: 20px;
    background: white;
    border-radius: 6px;
    margin: 20px;
    min-height: 300px;
}

.jmc-checkout-form .payment-selection,
.jmc-checkout-form .payment-screen {
    min-height: 200px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 10px 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .jmc-container {
        margin: 15px 0;
        border-radius: 6px;
    }
    
    .jmc-iframe {
        min-height: 500px;
    }
    
    .jmc-loading {
        padding: 15px 30px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .jmc-container {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    .jmc-iframe {
        min-height: 450px;
    }
    
    .jmc-loading {
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* Error state */
.jmc-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 20px 0;
    text-align: center;
    font-size: 16px;
}

/* Success state (for future use) */
.jmc-success {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin: 20px 0;
    text-align: center;
    font-size: 16px;
}

/* Admin page styles */
.jmc-admin-page .form-table th {
    width: 200px;
}

.jmc-admin-page .card {
    max-width: none;
    margin-top: 20px;
}

.jmc-admin-page code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.jmc-admin-page ul {
    margin-left: 20px;
}

.jmc-admin-page ul li {
    margin-bottom: 5px;
}

/* Accessibility improvements */
.jmc-iframe:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .jmc-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .jmc-loading {
        display: none;
    }
    
    .jmc-iframe {
        opacity: 1;
        background: white;
    }
}
