/**
 * YG Advanced Custom Forms - Frontend Styles
 *
 * @package YG_Advanced_Custom_Forms
 * @author Yarin Golan
 */

/* Base Form Layout */
.yg-acf-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.yg-acf-fields-wrapper {
    display: flex;
    flex-direction: column;
}

/* Field Wrapper */
.yg-acf-field-wrapper {
    margin-bottom: 20px;
}

.yg-acf-field-wrapper:last-child {
    margin-bottom: 0;
}

/* Labels */
.yg-acf-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.yg-acf-required {
    color: #dc3545;
    margin-left: 4px;
}

/* Input Fields */
.yg-acf-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.yg-acf-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Textarea specific */
textarea.yg-acf-input {
    resize: vertical;
    min-height: 120px;
}

/* Select specific */
select.yg-acf-input {
    cursor: pointer;
    appearance: auto;
}

/* File input specific */
input[type="file"].yg-acf-input {
    padding: 10px;
    font-size: 14px;
}

.yg-acf-file-hint {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

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

.yg-acf-radio-label,
.yg-acf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.yg-acf-radio-label input,
.yg-acf-checkbox-label input {
    margin: 0;
}

/* Field Errors */
.yg-acf-field-error {
    display: block;
    color: #dc3545;
    font-size: 13px;
    margin-top: 6px;
}

.yg-acf-input-error {
    border-color: #dc3545 !important;
}

.yg-acf-input-error:focus {
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.yg-acf-field-error-active .yg-acf-label {
    color: #dc3545;
}

/* Submit Button Wrapper */
.yg-acf-submit-wrapper {
    margin-top: 25px;
}

/* Submit Button */
.yg-acf-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    background-color: #007cba;
    border: 2px solid #007cba;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 150px;
}

.yg-acf-submit-button:hover {
    background-color: #005a87;
    border-color: #005a87;
}

.yg-acf-submit-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

.yg-acf-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Button Loading State */
.yg-acf-button-loading {
    position: relative;
}

.yg-acf-button-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: yg-acf-spin 1s linear infinite;
}

@keyframes yg-acf-spin {
    to {
        transform: rotate(360deg);
    }
}

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

.yg-acf-messages {
    padding: 15px 20px;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.5;
}

.yg-acf-messages p {
    margin: 0;
}

.yg-acf-messages.yg-acf-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.yg-acf-messages.yg-acf-error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* Form Layout Variations */
@media (min-width: 768px) {
    .yg-acf-form.yg-acf-layout-inline {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 15px;
    }
    
    .yg-acf-form.yg-acf-layout-inline .yg-acf-field-wrapper {
        flex: 1;
        min-width: 200px;
        margin-bottom: 0;
    }
    
    .yg-acf-form.yg-acf-layout-inline .yg-acf-submit-wrapper {
        margin-top: 0;
    }
}

/* Accessibility */
.yg-acf-input[required]:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

/* Screen Reader Only */
.yg-acf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* RTL Support */
[dir="rtl"] .yg-acf-label .yg-acf-required {
    margin-left: 0;
    margin-right: 4px;
}

[dir="rtl"] .yg-acf-radio-label,
[dir="rtl"] .yg-acf-checkbox-label {
    flex-direction: row-reverse;
}

/* Print Styles */
@media print {
    .yg-acf-submit-wrapper,
    .yg-acf-messages {
        display: none;
    }
}
