/**
 * A247 Free Test - Frontend Styles
 * Author: Broly Chau
 * Version: 1.0.0
 */

/* Reset và Base Styles */
.a247-assessment-form-container * {
    box-sizing: border-box;
}

.a247-assessment-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Form Title & Description */
.a247-form-title {
    font-size: 28px;
    font-weight: 700;
    color: #1d6ccd;
    margin: 0 0 10px 0;
    text-align: center;
}

.a247-form-description {
    font-size: 16px;
    color: #666;
    margin: 0 0 30px 0;
    text-align: center;
}

/* Quota Warning */
.a247-quota-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.a247-quota-warning p {
    margin: 0;
    color: #856404;
    font-weight: 600;
}

.a247-quota-exceeded {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.a247-quota-exceeded p {
    margin: 0;
    color: #721c24;
    font-weight: 600;
}

/* Form Styles */
.a247-form {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

.a247-form-group {
    margin-bottom: 25px;
    position: relative;
    z-index: auto;
}

.a247-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.a247-required {
    color: #e74c3c;
    font-weight: 700;
}

.a247-input,
.a247-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
    min-height: 50px;
    line-height: 1.4;
}

/* Specific styles for select dropdown */
.a247-select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-color: #fff;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23333"><path d="M10 16l-6-6h12l-6 6z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    padding-right: 40px;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* Cross-browser support for select - Hide ALL default arrows */
.a247-select::-ms-expand {
    display: none !important; /* Hide default arrow in IE */
}

.a247-select::-webkit-outer-spin-button,
.a247-select::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
}

/* Firefox specific fix */
.a247-select::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* Safari specific fix */
.a247-select::-webkit-appearance {
    -webkit-appearance: none !important;
}

/* Remove any background from select element that might cause duplicates */
.a247-select {
    background-attachment: scroll;
    background-clip: border-box;
    background-origin: padding-box;
}

