/**
 * Necox Form Builder - Enhanced Styles
 * 
 * Beautiful animations, modern design, and accessibility features
 * 
 * @version 5.2.0
 */

/* ============================================
   MODERN CHECKBOX & RADIO DESIGN
   ============================================ */

.necox-form-wrapper .necox-choice-input[type="checkbox"],
.necox-form-wrapper .necox-choice-input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.necox-form-wrapper .necox-choice-input[type="radio"] {
    border-radius: 50%;
}

/* Checkbox Checkmark */
.necox-form-wrapper .necox-choice-input[type="checkbox"]:checked::before {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    animation: necoxCheckPop 0.3s ease forwards;
}

@keyframes necoxCheckPop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Radio Dot */
.necox-form-wrapper .necox-choice-input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    animation: necoxRadioPop 0.3s ease forwards;
}

@keyframes necoxRadioPop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.necox-form-wrapper .necox-choice-input:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.necox-form-wrapper .necox-choice-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Hover effect */
.necox-form-wrapper .necox-choice-label:hover .necox-choice-input {
    border-color: #667eea;
    transform: scale(1.05);
}

/* ============================================
   FILE UPLOAD - DRAG & DROP EFFECT
   ============================================ */

.necox-form-wrapper .necox-file-label {
    position: relative;
    overflow: hidden;
}

.necox-form-wrapper .necox-file-label::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

.necox-form-wrapper .necox-file-label:hover::before {
    left: 100%;
}

.necox-form-wrapper .necox-file-upload.dragover .necox-file-label {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-style: solid;
}

/* File preview styling */
.necox-form-wrapper .necox-file-preview {
    position: relative;
    padding-left: 30px;
}

.necox-form-wrapper .necox-file-preview::before {
    content: "📄";
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

.necox-form-wrapper .necox-file-preview.image-preview::before {
    content: "🖼️";
}

/* ============================================
   RANGE SLIDER - ENHANCED
   ============================================ */

/* Firefox */
.necox-form-wrapper .necox-range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.necox-form-wrapper .necox-range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.necox-form-wrapper .necox-range-slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
}

/* IE */
.necox-form-wrapper .necox-range-slider::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
}

.necox-form-wrapper .necox-range-slider::-ms-track {
    height: 8px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: transparent;
}

/* Range value tooltip */
.necox-form-wrapper .necox-range-wrapper {
    position: relative;
}

.necox-form-wrapper .necox-range-current {
    position: relative;
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    animation: necoxPulseValue 0.3s ease;
}

