/**
 * Affiliate Form - Modern Modal Styles
 * Colors: #ff7200 (orange), white, black
 * Theme: Light
 */

/* ==========================================
   CSS Variables
   ========================================== */
:root {
    --aff-primary: #ff7200;
    --aff-primary-hover: #e56600;
    --aff-primary-light: rgba(255, 114, 0, 0.1);
    --aff-white: #ffffff;
    --aff-black: #1a1a1a;
    --aff-gray-50: #f9fafb;
    --aff-gray-100: #f3f4f6;
    --aff-gray-200: #e5e7eb;
    --aff-gray-300: #d1d5db;
    --aff-gray-400: #9ca3af;
    --aff-gray-500: #6b7280;
    --aff-gray-600: #4b5563;
    --aff-gray-700: #374151;
    --aff-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --aff-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --aff-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --aff-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --aff-radius: 12px;
    --aff-radius-lg: 16px;
    --aff-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   ID-Based Color Overrides (WordPress Protection)
   ========================================== */
#affModalOverlay {
    background: rgba(0, 0, 0, 0.5) !important;
}

#affModalContainer {
    background: #ffffff !important;
}

#affModalHeader {
    background: linear-gradient(135deg, #ff7200 0%, #e56600 100%) !important;
    border-bottom: 1px solid #e5e7eb !important;
}

#affModalTitle {
    color: #ffffff !important;
}

#affModalClose {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border: none !important;
}

#affModalClose:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

#affModalBody {
    background: #ffffff !important;
}

#affSectionTitleCompany,
#affSectionTitleContact,
#affSectionTitleQuestions {
    color: #ff7200 !important;
    border-bottom: 2px solid rgba(255, 114, 0, 0.1) !important;
}

#affModalFooter {
    background: #f9fafb !important;
    border-top: 1px solid #e5e7eb !important;
}

#affModalSubmit {
    background: linear-gradient(135deg, #ff7200 0%, #e56600 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(255, 114, 0, 0.3) !important;
}

#affModalSubmit:hover {
    box-shadow: 0 6px 20px rgba(255, 114, 0, 0.4) !important;
}

#affModalCancel {
    background: #ffffff !important;
    color: #374151 !important;
    border: 2px solid #e5e7eb !important;
}

#affModalCancel:hover {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
}

/* Form Input Color Overrides */
#affModalBody .aff-input,
#affModalBody .aff-textarea {
    color: #1a1a1a !important;
    background: #f9fafb !important;
    border: 2px solid #e5e7eb !important;
}

#affModalBody .aff-input:focus,
#affModalBody .aff-textarea:focus {
    border-color: #ff7200 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 114, 0, 0.1) !important;
}

#affModalBody .aff-form-group label {
    color: #374151 !important;
}

/* ==========================================
   Trigger Button (Default Style)
   ========================================== */
button.aff-form-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background-color: var(--aff-primary);
    background-image: linear-gradient(135deg, var(--aff-primary) 0%, var(--aff-primary-hover) 100%);
    color: var(--aff-white);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--aff-radius);
    cursor: pointer;
    transition: var(--aff-transition);
    box-shadow: 0 4px 14px rgba(255, 114, 0, 0.4);
    text-decoration: none;
    line-height: 1.4;
}

/* Elementor override support */
.elementor-widget-affiliate_form_button .aff-form-trigger-btn {
    background-image: none;
}

button.aff-form-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 114, 0, 0.5);
}

button.aff-form-trigger-btn:active {
    transform: translateY(0);
}

button.aff-form-trigger-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--aff-primary-light), 0 4px 14px rgba(255, 114, 0, 0.4);
}

/* Button Sizes - High Specificity (Padding only, Typography controls font-size) */
button.aff-form-trigger-btn.aff-btn-size-small {
    padding: 8px 16px !important;
}

button.aff-form-trigger-btn.aff-btn-size-medium {
    padding: 12px 24px !important;
}

button.aff-form-trigger-btn.aff-btn-size-large {
    padding: 16px 32px !important;
}

button.aff-form-trigger-btn.aff-btn-size-xlarge {
    padding: 20px 40px !important;
}

button.aff-form-trigger-btn.aff-btn-size-xxlarge {
    padding: 24px 48px !important;
}

button.aff-form-trigger-btn.aff-btn-size-xxxlarge {
    padding: 32px 64px !important;
}

/* ==========================================
   Modal Overlay
   ========================================== */
.aff-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: var(--aff-transition);
    padding: 20px;
    box-sizing: border-box;
}

.aff-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   Modal Container
   ========================================== */
.aff-modal {
    background: var(--aff-white);
    border-radius: var(--aff-radius-lg);
    box-shadow: var(--aff-shadow-xl);
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: var(--aff-transition);
    overflow: hidden;
}

.aff-modal-overlay.active .aff-modal {
    transform: scale(1) translateY(0);
}

