/* Albi Forms Frontend Styles */

.albi-form-container,
.albi-form-container * {
    box-sizing: border-box;
}

.albi-form-container {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 25px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

.albi-form-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
}

.albi-form-title {
    margin: 0 0 5px 0 !important;
    font-size: 22px !important;
    color: #1e293b;
    font-weight: 700;
}

.albi-form-desc {
    margin: 0 !important;
    font-size: 14px;
    color: #64748b;
}

/* Fields & Layout Wrap */
.albi-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.albi-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}

.albi-width-100 {
    width: 100%;
}
.albi-width-50 {
    width: calc(50% - 8px);
}
.albi-width-33 {
    width: calc(33.33% - 11px);
}
.albi-width-25 {
    width: calc(25% - 12px);
}

@media (max-width: 600px) {
    .albi-width-50, .albi-width-33, .albi-width-25 {
        width: 100% !important;
    }
}

.albi-field-label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #334155;
    margin: 0 !important;
}

.albi-required {
    color: #ef4444;
    margin-left: 2px;
}

.albi-field-input-wrapper input[type="text"],
.albi-field-input-wrapper input[type="email"],
.albi-field-input-wrapper input[type="tel"],
.albi-field-input-wrapper input[type="number"],
.albi-field-input-wrapper input[type="url"],
.albi-field-input-wrapper textarea,
.albi-field-input-wrapper select {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease;
}

.albi-field-input-wrapper input:focus,
.albi-field-input-wrapper textarea:focus,
.albi-field-input-wrapper select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
    outline: none !important;
}

.albi-field-description {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0 0 !important;
}

/* Layout Containers on Frontend */
.albi-frontend-container {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.albi-container-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.albi-container-fields .albi-field-wrap {
    box-sizing: border-box;
}

/* Repeater Group Container Styling */
.albi-container-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.albi-container-group {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}
.albi-is-repeatable .albi-container-group {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-sizing: border-box;
}
.albi-repeater-group-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}
.albi-repeater-remove-group {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #ef4444;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.albi-repeater-remove-group:hover {
    background: #fecaca;
    color: #b91c1c;
}
.albi-container-footer {
    margin-top: 12px;
}
.albi-repeater-add-group {
    background: #ffffff;
    border: 1px solid #3b82f6;
    color: #3b82f6;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.albi-repeater-add-group:hover {
    background: #3b82f6;
    color: #ffffff;
}

/* Submit Button */
.albi-form-submit-wrapper {
    margin-top: 20px;
    text-align: right;
}

.albi-submit-button {
    padding: 12px 24px !important;
    background: #3b82f6 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s ease;
}

.albi-submit-button:hover {
    background: #2563eb !important;
}

.albi-form-response {
    margin-bottom: 20px;
}

.albi-form-response:empty {
    display: none;
    margin-bottom: 0;
}

.albi-alert {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 40px 12px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.albi-alert-content {
    flex: 1;
    font-weight: 500;
}

.albi-alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.albi-alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.albi-alert-dismissible .albi-alert-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.albi-alert-dismissible .albi-alert-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.06);
}

/* Step Progress Bar */
.albi-form-progress-bar {
    background: #f1f5f9;
    border-radius: 9999px;
    height: 8px;
    position: relative;
    margin-bottom: 25px;
    overflow: hidden;
}
.albi-form-progress-bar-fill {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.albi-form-progress-text {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-top: 6px;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Step Navigation */
.albi-step-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}
.albi-prev-step-button,
.albi-next-step-button {
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.albi-prev-step-button {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}
.albi-prev-step-button:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
}
.albi-next-step-button {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border: 1px solid #3b82f6 !important;
    margin-left: auto;
}
.albi-next-step-button:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

/* File Upload Field */
.albi-file-input {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 2px dashed #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #475569 !important;
    background: #f8fafc !important;
    cursor: pointer !important;
    transition: all 0.2s ease;
}
.albi-file-input:hover {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
}
.albi-file-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
    outline: none !important;
}
.albi-file-info {
    font-size: 12px !important;
    color: #64748b !important;
    margin: 4px 0 0 0 !important;
}

/* Acceptance Field */
.albi-acceptance-label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    color: #334155 !important;
    cursor: pointer !important;
    line-height: 1.4 !important;
}
.albi-acceptance-label input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

/* Hidden Field (not visible on frontend) */
.albi-field-wrap[data-type="hidden"] {
    display: none !important;
}

/* Honeypot anti-spam field (hidden from users) */
.albi-honeypot {
    display: none !important;
}

/* Repeater remove button (hidden by default, shown via JS) */
.albi-repeater-remove-group {
    display: none;
}

/* URL Field */
.albi-field-input-wrapper input[type="url"] {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease;
}

/* Name Field */
.albi-name-fields {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    width: 100%;
}
.albi-name-fields input {
    flex: 0 0 auto;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    background: #ffffff !important;
    transition: all 0.2s ease;
}
.albi-name-fields input:only-of-type {
    width: 100%;
}
.albi-name-fields input:first-child:nth-last-child(2),
.albi-name-fields input:first-child:nth-last-child(2) ~ input {
    width: calc(50% - 5px);
}
.albi-name-fields input:first-child:nth-last-child(3),
.albi-name-fields input:first-child:nth-last-child(3) ~ input {
    width: calc(33.333% - 7px);
}
.albi-name-fields input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
    outline: none !important;
}

/* Address Field */
.albi-address-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.albi-address-fields input,
.albi-address-fields select {
    width: 100%;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease;
}
.albi-address-fields input:focus,
.albi-address-fields select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
    outline: none !important;
}
.albi-address-row {
    display: flex;
    gap: 10px;
}
.albi-address-row input,
.albi-address-row select {
    flex: 1;
}