/**
 * ACF Applications Manager - Front-end Styles
 * Styles for the application form shortcode (Simple and Advanced)
 */

/* Form Container */
.acf-applications-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    color: inherit;
    font-size: inherit;
}

.acf-applications-wrapper {
    padding: 40px 20px;
    background: transparent;
    min-height: 100vh;
}

.acf-applications-form h1,
.acf-applications-form h2 {
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 600;
    line-height: 1.2;
    color: inherit;
}

.acf-applications-form h1 {
    font-size: 3em;
}

.acf-application-id {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 20px;
    color: inherit;
    font-size: inherit;
}

.acf-applications-intro {
    margin-bottom: 30px;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* WYSIWYG Content Styling - Preserve formatting from editor */
.acf-applications-intro h1,
.acf-applications-intro h2,
.acf-applications-intro h3,
.acf-applications-intro h4,
.acf-applications-intro h5,
.acf-applications-intro h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: inherit;
    font-weight: 600;
    line-height: 1.3;
}

.acf-applications-intro h1 { font-size: 2em; }
.acf-applications-intro h2 { font-size: 1.75em; }
.acf-applications-intro h3 { font-size: 1.5em; }
.acf-applications-intro h4 { font-size: 1.25em; }
.acf-applications-intro h5 { font-size: 1.1em; }
.acf-applications-intro h6 { font-size: 1em; }

.acf-applications-intro h1:first-child,
.acf-applications-intro h2:first-child,
.acf-applications-intro h3:first-child,
.acf-applications-intro h4:first-child,
.acf-applications-intro h5:first-child,
.acf-applications-intro h6:first-child {
    margin-top: 0;
}

.acf-applications-intro p {
    margin-bottom: 1em;
    color: inherit;
    line-height: 1.6;
}

.acf-applications-intro p:last-child {
    margin-bottom: 0;
}

.acf-applications-intro ul,
.acf-applications-intro ol {
    margin: 1em 0;
    padding-left: 2em;
    color: inherit;
}

.acf-applications-intro li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.acf-applications-intro strong,
.acf-applications-intro b {
    font-weight: 600;
}

.acf-applications-intro em,
.acf-applications-intro i {
    font-style: italic;
}

.acf-applications-intro a {
    color: inherit;
    text-decoration: underline;
}

.acf-applications-intro a:hover {
    opacity: 0.8;
}

.acf-applications-intro blockquote {
    margin: 1.5em 0;
    padding-left: 1.5em;
    border-left: 3px solid currentColor;
    opacity: 0.9;
}

.acf-applications-intro code {
    padding: 0.2em 0.4em;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.acf-applications-intro pre {
    padding: 1em;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
}

.acf-applications-intro pre code {
    padding: 0;
    background: none;
}

/* ACF Fields Styling */
.acf-field {
    margin-bottom: 0;
    padding-bottom: 0;
    padding-left: 0;
    border-bottom: none;
}

.acf-field .acf-label {
    display: block;
    margin-bottom: 12px;
    margin-top: 30px;
    padding-left: 0;
    color: inherit;
    font-size: 1.5em;
    font-weight: 600;
}

.acf-field .acf-label label {
    padding-left: 0;
}

.acf-field .acf-label .acf-required {
    color: inherit;
    opacity: 0.7;
    margin-left: 4px;
}

.acf-field .description,
.acf-field .acf-description {
    display: block;
    margin-top: 8px;
    margin-bottom: 12px;
    padding-left: 0;
    color: inherit;
    opacity: 0.8;
    font-size: 16px;
    font-style: italic;
}

.acf-fields>.acf-field {
    padding-left: 0 !important;
}

.acf-field .acf-input {
    position: relative;
    padding-left: 0 !important;
}

/* Input Fields */
.acf-field input[type="text"],
.acf-field input[type="email"],
.acf-field input[type="url"],
.acf-field input[type="tel"],
.acf-field input[type="number"],
.acf-field textarea,
.acf-field select {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.03);
    color: inherit;
    font-size: 1.1em;
    font-family: inherit;
    line-height: 1.5;
    transition: box-shadow 0.3s ease, background 0.3s ease;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.acf-field input[type="text"]:focus,
.acf-field input[type="email"]:focus,
.acf-field input[type="url"]:focus,
.acf-field input[type="tel"]:focus,
.acf-field input[type="number"]:focus,
.acf-field textarea:focus,
.acf-field select:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.acf-field textarea {
    resize: vertical;
    min-height: 150px;
}

/* Character Counter */
.char-counter {
    margin-top: 8px;
    font-size: 0.9em;
    color: rgba(0, 0, 0, 0.5);
    text-align: right;
    font-style: italic;
}

/* ACF Input Append - Display Below Input */
.acf-input-wrap {
    display: flex;
    flex-direction: column;
}

.acf-input-wrap .acf-input-append {
    order: 2;
    display: block;
    width: 100%;
    margin-top: 8px;
    margin-left: 0 !important;
    font-size: 0.9em;
    color: rgba(0, 0, 0, 0.5);
    text-align: left;
    font-style: italic;
}

.acf-input-wrap input,
.acf-input-wrap textarea,
.acf-input-wrap select {
    order: 1;
}

/* File Upload Progress */
.file-upload-progress {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.file-upload-progress .progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.file-upload-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.file-upload-progress .progress-text {
    font-size: 0.9em;
    color: rgba(0, 0, 0, 0.6);
    text-align: center;
}

/* Field Completion Counter - Fixed on Right Side */
#field-completion-counter {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    transition: opacity 0.3s ease;
    min-width: 200px;
}

#field-completion-counter .counter-stats {
    margin-bottom: 12px;
}

