/* ========================================
   CMF MEMBERSHIP FORM STYLES
   Unique namespace to prevent conflicts
   ======================================== */

/* CONFLICT PREVENTION - Unique CMF Container */
.cmf-container {
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

.cmf-form-wrapper {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.cmf-form {
    padding: 20px;
}

.cmf-section {
    margin-bottom: 30px;
}

.cmf-section-title {
    color: #1e4d8b;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-transform: uppercase;
}

/* CMF Amount display */
.cmf-amount-display {
    font-size: 24px;
    font-weight: 700;
    color: #1e4d8b;
    text-align: center;
    padding: 20px;
    background: #e8f4f8;
    border-radius: 8px;
    border: 2px solid #1e4d8b;
}

/* CMF Donation Section */
.cmf-donation-intro {
    text-align: left;
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
}

.cmf-donation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.cmf-donation-btn {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cmf-donation-btn:hover {
    background: #b71c1c;
}

.cmf-donation-btn.active {
    background: #1e4d8b;
    box-shadow: 0 2px 8px rgba(30, 77, 139, 0.3);
}

/* CMF Submit Button */
.cmf-submit-btn {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
}

.cmf-submit-btn:hover:not(:disabled) {
    background: #b71c1c;
}

.cmf-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Payment Step Amount Display - Add margin for separation */
#cmf-step-3 .cmf-amount-display {
    margin-bottom: 20px;
}

/* Enhanced Amount Breakdown */
.cmf-amount-breakdown {
    text-align: left;
}

.cmf-membership-fee {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.cmf-donation-fee {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.cmf-total-amount {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    border-top: 2px solid #ddd;
    padding-top: 8px;
    margin-top: 8px;
}

.cmf-transaction-id {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
    color: #666;
}

.cmf-transaction-id strong {
    color: #333;
}

/* Ensure Next button is hidden on final step */
.cmf-step-navigation .cmf-next-btn[style*="display: none"] {
    display: none !important;
}

/* Additional backup: Hide next button when on step 3 */
body[data-current-step="3"] .cmf-next-btn,
.cmf-container[data-current-step="3"] .cmf-next-btn {
    display: none !important;
}

/* CMF MLA Display */
.cmf-mla-display {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #1e4d8b;
    text-align: center;
    font-weight: 600;
    color: #1e4d8b;
}

.cmf-mla-display span {
    font-size: 18px;
    font-weight: 600;
    color: #1e4d8b;
}

/* CMF Messages styling */
#cmf-messages {
    margin: 15px 0;
    padding: 0;
}

.cmf-messages .error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #ef5350;
    margin-bottom: 10px;
}

.cmf-messages .success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #4caf50;
    margin-bottom: 10px;
}

.cmf-messages .loading-message {
    background: #e3f2fd;
    color: #1976d2;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #42a5f5;
    text-align: center;
    margin-bottom: 10px;
}

/* CMF Form sections */
.cmf-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cmf-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e4d8b;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* CMF Amount display */
.cmf-amount-display {
    font-size: 24px;
    font-weight: 700;
    color: #1e4d8b;
    text-align: center;
    padding: 20px;
    background: #e8f4f8;
    border-radius: 8px;
    border: 2px solid #1e4d8b;
}

/* CMF Donation Section */
.cmf-donation-intro {
    text-align: left;
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
}

.cmf-donation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.cmf-donation-btn {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cmf-donation-btn:hover {
    background: #b71c1c;
}

.cmf-donation-btn.active {
    background: #b71c1c;
}

.cmf-donation-btn[data-amount="other"] {
    background: #1e4d8b;
}

.cmf-donation-btn[data-amount="other"]:hover,
.cmf-donation-btn[data-amount="other"].active {
    background: #0d3568;
}

/* Custom Amount Input */
.cmf-custom-amount {
    margin: 15px 0;
}

.cmf-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.cmf-currency-symbol {
    position: absolute;
    left: 12px;
    color: #666;
    font-size: 16px;
    z-index: 1;
}

.cmf-input-group input {
    padding-left: 30px;
}

/* Tax Credit Display */
.cmf-tax-credit-display {
    margin-top: 15px;
    padding: 12px 16px;
    background-color: #f0f8f0;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    font-size: 14px;
    color: #2d5016;
    text-align: center;
    font-weight: 500;
}

/* No Donation Option */
.cmf-no-donation-option {
    margin-top: 20px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.cmf-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    margin: 0;
}

.cmf-checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1e4d8b;
}

.cmf-checkbox-text {
    font-weight: 500;
    user-select: none;
}

/* Form Layout */
.cmf-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.cmf-col-half {
    flex: 1;
}

.cmf-col-full {
    flex: 1;
}

.cmf-col-third {
    flex: 1;
}

/* Form Inputs */
label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.cmf-address-label {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

input:focus,
select:focus {
    outline: none;
    border-color: #1e4d8b;
    box-shadow: 0 0 0 2px rgba(30, 77, 139, 0.1);
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Payment Section */
.cmf-payment-section {
    margin-bottom: 20px;
}

.cmf-payment-element {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    margin-top: 10px;
}

.cmf-disclaimer {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

/* Messages */
.cmf-messages {
    margin-top: 20px;
}

.cmf-message {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.cmf-message.error {
    background: #fee;
    color: #c53030;
    border: 1px solid #fed7d7;
}

.cmf-message.success {
    background: #f0fff4;
    color: #38a169;
    border: 1px solid #c6f6d5;
}

.cmf-message.info {
    background: #ebf8ff;
    color: #3182ce;
    border: 1px solid #bee3f8;
}

/* Loading States */
.cmf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.cmf-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
}

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

/* Success message styling */
.success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #4caf50;
    text-align: center;
    margin: 20px 0;
}

.success-message h3 {
    color: #1b5e20;
    margin-bottom: 15px;
    font-size: 24px;
}

.success-message p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.5;
}

/* Responsive design */
@media (max-width: 768px) {
    .cmf-container {
        padding: 15px;
        margin: 10px;
    }
    
    .cmf-col-half,
    .cmf-col-third {
        flex: 1 1 100%;
    }
    
    .cmf-row {
        gap: 10px;
    }
    
    .cmf-amount-display {
        font-size: 20px;
        padding: 15px;
    }
    
    .cmf-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .cmf-donation-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .cmf-donation-btn {
        padding: 10px;
        font-size: 14px;
    }
}

/* Step Indicators */
.cmf-step-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    gap: 20px;
}

.cmf-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px;
    border-radius: 8px;
}

