/**
 * Custom MemberSpace Styling for Theo's Web
 * ==========================================
 *
 * This stylesheet customizes MemberSpace modals and UI elements
 * to match the site's design (purple gradient theme).
 *
 * Include this file after MemberSpace script in your HTML:
 * <link rel="stylesheet" href="/css/memberspace-custom.css">
 */

/* ============================================================================
   MemberSpace Modal Styling
   ============================================================================ */

/* Modal Overlay */
.ms-modal-overlay {
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(5px);
}

/* Modal Container */
.ms-modal {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    max-width: 500px !important;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.ms-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 30px !important;
    border-radius: 20px 20px 0 0 !important;
}

.ms-modal-title {
    color: white !important;
    font-size: 1.8em !important;
    font-weight: 700 !important;
    margin: 0 !important;
}

/* Modal Body */
.ms-modal-body {
    padding: 40px !important;
    background: white !important;
}

/* Form Fields */
.ms-input,
.ms-input-field {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 14px 18px !important;
    font-size: 1em !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    box-sizing: border-box !important;
    color: #2c3e50 !important;
}

.ms-input:focus,
.ms-input-field:focus {
    border-color: #667eea !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.ms-input::placeholder {
    color: #adb5bd !important;
}

/* Labels */
.ms-label,
.ms-form-label {
    color: #2c3e50 !important;
    font-weight: 600 !important;
    font-size: 0.95em !important;
    margin-bottom: 8px !important;
    display: block !important;
}

/* Primary Buttons */
.ms-button-primary,
.ms-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 14px 32px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 1.05em !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    text-transform: none !important;
}

.ms-button-primary:hover,
.ms-btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4) !important;
}

.ms-button-primary:active,
.ms-btn-primary:active {
    transform: translateY(0) !important;
}

