/* DC Referral Tracker Frontend Styles */

/* Apply IRANYekanX font to ALL plugin elements - High Priority */
#dc_referral_field_wrapper,
#dc_referral_field_wrapper *,
.dc-referral-shortcode-wrapper,
.dc-referral-shortcode-wrapper *,
.dc-field-wrapper,
.dc-field-wrapper *,
.dc-other-field,
.dc-other-field *,
.dc-style-card,
.dc-style-card *,
.dc-style-minimal,
.dc-style-minimal *,
select[name="how_did_you_hear"],
input[name="how_did_you_hear_other"],
label[for="how_did_you_hear"],
.form-row-wide label,
.form-row-wide select,
.form-row-wide input {
    font-family: 'IRANYekanX', sans-serif !important;
}

/* Force font on WooCommerce form elements */
.woocommerce .form-row select,
.woocommerce .form-row input,
.woocommerce .form-row label,
.woocommerce #dc_referral_field_wrapper select,
.woocommerce #dc_referral_field_wrapper input,
.woocommerce #dc_referral_field_wrapper label,
.woocommerce .dc-referral-shortcode-wrapper select,
.woocommerce .dc-referral-shortcode-wrapper input,
.woocommerce .dc-referral-shortcode-wrapper label {
    font-family: 'IRANYekanX', sans-serif !important;
}

/* Force native emoji rendering and prevent Twemoji conversion */
.dc-field-icon,
.dc-card-title,
.dc-with-icons .dc-shortcode-select::before,
.dc-referral-shortcode-wrapper h1,
.dc-referral-shortcode-wrapper h2,
.dc-referral-shortcode-wrapper h3 {
    /* Font-family removed to allow custom fonts */
}

/* Prevent Twemoji image replacement */
.dc-field-icon img.emoji,
.dc-card-title img.emoji,
.dc-referral-shortcode-wrapper img.emoji {
    display: none !important;
}

/* Ensure emoji elements use text rendering */
.dc-field-icon,
.dc-card-title::before,
.dc-with-icons .dc-shortcode-select::before {
    text-rendering: auto !important;
    -webkit-font-feature-settings: "liga" off !important;
    font-feature-settings: "liga" off !important;
}

/* Enhanced select field styling - Strong override for WooCommerce */
select[name="how_did_you_hear"], 
.dc-enhanced-select,
#how_did_you_hear {
    border: 2px solid #e1e5e9 !important;
    border-radius: 8px !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    background: white !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 50px !important;
    height: auto !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

select[name="how_did_you_hear"]:focus,
.dc-enhanced-select:focus,
#how_did_you_hear:focus {
    outline: none !important;
    border-color: #3498db !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1) !important;
}

select[name="how_did_you_hear"].dc-success,
.dc-enhanced-select.dc-success,
#how_did_you_hear.dc-success {
    border-color: #27ae60 !important;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1) !important;
    background: linear-gradient(135deg, #d5f4e6 0%, #ffffff 100%) !important;
}

select[name="how_did_you_hear"].dc-error,
.dc-enhanced-select.dc-error,
#how_did_you_hear.dc-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
    background: linear-gradient(135deg, #ffeaea 0%, #ffffff 100%) !important;
}

/* Override WooCommerce default select styling */
.woocommerce form .form-row select {
    border: 2px solid #e1e5e9 !important;
    border-radius: 8px !important;
    padding: 12px 15px !important;
    font-size: 14px !important;
    height: auto !important;
    min-height: 50px !important;
}

/* Target Select2 container if WooCommerce uses it */
.select2-container .select2-selection--single {
    height: auto !important;
    min-height: 50px !important;
    border: 2px solid #e1e5e9 !important;
    border-radius: 8px !important;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    padding: 12px 15px !important;
    line-height: 1.4 !important;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    right: 10px !important;
}