/* ==========================================
   Modal Header
   ========================================== */
.aff-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--aff-primary) 0%, var(--aff-primary-hover) 100%);
    border-bottom: 1px solid var(--aff-gray-200);
}

.aff-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--aff-white);
    letter-spacing: 0.5px;
}

.aff-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--aff-white);
    cursor: pointer;
    transition: var(--aff-transition);
}

.aff-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.aff-modal-close svg {
    width: 20px;
    height: 20px;
}

/* ==========================================
   Modal Body
   ========================================== */
.aff-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Custom Scrollbar */
.aff-modal-body::-webkit-scrollbar {
    width: 6px;
}

.aff-modal-body::-webkit-scrollbar-track {
    background: var(--aff-gray-100);
    border-radius: 3px;
}

.aff-modal-body::-webkit-scrollbar-thumb {
    background: var(--aff-gray-300);
    border-radius: 3px;
}

.aff-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--aff-gray-400);
}

/* ==========================================
   Form Styles
   ========================================== */
.aff-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.aff-form-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aff-section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--aff-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--aff-primary-light);
}

.aff-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aff-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.aff-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--aff-gray-700);
}

.aff-input,
.aff-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--aff-black);
    background: var(--aff-gray-50);
    border: 2px solid var(--aff-gray-200);
    border-radius: var(--aff-radius);
    transition: var(--aff-transition);
    box-sizing: border-box;
}

.aff-input:hover,
.aff-textarea:hover {
    border-color: var(--aff-gray-300);
}

.aff-input:focus,
.aff-textarea:focus {
    outline: none;
    border-color: var(--aff-primary);
    background: var(--aff-white);
    box-shadow: 0 0 0 3px var(--aff-primary-light);
}

.aff-input::placeholder,
.aff-textarea::placeholder {
    color: var(--aff-gray-400);
}

.aff-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==========================================
   Modal Footer
   ========================================== */
.aff-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--aff-gray-50);
    border-top: 1px solid var(--aff-gray-200);
}

/* ==========================================
   Buttons
   ========================================== */
.aff-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--aff-radius);
    cursor: pointer;
    transition: var(--aff-transition);
}

.aff-btn-primary {
    background: linear-gradient(135deg, var(--aff-primary) 0%, var(--aff-primary-hover) 100%);
    color: var(--aff-white);
    box-shadow: 0 4px 14px rgba(255, 114, 0, 0.3);
}

.aff-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 114, 0, 0.4);
}

.aff-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.aff-btn-secondary {
    background: var(--aff-white);
    color: var(--aff-gray-700);
    border: 2px solid var(--aff-gray-200);
}

.aff-btn-secondary:hover {
    background: var(--aff-gray-100);
    border-color: var(--aff-gray-300);
}

/* Loading State */
.aff-btn-loading {
    position: relative;
    color: transparent !important;
}

.aff-btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: aff-spin 0.8s linear infinite;
}

@keyframes aff-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Success/Error Messages
   ========================================== */
.aff-message {
    padding: 16px 20px;
    border-radius: var(--aff-radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: aff-slideIn 0.3s ease-out;
}

@keyframes aff-slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aff-message-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.aff-message-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.aff-message-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* ==========================================
   Field Validation
   ========================================== */
.aff-input.aff-invalid,
.aff-textarea.aff-invalid {
    border-color: #dc2626;
    background: #fef2f2;
}

.aff-input.aff-invalid:focus,
.aff-textarea.aff-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.aff-field-error {
    font-size: 12px;
    color: #dc2626;
    margin-top: 4px;
}

/* ==========================================
   Responsive Design
   ========================================== */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .aff-modal {
        max-width: 1400px;
    }
}

/* Desktop (992px - 1399px) */
@media (max-width: 1399px) {
    .aff-modal {
        max-width: 90%;
    }
}

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
    .aff-modal {
        max-width: 95%;
    }
    
    .aff-modal-body {
        padding: 20px;
    }
    
    .aff-form-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* Mobile Landscape (576px - 767px) */
@media (max-width: 767px) {
    .aff-modal-overlay {
        padding: 15px;
    }
    
    .aff-modal {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .aff-modal-header {
        padding: 16px 20px;
    }
    
    .aff-modal-title {
        font-size: 16px;
    }
    
    .aff-form-row {
        grid-template-columns: 1fr;
    }
}

/* Mobile Portrait (max 575px) */
@media (max-width: 575px) {
    .aff-modal-overlay {
        padding: 10px;
    }
    
    .aff-modal {
        border-radius: var(--aff-radius);
    }
    
    .aff-modal-body {
        padding: 16px;
    }
    
    .aff-modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
        padding: 16px;
    }
    
    .aff-modal-footer .aff-btn {
        width: 100%;
    }
    
    .aff-input,
    .aff-textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .aff-section-title {
        font-size: 13px;
    }
    
    .aff-form-group label {
        font-size: 13px;
    }
}