.cmf-step-indicator:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
}

.cmf-step-indicator.active {
    background-color: #f3f8ff;
}

.cmf-step-indicator.completed {
    background-color: #f0f4ff;
}

.cmf-step-indicator.active .cmf-step-number {
    background-color: #0d47a1;
    color: white;
    border-color: #0d47a1;
    box-shadow: 0 2px 8px rgba(13, 71, 161, 0.3);
}

.cmf-step-indicator.completed .cmf-step-number {
    background-color: #1976d2;
    color: white;
    border-color: #1976d2;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.cmf-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #1976d2;
    background-color: #1976d2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
}

.cmf-step-label {
    font-size: 14px;
    color: #1976d2;
    font-weight: 500;
    text-align: center;
}

.cmf-step-indicator.active .cmf-step-label {
    color: #0d47a1;
    font-weight: 600;
}

.cmf-step-indicator.completed .cmf-step-label {
    color: #1976d2;
    font-weight: 600;
}

/* Step Containers */
.cmf-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.cmf-step.active {
    display: block;
}

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

/* Step Navigation */
.cmf-step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0;
    padding: 20px 0;
    border-top: 1px solid #eee;
}

.cmf-nav-btn {
    padding: 12px 24px;
    border: 2px solid #d32f2f;
    background-color: white;
    color: #d32f2f;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.cmf-nav-btn:hover {
    background-color: #d32f2f;
    color: white;
}

.cmf-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
    color: #999;
    border-color: #ddd;
}

.cmf-nav-btn:disabled:hover {
    background-color: #f5f5f5;
    color: #999;
}

/* Mobile Responsiveness for Steps */
@media (max-width: 768px) {
    .cmf-step-indicators {
        gap: 15px;
        margin: 20px 0;
    }
    
    .cmf-step-number {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .cmf-step-label {
        font-size: 12px;
    }
    
    .cmf-step-navigation {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0;
    }
    
    .cmf-nav-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .cmf-step {
        margin: 0 10px;
    }
}

@media (max-width: 480px) {
    .cmf-step-indicators {
        gap: 10px;
    }
    
    .cmf-step-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .cmf-step-label {
        font-size: 11px;
    }
    
    .cmf-step-navigation {
        margin: 15px 0;
        padding: 15px 0;
    }
    
    .cmf-nav-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Conflict detection styles */
.cmf-conflict-warning {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #d32f2f;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Plugin-specific debug info */
.cmf-debug-info {
    background: #f3e5f5;
    border: 1px solid #9c27b0;
    color: #7b1fa2;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 15px;
    font-family: monospace;
}

/* Ensure CMF elements have higher specificity than generic payment forms */
.cmf-container .cmf-form .cmf-section .cmf-payment-section #payment-element {
    position: relative;
    z-index: 1;
}

.cmf-container .cmf-form #cmf-submit-btn {
    position: relative;
    z-index: 1;
}