#field-completion-counter .counter-filled {
    font-size: 24px;
    font-weight: 700;
    color: #4CAF50;
}

#field-completion-counter .counter-total {
    font-size: 24px;
    font-weight: 700;
}

#field-completion-counter .counter-copy-link-btn,
#field-completion-counter .counter-scroll-btn {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
    display: block;
    text-align: center;
    margin-bottom: 8px;
}

#field-completion-counter .counter-copy-link-btn:hover,
#field-completion-counter .counter-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

#field-completion-counter .counter-scroll-btn {
    margin-bottom: 0;
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.3);
}

#field-completion-counter .counter-scroll-btn:hover {
    background: rgba(33, 150, 243, 0.3);
    border-color: rgba(33, 150, 243, 0.4);
}

/* Toast notification messages */
.acf-form-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.acf-form-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.acf-form-toast-success {
    background: #4CAF50;
}

.acf-form-toast-error {
    background: #f44336;
}

/* ACF form updated message styling */
.acf-notice.-success {
    background: #4CAF50 !important;
    color: white !important;
    border-left: 4px solid #388E3C !important;
}

@media (max-width: 768px) {
    #field-completion-counter {
        top: auto;
        bottom: 80px;
        right: 10px;
        transform: none;
        padding: 12px 16px;
        font-size: 12px;
    }

    #field-completion-counter .counter-filled,
    #field-completion-counter .counter-total {
        font-size: 18px;
    }
}

/* File Upload Field */
.acf-field[data-type="file"] .acf-file-uploader {
    border: none;
    border-radius: 8px;
    padding: 0;
    text-align: left;
    background: transparent;
    color: inherit;
    box-shadow: none;
    transition: none;
}

.acf-field[data-type="file"] .acf-file-uploader:hover {
    background: transparent;
    box-shadow: none;
}

.acf-field[data-type="file"] input[type="file"] {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.03);
    color: inherit;
    font-size: 1.1em;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, background 0.3s ease;
    cursor: pointer;
}

.acf-field[data-type="file"] input[type="file"]:hover {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.acf-field[data-type="file"] input[type="file"]::file-selector-button {
    padding: 12px 24px;
    margin-right: 16px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    font-size: 1em;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.acf-field[data-type="file"] input[type="file"]::file-selector-button:hover {
    background: rgba(0, 0, 0, 0.12);
}

.acf-field[data-type="file"] .file-info {
    margin-top: 10px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.03);
    border: none;
    border-radius: 8px;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* GDPR Consent Radio Buttons */
.acf-field[data-name="gdpr_consent_data"],
.acf-field[data-name="gdpr_consent_storage"] {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    margin-top: 30px;
    margin-bottom: 20px;
}

.acf-field[data-name="gdpr_consent_data"] .acf-label,
.acf-field[data-name="gdpr_consent_storage"] .acf-label {
    font-size: 1.5em;
    color: inherit;
    margin-bottom: 12px;
    margin-top: 30px;
    padding-left: 0;
    font-weight: 600;
}

.acf-field[data-name="gdpr_consent_data"] .description,
.acf-field[data-name="gdpr_consent_storage"] .description {
    color: inherit;
    opacity: 0.8;
    font-size: inherit;
    margin-bottom: 12px;
    padding-left: 0;
}

.acf-field[data-name="gdpr_consent_data"] .acf-radio-list,
.acf-field[data-name="gdpr_consent_storage"] .acf-radio-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 0;
}

.acf-field[data-name="gdpr_consent_data"] .acf-radio-list label,
.acf-field[data-name="gdpr_consent_storage"] .acf-radio-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.03);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, background 0.3s ease;
    color: inherit;
    font-size: 1.1em;
}