/* Ensure dropdown options are fully visible */
.a247-select option {
    padding: 8px 12px;
    color: #333;
    background: #fff;
    font-size: 16px;
    line-height: 1.4;
    min-height: 40px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.a247-select option:hover,
.a247-select option:focus {
    background: #f8f9fa;
    color: #1d6ccd;
}

.a247-select option:checked {
    background: #1d6ccd;
    color: white;
    font-weight: 600;
}

.a247-input:focus,
.a247-select:focus {
    outline: none;
    border-color: #1d6ccd;
    box-shadow: 0 0 0 3px rgba(29, 108, 205, 0.1);
}

.a247-input::placeholder {
    color: #95a5a6;
}

.a247-help-text {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
    font-style: italic;
}

/* Submit Button */
.a247-submit-group {
    margin-top: 35px;
    text-align: center;
}

.a247-submit-btn {
    background: linear-gradient(135deg, #1d6ccd 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 200px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.a247-submit-btn:hover {
    background: linear-gradient(135deg, #155a9c 0%, #2471a3 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(29, 108, 205, 0.3);
}

.a247-submit-btn:active {
    transform: translateY(0);
}

.a247-submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.a247-btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.a247-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: a247-spin 1s linear infinite;
}

@keyframes a247-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Messages */
.a247-error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.a247-error-message.show {
    display: block;
}

.a247-form-group.error .a247-input,
.a247-form-group.error .a247-select {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Success/Error Messages */
.a247-messages {
    margin-top: 20px;
}

.a247-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
}

.a247-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.a247-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Completion Modal */
.a247-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: a247-fadeIn 0.3s ease;
}

.a247-completion-modal {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: a247-slideUp 0.3s ease;
}

.a247-completion-content {
    padding: 40px 30px;
    text-align: center;
}

.a247-completion-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.a247-completion-content h2 {
    color: #1d6ccd;
    margin: 0 0 15px 0;
    font-size: 24px;
}

.a247-completion-content p {
    color: #666;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.a247-btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.a247-btn-primary {
    background: #1d6ccd;
    color: white;
}

.a247-btn-primary:hover {
    background: #155a9c;
    transform: translateY(-2px);
}

@keyframes a247-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes a247-slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Styles Variants */

/* Modern Style */
.a247-assessment-form-container[data-style="modern"] .a247-form {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.a247-assessment-form-container[data-style="modern"] .a247-label {
    color: white;
}

.a247-assessment-form-container[data-style="modern"] .a247-input,
.a247-assessment-form-container[data-style="modern"] .a247-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.a247-assessment-form-container[data-style="modern"] .a247-select {
    background-color: rgba(255, 255, 255, 0.1) !important;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23fff"><path d="M10 16l-6-6h12l-6 6z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px 16px !important;
}

.a247-assessment-form-container[data-style="modern"] .a247-select option {
    background: #667eea;
    color: white;
}

.a247-assessment-form-container[data-style="modern"] .a247-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.a247-assessment-form-container[data-style="modern"] .a247-submit-btn {
    background: white;
    color: #667eea;
}

/* Minimal Style */
.a247-assessment-form-container[data-style="minimal"] .a247-form {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
}

.a247-assessment-form-container[data-style="minimal"] .a247-input,
.a247-assessment-form-container[data-style="minimal"] .a247-select {
    border: none;
    border-bottom: 2px solid #e1e5e9;
    border-radius: 0;
    background: transparent;
    padding: 10px 0;
    min-height: 45px;
}

.a247-assessment-form-container[data-style="minimal"] .a247-select {
    background-color: transparent !important;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23333"><path d="M10 16l-6-6h12l-6 6z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 14px 14px !important;
    padding-right: 30px;
}

.a247-assessment-form-container[data-style="minimal"] .a247-submit-btn {
    background: #2c3e50;
    border-radius: 0;
}

/* Card Style */
.a247-assessment-form-container[data-style="card"] {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 40px;
}

.a247-assessment-form-container[data-style="card"] .a247-form {
    background: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Responsive Design */
@media (max-width: 768px) {
    .a247-assessment-form-container {
        padding: 15px;
    }
    
    .a247-form {
        padding: 20px;
    }
    
    .a247-form-title {
        font-size: 24px;
    }
    
    .a247-submit-btn {
        width: 100%;
        padding: 15px;
    }
    
    .a247-completion-content {
        padding: 30px 20px;
    }
    
    .a247-completion-content h2 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .a247-assessment-form-container {
        padding: 10px;
    }
    
    .a247-form {
        padding: 15px;
    }
    
    .a247-form-title {
        font-size: 20px;
    }
    
    .a247-input,
    .a247-select {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 48px; /* Better touch target */
    }
    
    /* Adjust select dropdown arrow for mobile */
    .a247-select {
        background-size: 14px 14px;
        background-position: right 10px center;
        padding-right: 35px;
    }
    
    /* Ensure select options are readable on small screens */
    .a247-select option {
        font-size: 16px;
        padding: 10px;
        min-height: 44px;
    }
}

/* Print Styles */
@media print {
    .a247-assessment-form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .a247-submit-btn {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .a247-form {
        border: 2px solid #000;
    }
    
    .a247-input,
    .a247-select {
        border: 2px solid #000;
    }
    
    .a247-submit-btn {
        background: #000;
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .a247-submit-btn,
    .a247-input,
    .a247-select,
    .a247-checkmark {
        transition: none;
    }
    
    .a247-spinner {
        animation: none;
    }
    
    .a247-overlay,
    .a247-completion-modal {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .a247-assessment-form-container {
        color: #e1e5e9;
    }
    
    .a247-form {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .a247-label {
        color: #ecf0f1;
    }
    
    .a247-input,
    .a247-select {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .a247-select {
        background-color: #34495e !important;
        background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23ecf0f1"><path d="M10 16l-6-6h12l-6 6z"/></svg>') !important;
        background-repeat: no-repeat !important;
        background-position: right 12px center !important;
        background-size: 16px 16px !important;
    }
    
    .a247-select option {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .a247-input::placeholder {
        color: #95a5a6;
    }
    
    .a247-completion-modal {
        background: #2c3e50;
    }
    
    .a247-completion-content h2 {
        color: #3498db;
    }
    
    .a247-completion-content p {
        color: #bdc3c7;
    }
}

/* Strong override to prevent any default select styling */
.a247-assessment-form-container .a247-select,
.a247-assessment-form-container .a247-select:focus,
.a247-assessment-form-container .a247-select:hover,
.a247-assessment-form-container .a247-select:active {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-attachment: scroll !important;
    background-clip: border-box !important;
    background-origin: padding-box !important;
} 