/* Secondary Buttons */
.ms-button-secondary,
.ms-btn-secondary {
    background: white !important;
    color: #667eea !important;
    border: 2px solid #667eea !important;
    padding: 12px 28px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.ms-button-secondary:hover,
.ms-btn-secondary:hover {
    background: #667eea !important;
    color: white !important;
}

/* Links */
.ms-link {
    color: #667eea !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: color 0.3s ease !important;
}

.ms-link:hover {
    color: #764ba2 !important;
    text-decoration: underline !important;
}

/* Error Messages */
.ms-error,
.ms-error-message {
    background: #f8d7da !important;
    color: #721c24 !important;
    padding: 12px 18px !important;
    border-radius: 8px !important;
    border-left: 4px solid #dc3545 !important;
    margin: 15px 0 !important;
    font-size: 0.95em !important;
}

/* Success Messages */
.ms-success,
.ms-success-message {
    background: #d4edda !important;
    color: #155724 !important;
    padding: 12px 18px !important;
    border-radius: 8px !important;
    border-left: 4px solid #28a745 !important;
    margin: 15px 0 !important;
    font-size: 0.95em !important;
}

/* Loading Spinner */
.ms-spinner,
.ms-loading {
    border: 3px solid #f3f3f3 !important;
    border-top: 3px solid #667eea !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Close Button */
.ms-close,
.ms-modal-close {
    color: white !important;
    opacity: 0.8 !important;
    font-size: 1.8em !important;
    transition: opacity 0.3s ease !important;
}

.ms-close:hover,
.ms-modal-close:hover {
    opacity: 1 !important;
}

/* ============================================================================
   Plan Selection Cards
   ============================================================================ */

.ms-plan-card {
    border: 2px solid #e9ecef !important;
    border-radius: 12px !important;
    padding: 25px !important;
    margin: 15px 0 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
}

.ms-plan-card:hover {
    border-color: #667eea !important;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15) !important;
    transform: translateY(-5px) !important;
}

.ms-plan-card.selected {
    border-color: #667eea !important;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%) !important;
}

.ms-plan-name {
    font-size: 1.3em !important;
    font-weight: 700 !important;
    color: #2c3e50 !important;
    margin-bottom: 10px !important;
}

.ms-plan-price {
    font-size: 2em !important;
    font-weight: 700 !important;
    color: #667eea !important;
    margin-bottom: 15px !important;
}

.ms-plan-price-currency {
    font-size: 0.6em !important;
    vertical-align: super !important;
}

.ms-plan-price-period {
    font-size: 0.5em !important;
    color: #6c757d !important;
    font-weight: 400 !important;
}

.ms-plan-features {
    list-style: none !important;
    padding: 0 !important;
    margin: 15px 0 !important;
}

.ms-plan-features li {
    padding: 8px 0 !important;
    color: #6c757d !important;
    font-size: 0.95em !important;
}

.ms-plan-features li:before {
    content: "✓ " !important;
    color: #28a745 !important;
    font-weight: bold !important;
    margin-right: 8px !important;
}

.ms-plan-badge {
    display: inline-block !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 4px 12px !important;
    border-radius: 15px !important;
    font-size: 0.75em !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* ============================================================================
   Member Portal Styling
   ============================================================================ */

.ms-portal {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 40px 20px !important;
}

.ms-portal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 40px !important;
    border-radius: 15px !important;
    margin-bottom: 30px !important;
}

.ms-portal-title {
    font-size: 2em !important;
    font-weight: 700 !important;
    margin: 0 0 10px 0 !important;
}

.ms-portal-subtitle {
    font-size: 1.1em !important;
    opacity: 0.95 !important;
    margin: 0 !important;
}

/* Subscription Status Badge */
.ms-status-active {
    background: #d4edda !important;
    color: #155724 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 0.85em !important;
    font-weight: 600 !important;
    display: inline-block !important;
}

.ms-status-trial {
    background: #fff3cd !important;
    color: #856404 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 0.85em !important;
    font-weight: 600 !important;
    display: inline-block !important;
}

.ms-status-cancelled {
    background: #f8d7da !important;
    color: #721c24 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 0.85em !important;
    font-weight: 600 !important;
    display: inline-block !important;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .ms-modal {
        max-width: 90% !important;
        margin: 20px !important;
    }

    .ms-modal-header,
    .ms-modal-body {
        padding: 25px !important;
    }

    .ms-modal-title {
        font-size: 1.5em !important;
    }

    .ms-plan-card {
        padding: 20px !important;
    }

    .ms-plan-price {
        font-size: 1.5em !important;
    }

    .ms-portal {
        padding: 20px 15px !important;
    }

    .ms-portal-header {
        padding: 30px 20px !important;
    }

    .ms-portal-title {
        font-size: 1.6em !important;
    }
}

@media (max-width: 480px) {
    .ms-modal {
        max-width: 95% !important;
        margin: 10px !important;
    }

    .ms-modal-header,
    .ms-modal-body {
        padding: 20px !important;
    }

    .ms-button-primary,
    .ms-btn-primary {
        padding: 12px 24px !important;
        font-size: 1em !important;
    }
}

/* ============================================================================
   Payment Form Styling (Stripe Elements)
   ============================================================================ */

.ms-payment-form {
    margin-top: 20px !important;
}

.ms-card-element,
.StripeElement {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 14px 18px !important;
    background: white !important;
    transition: all 0.3s ease !important;
    color: #2c3e50 !important;
}

.ms-card-element:focus,
.StripeElement--focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.ms-card-element.invalid,
.StripeElement--invalid {
    border-color: #dc3545 !important;
}

/* ============================================================================
   Locked Content Indicator
   ============================================================================ */

.ms-locked-content {
    position: relative !important;
    filter: blur(5px) !important;
    pointer-events: none !important;
    user-select: none !important;
}

.ms-locked-overlay {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    padding: 40px !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    text-align: center !important;
    z-index: 1000 !important;
    max-width: 500px !important;
}

.ms-locked-icon {
    font-size: 4em !important;
    margin-bottom: 20px !important;
}

.ms-locked-title {
    font-size: 2em !important;
    font-weight: 700 !important;
    color: #2c3e50 !important;
    margin: 0 0 15px 0 !important;
}

.ms-locked-message {
    color: #6c757d !important;
    font-size: 1.1em !important;
    margin: 0 0 25px 0 !important;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.ms-text-center {
    text-align: center !important;
}

.ms-mt-1 { margin-top: 10px !important; }
.ms-mt-2 { margin-top: 20px !important; }
.ms-mt-3 { margin-top: 30px !important; }

.ms-mb-1 { margin-bottom: 10px !important; }
.ms-mb-2 { margin-bottom: 20px !important; }
.ms-mb-3 { margin-bottom: 30px !important; }

.ms-p-1 { padding: 10px !important; }
.ms-p-2 { padding: 20px !important; }
.ms-p-3 { padding: 30px !important; }

/* ============================================================================
   Animations
   ============================================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ms-fade-in {
    animation: fadeIn 0.3s ease-out !important;
}

.ms-slide-in-up {
    animation: slideInUp 0.4s ease-out !important;
}

.ms-slide-in-right {
    animation: slideInRight 0.4s ease-out !important;
}

/* ============================================================================
   Dark Mode Support (Optional)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .ms-modal-body {
        background: #2c3e50 !important;
        color: #ecf0f1 !important;
    }

    .ms-input,
    .ms-input-field {
        background: #34495e !important;
        color: #ecf0f1 !important;
        border-color: #4a5f7f !important;
    }

    .ms-label,
    .ms-form-label {
        color: #ecf0f1 !important;
    }

    .ms-plan-card {
        background: #34495e !important;
        border-color: #4a5f7f !important;
    }

    .ms-plan-name {
        color: #ecf0f1 !important;
    }
}

/* ============================================================================
   Fix Duplicate MemberSpace Login Buttons
   ============================================================================ */

/* PROBLEM: MemberSpace's widgets.js sometimes creates duplicate "Members" buttons
   SOLUTION: Hide all duplicates except the first one

   This happens when MemberSpace detects multiple navigation areas
   and injects login buttons into each one. */

/* Method 1: Hide all MemberSpace login buttons except the FIRST one */
[data-ms-action="login"]:not(:first-of-type),
[data-ms-action="signup"]:not(:first-of-type),
.ms-login-button:not(:first-of-type),
.ms-signup-button:not(:first-of-type),
.ms-nav-item.ms-login:not(:first-of-type),
.ms-nav-item.ms-signup:not(:first-of-type) {
    display: none !important;
}

/* Method 2: Hide auto-injected floating widgets */
#ms-login-widget:not(:first-of-type),
#ms-member-widget:not(:first-of-type),
.ms-widget-container:not(:first-of-type),
[id^="ms-widget-"]:not(:first-of-type),
[class*="ms-floating"]:not(:first-of-type),
[data-memberspace-widget]:not(:first-of-type) {
    display: none !important;
}

/* Method 3: Hide duplicate buttons that contain "Members" text */
button:contains("Members"):not(:first-of-type),
a:contains("Members"):not(:first-of-type) {
    display: none !important;
}

/* Method 4: If buttons are in a container, hide duplicate containers */
.ms-member-container:not(:first-of-type),
.ms-login-container:not(:first-of-type) {
    display: none !important;
}

/* Show widgets ONLY on pricing and index pages if explicitly needed */
.pricing-page #ms-login-widget:first-of-type,
.pricing-page #ms-member-widget:first-of-type,
.index-page #ms-login-widget:first-of-type,
.index-page #ms-member-widget:first-of-type {
    display: block !important;
}

/* Alternative: If you want to keep the widgets but position them better */
/* Uncomment this section and comment out the "display: none" rules above
#ms-login-widget,
#ms-member-widget {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
}
*/

/* ============================================================================
   Custom Login Button (Optional - if you want your own styled button)
   ============================================================================ */

/* If you create your own login buttons, style them like this:
.custom-login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.custom-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
*/
