/**
 * IABT Forms Styles
 */

.iabt-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.iabt-form-wrapper h2 {
    color: #333;
    margin-bottom: 10px;
}

.iabt-form-description {
    color: #666;
    margin-bottom: 30px;
}

.iabt-form-section {
    margin-bottom: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.iabt-form-section h3 {
    color: #0073aa;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.section-description {
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
}

.iabt-form-field {
    margin-bottom: 20px;
}

.iabt-form-field label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.iabt-form-field .required {
    color: #d63638;
}

.iabt-input,
.iabt-textarea,
.iabt-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.iabt-input:focus,
.iabt-textarea:focus,
.iabt-select:focus {
    border-color: #0073aa;
    outline: none;
}

.iabt-radio-group label,
.iabt-checkbox-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: normal;
}

.iabt-radio-group input[type="radio"],
.iabt-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

/* Checkbox with additional fields */
.iabt-checkbox-item {
    margin-bottom: 15px;
}

.iabt-checkbox-expandable {
    border-left: 3px solid #0073aa;
    padding-left: 10px;
    transition: border-color 0.3s ease;
}

.iabt-checkbox-expandable:hover {
    border-color: #005a87;
}

.iabt-checkbox-loading {
    color: #666;
    font-style: italic;
    padding: 10px;
}

/* Additional fields container */
.iabt-additional-fields {
    margin-top: 15px;
    margin-left: 25px;
    padding: 15px;
    background: #f0f7ff;
    border: 1px solid #d0e5f5;
    border-radius: 4px;
}

.iabt-additional-field {
    margin-bottom: 15px;
}

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

.iabt-additional-field label {
    font-size: 14px;
    color: #555;
    margin-bottom: 5px;
}

.iabt-additional-field .iabt-input,
.iabt-additional-field .iabt-select,
.iabt-additional-field .iabt-textarea {
    width: 100%;
}