/* Field wrapper styling */
.dc-field-wrapper {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border: 1px solid #e1e5e9 !important;
    border-radius: 12px !important;
    padding: 20px !important;
    margin: 20px 0 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
    position: relative !important;
    clear: both !important;
}

/* Other field styling */
.dc-other-field {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 10px !important;
}

.dc-other-field.dc-other-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
    background: linear-gradient(135deg, #fff3cd 0%, #ffffff 100%) !important;
    border: 1px solid #ffeaa7 !important;
    border-radius: 8px !important;
    padding: 15px !important;
}

.dc-other-field input {
    border: 2px solid #f39c12 !important;
    border-radius: 6px !important;
    padding: 10px 12px !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
}

.dc-other-field input:focus {
    outline: none !important;
    transform: scale(1.02);
}

.dc-other-field input.dc-input-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.1) !important;
}

.dc-other-field input.dc-input-warning {
    border-color: #f39c12 !important;
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.1) !important;
}

.dc-other-field input.dc-input-success {
    border-color: #27ae60 !important;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.1) !important;
}

/* Character counter */
.dc-char-counter {
    animation: fadeIn 0.3s ease;
    font-size: 12px;
    text-align: left;
    margin-top: 5px;
    color: #7f8c8d;
}

.dc-char-counter.dc-char-limit {
    color: #e74c3c;
}

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

/* RTL styling improvements */
.form-row label {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    margin-bottom: 8px !important;
    display: block !important;
}

.required {
    color: #e74c3c !important;
    font-weight: bold !important;
}

/* Field icon */
.dc-field-icon {
    position: absolute !important;
    top: 15px !important;
    left: 20px !important;
    font-size: 20px !important;
    color: #3498db !important;
    z-index: 1 !important;
}

/* Shortcode wrapper styling */
.dc-referral-shortcode-wrapper {
    margin: 20px 0;
    clear: both;
}

/* Special styling when placed before terms and conditions */
#dc_referral_field_wrapper {
    margin-bottom: 25px !important;
    border-top: 2px solid #ecf0f1 !important;
    border-bottom: 2px solid #ecf0f1 !important;
}

/* Hide WooCommerce auto-generated (optional) text */
#dc_referral_field_wrapper .optional,
.dc-referral-shortcode-wrapper .optional,
label[for="how_did_you_hear"] .optional {
    display: none !important;
}

.dc-style-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e1e5e9;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.dc-style-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.dc-card-title {
    color: #2c3e50;
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.dc-style-minimal {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border-right: 4px solid #3498db;
}

.dc-width-half {
    width: 48%;
    display: inline-block;
    margin-left: 2%;
}

.dc-with-icons .dc-shortcode-select {
    position: relative;
}

.dc-with-icons .dc-shortcode-select::before {
    content: "🤔";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    z-index: 10;
    pointer-events: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .dc-field-icon {
        display: none !important;
    }
    
    .dc-field-wrapper {
        padding: 15px !important;
        margin: 10px 0 !important;
    }
    
    .dc-enhanced-select {
        font-size: 16px !important;
        min-height: 44px !important;
    }
    
    .dc-width-half {
        width: 100%;
        margin-left: 0;
        display: block;
    }
    
    .dc-style-card {
        padding: 20px 15px;
    }
}

/* Print styles */
@media print {
    .dc-field-wrapper,
    .dc-style-card,
    .dc-style-minimal {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Smart Tracking Styles */
.dc-auto-detected {
    background-color: #e8f5e8 !important;
    border: 2px solid #4CAF50 !important;
}

.dc-auto-detected-indicator {
    margin-top: 10px;
    font-size: 12px;
}

.dc-auto-detected-indicator small {
    color: #4CAF50;
    font-size: 12px;
    display: block;
}

.dc-shortcode-error {
    color: #e74c3c;
    padding: 10px;
    background: #ffeaea;
    border-radius: 4px;
    font-weight: 600;
    margin: 10px 0;
}

.dc-hidden-emoji {
    display: none !important;
} 