/**
 * Frontend CSS for WhatsForm
 */

/* Container */
.whatsform-container {
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Form */
.whatsform-form {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

/* Fields Container */
.whatsform-fields {
    margin-bottom: 20px;
}

/* Individual Field */
.whatsform-field {
    margin-bottom: 20px;
}

.whatsform-field:last-child {
    margin-bottom: 0;
}

/* Labels */
.whatsform-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.4;
}

.whatsform-required {
    color: #e74c3c;
    margin-left: 2px;
}

/* Input Fields */
.whatsform-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    background-color: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.whatsform-input:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

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

/* Textarea */
.whatsform-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Select */
.whatsform-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Radio and Checkbox Groups */
.whatsform-radio-group,
.whatsform-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.whatsform-radio-option,
.whatsform-checkbox-option {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    padding: 8px 0;
    font-weight: normal;
    margin: 0;
}

.whatsform-radio,
.whatsform-checkbox {
    width: auto;
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
}

.whatsform-radio-text,
.whatsform-checkbox-text {
    flex: 1;
    line-height: 1.5;
}

/* Consent */
.whatsform-consent {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.whatsform-consent-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
    line-height: 1.5;
}

.whatsform-consent-checkbox {
    width: auto;
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
}

.whatsform-consent-text {
    flex: 1;
    font-size: 14px;
    color: #495057;
}

/* Submit Button */
.whatsform-submit {
    text-align: center;
    margin-top: 30px;
}

.whatsform-submit-btn {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: #ffffff;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    position: relative;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.whatsform-submit-btn:hover {
    background: linear-gradient(135deg, #128c7e 0%, #075e54 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

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

.whatsform-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.whatsform-submit-btn:disabled:hover {
    transform: none;
}

/* Loading Spinner */
.whatsform-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: whatsform-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Messages */
.whatsform-messages {
    margin-top: 20px;
}

.whatsform-success-message,
.whatsform-error-message {
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
}

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

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

/* Field Errors */
.whatsform-field-error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 6px;
    font-weight: 500;
}

/* Error State for Admin */
.whatsform-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 6px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .whatsform-form {
        padding: 20px;
        margin: 0 15px;
    }
    
    .whatsform-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .whatsform-submit-btn {
        width: 100%;
        padding: 14px 24px;
    }
    
    .whatsform-radio-group,
    .whatsform-checkbox-group {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .whatsform-form {
        padding: 15px;
        margin: 0 10px;
    }
    
    .whatsform-field {
        margin-bottom: 15px;
    }
    
    .whatsform-consent {
        padding: 15px;
        margin: 20px 0;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .whatsform-input {
        border-width: 3px;
    }
    
    .whatsform-submit-btn {
        border: 2px solid #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .whatsform-input,
    .whatsform-submit-btn {
        transition: none;
    }
    
    .whatsform-spinner {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .whatsform-form {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .whatsform-label {
        color: #ecf0f1;
    }
    
    .whatsform-input {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .whatsform-input:focus {
        border-color: #25d366;
        background: #34495e;
    }
    
    .whatsform-consent {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .whatsform-consent-text {
        color: #bdc3c7;
    }
}

/* Print Styles */
@media print {
    .whatsform-submit {
        display: none;
    }
    
    .whatsform-form {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Focus Visible for Better Accessibility */
.whatsform-input:focus-visible,
.whatsform-submit-btn:focus-visible,
.whatsform-radio:focus-visible,
.whatsform-checkbox:focus-visible {
    outline: 2px solid #25d366;
    outline-offset: 2px;
}

/* Custom Scrollbar for Textarea */
.whatsform-textarea::-webkit-scrollbar {
    width: 8px;
}

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

.whatsform-textarea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.whatsform-textarea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