.acf-field[data-name="gdpr_consent_data"] .acf-radio-list label:hover,
.acf-field[data-name="gdpr_consent_storage"] .acf-radio-list label:hover {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.acf-field[data-name="gdpr_consent_data"] .acf-radio-list input[type="radio"],
.acf-field[data-name="gdpr_consent_storage"] .acf-radio-list input[type="radio"] {
    width: 1.1em;
    height: 1.1em;
    min-width: 1.1em;
    margin-right: 12px;
    cursor: pointer;
}

.acf-field[data-name="gdpr_consent_data"] .acf-radio-list input[type="radio"]:checked + label,
.acf-field[data-name="gdpr_consent_storage"] .acf-radio-list input[type="radio"]:checked + label {
    background: rgba(0, 0, 0, 0.06);
}

/* GDPR Error State */
.acf-field[data-name="gdpr_consent_data"].acf-error,
.acf-field[data-name="gdpr_consent_storage"].acf-error {
    border-color: transparent;
    background: transparent;
}

.acf-field[data-name="gdpr_consent_data"].acf-error .acf-label,
.acf-field[data-name="gdpr_consent_storage"].acf-error .acf-label {
    color: inherit;
    opacity: 1;
}

/* General Radio and Checkbox Styling */
.acf-field input[type="radio"],
.acf-field input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    min-width: 1.1em;
    margin-right: 8px;
    cursor: pointer;
}

.acf-field .acf-radio-list,
.acf-field .acf-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.acf-field .acf-radio-list label,
.acf-field .acf-checkbox-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: inherit;
}

/* Submit Button */
.acf-form-submit {
    margin-top: 40px;
    text-align: left;
    padding-left: 0;
}

.acf-form-submit .acf-button {
    width: 100%;
    padding: 16px 40px;
    background: rgba(0, 0, 0, 0.03);
    color: inherit;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, background 0.3s ease, transform 0.2s ease;
}

.acf-form-submit .acf-button:hover {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.acf-form-submit .acf-button:active {
    transform: translateY(0);
}

/* Success Message - Full Page Overlay */
.acf-applications-success {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 999999;
    padding: 40px;
}

.acf-applications-success h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #4CAF50;
    font-size: 2em;
    font-weight: 600;
    text-align: center;
}

.acf-applications-success p {
    margin-bottom: 15px;
    font-size: 1.2em;
    line-height: 1.6;
    color: inherit;
    text-align: center;
    max-width: 600px;
}

.acf-applications-success p:last-child {
    margin-bottom: 0;
}

/* Error Messages */
.acf-applications-errors {
    max-width: 800px;
    margin: 0 auto 30px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: inherit;
}

.acf-applications-errors h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.acf-applications-errors ul {
    margin: 0;
    padding-left: 20px;
}

.acf-applications-errors li {
    margin-bottom: 8px;
    font-size: inherit;
    color: inherit;
}

.acf-applications-errors li:last-child {
    margin-bottom: 0;
}

/* ACF Error Messages (Validation) */
.acf-error-message {
    display: block;
    margin-top: 8px;
    padding: 12px 16px;
    background: rgba(220, 53, 69, 0.1);
    border: none;
    border-radius: 6px;
    color: inherit;
    opacity: 0.9;
    font-size: inherit;
}

.acf-field.acf-error input[type="text"],
.acf-field.acf-error input[type="email"],
.acf-field.acf-error input[type="url"],
.acf-field.acf-error input[type="tel"],
.acf-field.acf-error input[type="number"],
.acf-field.acf-error textarea,
.acf-field.acf-error select {
    background: rgba(220, 53, 69, 0.05);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15);
}

/* Form Bookmark Section (Advanced Forms) */
.acf-form-bookmark {
    margin-top: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.acf-form-bookmark p {
    margin: 0 0 10px 0;
    padding-left: 0;
    color: inherit;
    font-size: inherit;
}

.acf-form-bookmark p:last-of-type {
    margin-bottom: 15px;
    font-size: inherit;
}

.form-link-input {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.1em;
    background: rgba(0, 0, 0, 0.03);
    color: inherit;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.form-link-input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Responsive Design */
@media (max-width: 768px) {

    .acf-applications-form h1 {
        font-size: 24px;
    }

    .acf-applications-form h2 {
        font-size: 22px;
    }

    .acf-form-submit .acf-button {
        width: 100%;
        padding: 14px 20px;
    }

    .acf-applications-success,
    .acf-applications-errors {
        margin: 20px;
        padding: 20px;
    }

    .acf-field[data-name="gdpr_consent"] {
        padding: 15px;
    }
}

/* Loading State */
.acf-form-submit .acf-button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.acf-form-submit .acf-button.loading::after {
    content: "...";
    margin-left: 5px;
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60%, 100% {
        content: "...";
    }
}

/* Accessibility Improvements */
.acf-field input:focus-visible,
.acf-field textarea:focus-visible,
.acf-field select:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .acf-form-submit {
        display: none;
    }
    
    .acf-form-bookmark {
        display: none;
    }
}