.iabt-file-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.field-help-text {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.iabt-form-submit {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #ddd;
}

.iabt-submit-btn {
    background-color: #0073aa;
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.iabt-submit-btn:hover {
    background-color: #005a87;
}

.iabt-submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.iabt-loading {
    display: inline-block;
    margin-left: 15px;
    color: #666;
    font-style: italic;
}

.iabt-form-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

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

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

.iabt-form-message p {
    margin: 0 0 10px 0;
}

.iabt-form-message p:last-child {
    margin-bottom: 0;
}

.iabt-form-message ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

.iabt-form-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

/* Conditional Fields */
.iabt-field-conditional {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.iabt-field-conditional.iabt-field-visible {
    display: block;
    opacity: 1;
    max-height: 1000px;
}

/* Repeater Fields */
.iabt-repeater-container {
    margin-top: 10px;
}

.iabt-repeater-items {
    margin-bottom: 15px;
}

.iabt-repeater-item {
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.iabt-repeater-item:hover {
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.iabt-repeater-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.iabt-repeater-item-title {
    color: #0073aa;
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.iabt-repeater-remove-btn {
    background-color: #d63638;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s, transform 0.2s;
}

.iabt-repeater-remove-btn:hover {
    background-color: #a02a2c;
    transform: translateY(-2px);
}

.iabt-repeater-remove-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.iabt-repeater-item-fields {
    display: grid;
    gap: 15px;
}

.iabt-repeater-nested-field {
    margin-bottom: 0;
}

.iabt-repeater-actions {
    text-align: center;
    margin-top: 15px;
}

.iabt-repeater-add-btn {
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.iabt-repeater-add-btn:hover {
    background-color: #005a87;
    transform: translateY(-2px);
}

.iabt-repeater-add-btn:active {
    transform: translateY(0);
}

/* Hide template items */
.iabt-repeater-template {
    display: none !important;
}

/* Duplicate course warning */
.has-duplicate .iabt-select {
    border-color: #d63638;
    background-color: #fff8f8;
}

.iabt-duplicate-warning {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Promo Code Verification */
.iabt-input-with-button {
    display: flex;
    gap: 10px;
    align-items: center;
}

.iabt-input-with-button .iabt-input {
    flex: 1;
}

.iabt-verify-btn {
    background-color: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.3s, transform 0.2s;
}

.iabt-verify-btn:hover {
    background-color: #135e96;
    transform: translateY(-1px);
}

.iabt-verify-btn:active {
    transform: translateY(0);
}

.iabt-verify-btn:disabled {
    background-color: #8c8f94;
    cursor: not-allowed;
    transform: none;
}

.iabt-verification-result {
    margin-top: 8px;
    padding: 10px;
    border-radius: 4px;
    animation: fadeIn 0.3s ease;
}

.iabt-verification-result.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.iabt-verification-result.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.iabt-verification-result .success-message {
    color: #155724;
    font-weight: bold;
    margin: 0 0 5px 0;
}

.iabt-verification-result .error-message {
    color: #721c24;
    font-weight: bold;
    margin: 0;
}

.iabt-verification-result .loading-message {
    color: #856404;
    margin: 0;
}

.iabt-verification-result .discount-info {
    color: #155724;
    font-size: 15px;
    font-weight: 600;
    margin: 5px 0;
}

.iabt-verification-result .promo-description {
    color: #155724;
    font-size: 13px;
    margin: 5px 0 0 0;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .iabt-form-wrapper {
        padding: 10px;
    }

    .iabt-form-section {
        padding: 15px;
    }

    .iabt-submit-btn {
        width: 100%;
        padding: 12px;
    }

    .iabt-repeater-item {
        padding: 15px;
    }

    .iabt-repeater-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .iabt-repeater-remove-btn {
        width: 100%;
        justify-content: center;
    }

    .iabt-repeater-add-btn {
        width: 100%;
        padding: 12px;
    }

    .iabt-input-with-button {
        flex-direction: column;
        align-items: stretch;
    }

    .iabt-verify-btn {
        width: 100%;
        padding: 12px;
    }
}

/* File Upload Status Indicators */
.iabt-file-status {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.iabt-file-status.uploading {
    color: #2271b1;
}

.iabt-file-status.uploaded {
    color: #00a32a;
}

.iabt-file-status.error {
    color: #d63638;
}

.iabt-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.iabt-upload-icon.success {
    background-color: #00a32a;
    color: #fff;
}

.iabt-upload-icon.success svg {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.iabt-upload-icon.error {
    background-color: #d63638;
    color: #fff;
    font-size: 14px;
}

.iabt-upload-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(34, 113, 177, 0.3);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: iabt-spin 0.6s linear infinite;
}

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

.iabt-upload-text {
    vertical-align: middle;
}

/* File uploaded wrapper - positions file info and remove button horizontally */
.iabt-file-uploaded-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background-color: #f0f6fc;
    border: 1px solid #c8e1ff;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.iabt-file-uploaded-wrapper:hover {
    background-color: #e6f2ff;
    border-color: #8cc8ff;
}

/* File info - contains icon and filename */
.iabt-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0; /* Allows text truncation */
}

.iabt-file-name {
    font-size: 14px;
    font-weight: 500;
    color: #0d1117;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modern remove button styling */
.iabt-remove-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    background-color: transparent;
    color: #57606a;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.iabt-remove-file-btn svg {
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.iabt-remove-file-btn:hover {
    background-color: #f6f8fa;
    border-color: #ff4444;
    color: #d1242f;
}

.iabt-remove-file-btn:active {
    background-color: #f0f0f0;
    transform: scale(0.97);
}

.iabt-file-hint {
    display: block;
    margin-top: 5px;
    color: #646970;
    font-size: 13px;
}

/* Hide file input after upload */
.iabt-file-input {
    display: block;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.iabt-file-input:hover {
    border-color: #2271b1;
}

.iabt-file-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ============================================
   Group Fields (Office Addresses)
   ============================================ */

.iabt-group-container {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.iabt-group-items {
    margin-bottom: 20px;
}

.iabt-group-item {
    background: #fff;
    border: 2px solid #10a37f;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.iabt-group-item:hover {
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.15);
}

.iabt-group-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.iabt-group-item-title {
    color: #10a37f;
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.iabt-group-remove-btn {
    background-color: #d63638;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s, transform 0.2s;
}

.iabt-group-remove-btn:hover {
    background-color: #a02a2c;
    transform: translateY(-2px);
}

.iabt-group-remove-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.iabt-group-item-fields {
    display: grid;
    gap: 15px;
}

.iabt-group-nested-field {
    margin-bottom: 0;
}

.iabt-group-actions {
    text-align: center;
    padding: 15px 0;
}

.iabt-group-add-btn {
    background-color: #10a37f;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

.iabt-group-add-btn:hover {
    background-color: #0d8a6a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 163, 127, 0.3);
}

.iabt-group-add-btn:active {
    transform: translateY(0);
}

.iabt-group-hint {
    color: #666;
    font-size: 13px;
    font-style: italic;
    margin-top: 10px;
    margin-bottom: 0;
}

/* Hide template items */
.iabt-group-template {
    display: none !important;
}

/* Responsive adjustments for group fields */
@media (max-width: 768px) {
    .iabt-group-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .iabt-group-remove-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Table Fields
   ============================================ */

.iabt-table-wrapper {
    margin: 15px 0;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.iabt-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    min-width: 600px;
}

.iabt-table thead {
    background-color: #f5f5f5;
}

.iabt-table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.iabt-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.iabt-table tbody tr:last-child {
    border-bottom: none;
}

.iabt-table tbody tr:hover {
    background-color: #fafafa;
}

.iabt-table tbody td {
    padding: 10px 15px;
    vertical-align: middle;
}

.iabt-table-input,
.iabt-table-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.iabt-table-input:focus,
.iabt-table-select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Responsive table */
@media (max-width: 768px) {
    .iabt-table-wrapper {
        border: none;
        box-shadow: none;
    }

    .iabt-table {
        min-width: 100%;
        display: block;
    }

    .iabt-table thead {
        display: none;
    }

    .iabt-table tbody {
        display: block;
    }

    .iabt-table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 6px;
        padding: 15px;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .iabt-table tbody td {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
        text-align: left;
    }

    .iabt-table tbody td:last-child {
        border-bottom: none;
    }

    .iabt-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        margin-bottom: 5px;
        color: #333;
    }
}

/* ============================================
   Other Checkbox Option
   ============================================ */

.iabt-checkbox-other {
    border-left: 3px solid #ffa500;
    padding-left: 10px;
    transition: border-color 0.3s ease;
}

.iabt-checkbox-other:hover {
    border-color: #ff8c00;
}

.iabt-other-text-container {
    margin-left: 25px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.iabt-other-text-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.iabt-other-text-input:focus {
    border-color: #ffa500;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.1);
}

.iabt-other-text-input::placeholder {
    color: #999;
    font-style: italic;
}

/* ========================================
   COURSE PREFILL WARNING STYLES
   ======================================== */

/**
 * Soft warning message for course prefill issues
 * Displayed when a course slug is invalid or not mapped
 */
.iabt-prefill-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 13px;
    line-height: 1.5;
}

.iabt-prefill-warning .dashicons {
    color: #ffc107;
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Ensure warning doesn't break layout in repeater items */
.iabt-repeater-nested-field .iabt-prefill-warning {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .iabt-prefill-warning {
        font-size: 12px;
        padding: 8px 10px;
    }
}

/* ========================================
   CONTACT FORM SPECIFIC STYLES
   ======================================== */

/**
 * Remove wrapper padding and margins for contact form
 */
[data-form-type="contact"].iabt-form-wrapper {
    margin: 0;
    padding: 0;
    max-width: none;
}

/**
 * Remove section padding, margin, and background for contact form
 */
[data-form-type="contact"] .iabt-form-section {
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

/**
 * 2-column layout for Personal Information section in contact form
 * Targets only the first section of the contact form
 */
[data-form-type="contact"] .iabt-form-section:first-child .iabt-form-field {
    display: inline-block;
    width: calc(50% - 10px);
    vertical-align: top;
}

[data-form-type="contact"] .iabt-form-section:first-child .iabt-form-field:nth-child(odd) {
    margin-right: 20px;
}

/* Mobile: Stack fields vertically for better UX on small screens */
@media (max-width: 768px) {
    [data-form-type="contact"] .iabt-form-section:first-child .iabt-form-field {
        width: 100%;
        margin-right: 0 !important;
    }
}