@keyframes necoxPulseValue {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   SELECT DROPDOWN - MODERN DESIGN
   ============================================ */

.necox-form-wrapper .necox-form-select {
    cursor: pointer;
}

.necox-form-wrapper .necox-form-select:hover {
    border-color: #667eea;
}

.necox-form-wrapper .necox-form-select option {
    padding: 10px;
    background: #fff;
    color: #333;
}

.necox-form-wrapper .necox-form-select option:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* ============================================
   FLOATING LABEL EFFECT (Optional)
   ============================================ */

.necox-form-wrapper.floating-labels .necox-form-field {
    position: relative;
}

.necox-form-wrapper.floating-labels .necox-form-label {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    pointer-events: none;
    background: #fff;
    padding: 0 5px;
}

.necox-form-wrapper.floating-labels .necox-form-input:focus ~ .necox-form-label,
.necox-form-wrapper.floating-labels .necox-form-input:not(:placeholder-shown) ~ .necox-form-label {
    top: 0;
    font-size: 12px;
    color: #667eea;
}

/* ============================================
   BUTTON RIPPLE EFFECT
   ============================================ */

.necox-form-wrapper .necox-form-button {
    position: relative;
    overflow: hidden;
}

.necox-form-wrapper .necox-form-button::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.necox-form-wrapper .necox-form-button:active::before {
    width: 300px;
    height: 300px;
}

/* ============================================
   SMOOTH PLACEHOLDER ANIMATIONS
   ============================================ */

.necox-form-wrapper .necox-form-input::placeholder {
    transition: all 0.3s ease;
}

.necox-form-wrapper .necox-form-input:focus::placeholder {
    opacity: 0.5;
    transform: translateX(10px);
}

/* ============================================
   ACCESSIBILITY - HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .necox-form-wrapper .necox-form-input,
    .necox-form-wrapper .necox-form-select {
        border-width: 2px;
        border-color: #000;
    }
    
    .necox-form-wrapper .necox-form-button {
        border: 2px solid #000;
    }
}

/* ============================================
   REDUCED MOTION - ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .necox-form-wrapper * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .necox-form-wrapper .necox-form-container {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .necox-form-wrapper .necox-form-input,
    .necox-form-wrapper .necox-form-select,
    .necox-form-wrapper .necox-form-textarea {
        background-color: #2a2a2a;
        color: #ffffff;
        border-color: #444;
    }
    
    .necox-form-wrapper .necox-form-input::placeholder {
        color: #888;
    }
    
    .necox-form-wrapper .necox-choice-label {
        border-color: #444;
        background-color: #2a2a2a;
    }
    
    .necox-form-wrapper .necox-file-label {
        border-color: #444;
        background-color: #2a2a2a;
    }
}

/* ============================================
   PROGRESSIVE ENHANCEMENT - FOCUS WITHIN
   ============================================ */

.necox-form-wrapper .necox-form-field:focus-within {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

.necox-form-wrapper .necox-form-field:focus-within .necox-form-label {
    color: #667eea;
    font-weight: 600;
}

/* ============================================
   LOADING STATE - SKELETON
   ============================================ */

.necox-form-wrapper.loading .necox-form-input,
.necox-form-wrapper.loading .necox-form-select {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: necoxSkeleton 1.5s ease infinite;
}

@keyframes necoxSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   SUCCESS CELEBRATION ANIMATION
   ============================================ */

.necox-form-wrapper .necox-form-response.success {
    animation: necoxSuccessCelebrate 0.6s ease;
}

@keyframes necoxSuccessCelebrate {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Add confetti effect (optional) */
.necox-form-wrapper .necox-form-response.success::before {
    content: "🎉";
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    animation: necoxConfetti 0.8s ease;
}

@keyframes necoxConfetti {
    0% {
        transform: translateY(-50%) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) rotate(360deg);
        opacity: 1;
    }
}

/* ============================================
   TOOLTIP - ERROR MESSAGES
   ============================================ */

.necox-form-wrapper .necox-field-error {
    position: relative;
    padding: 8px 12px;
    background: #fff5f5;
    border-left: 3px solid #e74c3c;
    border-radius: 4px;
    font-size: 13px;
}

.necox-form-wrapper .necox-field-error::before {
    content: "⚠️";
    margin-right: 5px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .necox-form-wrapper .necox-form-button,
    .necox-form-wrapper .necox-form-response {
        display: none !important;
    }
    
    .necox-form-wrapper .necox-form-input,
    .necox-form-wrapper .necox-form-select,
    .necox-form-wrapper .necox-form-textarea {
        border: 1px solid #000 !important;
        background: #fff !important;
    }
}

/* ============================================
   RESPONSIVE - EXTRA SMALL DEVICES
   ============================================ */

@media (max-width: 480px) {
    .necox-form-wrapper .necox-form-container {
        padding: 30px 20px !important;
    }
    
    .necox-form-wrapper .necox-form-label {
        font-size: 14px;
    }
    
    .necox-form-wrapper .necox-form-button {
        font-size: 14px;
        min-height: 50px;
    }
    
    .necox-form-wrapper .necox-choice-label {
        font-size: 14px;
    }
}

/* ============================================
   LANDSCAPE MOBILE OPTIMIZATION
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .necox-form-wrapper .necox-form-container {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .necox-form-wrapper .necox-form-field {
        margin-bottom: 10px !important;
    }
}

/* ============================================
   RTL SUPPORT
   ============================================ */

[dir="rtl"] .necox-form-wrapper .necox-form-select {
    background-position: left 15px center;
    padding-left: 40px !important;
    padding-right: 20px !important;
}

[dir="rtl"] .necox-form-wrapper .necox-file-preview {
    padding-left: 0;
    padding-right: 30px;
}

[dir="rtl"] .necox-form-wrapper .necox-file-preview::before {
    left: auto;
    right: 5px;
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

.necox-form-wrapper .necox-form-input:valid {
    border-color: #27ae60;
}

.necox-form-wrapper .necox-form-input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #e74c3c;
}

/* Subtle shake on invalid */
.necox-form-wrapper .necox-form-input:invalid:focus {
    animation: necoxSubtleShake 0.3s ease;
}

@keyframes necoxSubtleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* ============================================
   CUSTOM SCROLLBAR (for webkit browsers)
   ============================================ */

.necox-form-wrapper .necox-form-textarea::-webkit-scrollbar {
    width: 8px;
}

.necox-form-wrapper .necox-form-textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.necox-form-wrapper .necox-form-textarea::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.necox-form-wrapper .necox-form-textarea::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   PERFORMANCE OPTIMIZATION
   ============================================ */

.necox-form-wrapper * {
    will-change: transform, opacity;
}

.necox-form-wrapper .necox-form-input,
.necox-form-wrapper .necox-form-select,
.necox-form-wrapper .necox-form-button {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Force 100% width if not set */
.necox-form-wrapper {
    width: 100%;
    max-width: 100%;
}
