/* Advanced Survey Builder - Frontend Styles */

.asb-survey-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

/* Loading Overlay */
.asb-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.asb-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: asb-spin 1s linear infinite;
}

@keyframes asb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message Box */
.asb-message-box {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 1001;
    min-width: 200px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.asb-message-success {
    background-color: #4caf50;
}

.asb-message-error {
    background-color: #f44336;
}

.asb-message-info {
    background-color: #2196f3;
}

/* Progress Bar */
.asb-progress-container {
    margin-bottom: 30px;
}

.asb-progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.asb-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.asb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007aff, #0056cc);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Question Card */
.asb-question-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.asb-question-text {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.4;
}

.asb-question-input {
    margin-top: 20px;
}

/* Text Input */
.asb-text-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #fafafa;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.asb-text-input:focus {
    outline: none;
    border-color: #007aff;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.asb-text-input::placeholder {
    color: #999;
}

/* Radio Group */
.asb-radio-group {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

.asb-radio-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
}

.asb-radio-option:hover {
    border-color: #007aff;
    background: #f0f8ff;
}

.asb-radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.asb-radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.asb-radio-option input[type="radio"]:checked + .asb-radio-custom {
    border-color: #007aff;
    background: #007aff;
}

.asb-radio-option input[type="radio"]:checked + .asb-radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.asb-radio-option input[type="radio"]:checked ~ .asb-radio-text {
    color: #007aff;
    font-weight: 500;
}

.asb-radio-text {
    font-size: 16px;
    color: #333;
    line-height: 1.4;
}

/* Navigation */
.asb-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

.asb-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.asb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.asb-btn-primary {
    background: #007aff;
    color: white;
}

.asb-btn-primary:hover:not(:disabled) {
    background: #0056cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.asb-btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.asb-btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
    transform: translateY(-1px);
}

/* Thank You Screen */
.asb-thank-you-screen {
    text-align: center;
    padding: 60px 20px;
}

.asb-thank-you-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.asb-thank-you-icon {
    width: 80px;
    height: 80px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 20px;
    animation: asb-bounce 0.6s ease;
}

@keyframes asb-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.asb-thank-you-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.asb-thank-you-message {
    font-size: 16px;
    color: #666;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* Utility Classes */
.asb-hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .asb-survey-container {
        padding: 15px;
    }
    
    .asb-question-card {
        padding: 20px;
    }
    
    .asb-question-text {
        font-size: 18px;
    }
    
    .asb-radio-group {
        grid-template-columns: 1fr;
    }
    
    .asb-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .asb-btn {
        width: 100%;
    }
    
    .asb-thank-you-content {
        padding: 30px 20px;
    }
    
    .asb-thank-you-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .asb-survey-container {
        padding: 10px;
    }
    
    .asb-question-card {
        padding: 15px;
    }
    
    .asb-question-text {
        font-size: 16px;
    }
    
    .asb-text-input {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .asb-radio-option {
        padding: 12px;
    }
    
    .asb-radio-text {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .asb-question-card {
        background: #1e1e1e;
        border-color: #333;
        color: white;
    }
    
    .asb-question-text {
        color: white;
    }
    
    .asb-text-input {
        background: #2a2a2a;
        border-color: #444;
        color: white;
    }
    
    .asb-text-input:focus {
        background: #333;
    }
    
    .asb-radio-option {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .asb-radio-option:hover {
        background: #333;
    }
    
    .asb-radio-text {
        color: white;
    }
    
    .asb-thank-you-content {
        background: #1e1e1e;
        border-color: #333;
    }
    
    .asb-thank-you-title {
        color: white;
    }
    
    .asb-thank-you-message {
        color: #ccc;
    }
}