/**
 * EML Forms - Public Styles
 */

/* ========================================
   Form Reset & Base
   ======================================== */

.eml-form-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

.eml-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0 20px;
}

.eml-form *,
.eml-form *::before,
.eml-form *::after {
    box-sizing: border-box;
}

/* ========================================
   Field Wrapper & Widths
   ======================================== */

.eml-field-wrap {
    margin-bottom: 20px;
    position: relative;
}

.eml-w-100 { width: 100%; }
.eml-w-75  { width: calc(75% - 15px); }
.eml-w-66  { width: calc(66.666% - 13.333px); }
.eml-w-50  { width: calc(50% - 10px); }
.eml-w-33  { width: calc(33.333% - 13.333px); }
.eml-w-25  { width: calc(25% - 15px); }

/* ========================================
   Labels
   ======================================== */

.eml-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: #1d2327;
}

.eml-required {
    color: #d63638;
    margin-left: 2px;
}

/* ========================================
   Inputs
   ======================================== */

.eml-input-wrap {
    position: relative;
}

.eml-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.eml-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.eml-input::placeholder {
    color: #98a6b5;
}

.eml-textarea {
    resize: vertical;
    min-height: 100px;
}

.eml-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.eml-file-input {
    padding: 8px;
    border-style: dashed;
    cursor: pointer;
}

.eml-file-input:hover {
    border-color: #0073aa;
    background: #f0f6fc;
}

/* ========================================
   Checkboxes & Radios
   ======================================== */

.eml-checkbox-group,
.eml-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eml-checkbox-label,
.eml-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 0;
}

.eml-checkbox-label input[type="checkbox"],
.eml-radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #0073aa;
    cursor: pointer;
}

.eml-gdpr-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px 14px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}

.eml-gdpr-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.eml-gdpr-label a {
    color: #0073aa;
    text-decoration: underline;
}

/* ========================================
   Layout Variants
   ======================================== */

/* Label Top (Default) */
.eml-layout-label-top .eml-label {
    display: block;
    margin-bottom: 6px;
}

/* Label Left */
.eml-layout-label-left .eml-field-wrap {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.eml-layout-label-left .eml-label {
    flex: 0 0 160px;
    text-align: right;
    padding-top: 10px;
    margin-bottom: 0;
}

.eml-layout-label-left .eml-input-wrap {
    flex: 1;
}

.eml-layout-label-left .eml-field-error {
    margin-left: 175px;
}

/* Label Right */
.eml-layout-label-right .eml-field-wrap {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.eml-layout-label-right .eml-input-wrap {
    flex: 1;
    order: -1;
}

.eml-layout-label-right .eml-label {
    flex: 0 0 160px;
    padding-top: 10px;
    margin-bottom: 0;
}

/* Floating Label */
.eml-layout-label-floating .eml-input-wrap {
    position: relative;
}

.eml-layout-label-floating .eml-floating-label {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 15px;
    font-weight: 400;
    color: #98a6b5;
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
    padding: 0 4px;
    margin: 0;
}

.eml-layout-label-floating .eml-textarea + .eml-floating-label {
    top: 14px;
    transform: none;
}

.eml-layout-label-floating .eml-input:focus + .eml-floating-label,
.eml-layout-label-floating .eml-input:not(:placeholder-shown) + .eml-floating-label,
.eml-layout-label-floating .eml-input.has-value + .eml-floating-label {
    top: -8px;
    transform: none;
    font-size: 12px;
    font-weight: 600;
    color: #0073aa;
    background: #fff;
}

.eml-layout-label-floating .eml-input {
    padding: 14px 14px 6px;
}

/* Label Hidden */
.eml-layout-label-hidden .eml-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Decorative Fields
   ======================================== */

.eml-field-divider hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 10px 0;
}

.eml-field-heading h2,
.eml-field-heading h3,
.eml-field-heading h4 {
    margin: 10px 0 5px;
    color: #1d2327;
}

/* ========================================
   Validation Errors
   ======================================== */

.eml-field-error {
    font-size: 13px;
    color: #d63638;
    margin-top: 4px;
    min-height: 0;
}

.eml-field-wrap.has-error .eml-input {
    border-color: #d63638;
}

.eml-field-wrap.has-error .eml-input:focus {
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.15);
}

/* ========================================
   Submit Button
   ======================================== */

.eml-submit-wrap {
    width: 100%;
    margin-top: 10px;
}

.eml-align-left   { text-align: left; }
.eml-align-center { text-align: center; }
.eml-align-right  { text-align: right; }
.eml-align-full .eml-btn-submit { width: 100%; }

.eml-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.5;
}

.eml-btn-submit {
    background: #0073aa;
    color: #fff;
    min-width: 140px;
}

.eml-btn-submit:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

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

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

.eml-btn-submit.loading::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: eml-spin 0.8s linear infinite;
}

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

/* ========================================
   Multi-Step
   ======================================== */

.eml-step {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0 20px;
}

.eml-step[style*="display: none"] {
    display: none !important;
}

.eml-step-nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.eml-btn-prev,
.eml-btn-next {
    background: #f0f0f0;
    color: #1d2327;
}

.eml-btn-prev:hover,
.eml-btn-next:hover {
    background: #e0e0e0;
}

/* Progress Indicators */
.eml-progress {
    margin-bottom: 25px;
}

.eml-progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.eml-progress-fill {
    height: 100%;
    background: #0073aa;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.eml-progress-text {
    font-size: 13px;
    color: #666;
    text-align: center;
}

.eml-progress-steps {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.eml-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.eml-step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.eml-progress-step.active .eml-step-number,
.eml-progress-step.completed .eml-step-number {
    background: #0073aa;
    color: #fff;
}

.eml-progress-step.completed .eml-step-number {
    background: #00a32a;
}

.eml-step-label {
    font-size: 12px;
    color: #666;
}

.eml-progress-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.eml-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.3s ease;
}

.eml-dot.active {
    background: #0073aa;
    transform: scale(1.2);
}

/* ========================================
   Messages
   ======================================== */

.eml-form-messages {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.eml-form-messages.eml-success {
    background: #ecfbe6;
    border: 1px solid #00a32a;
    color: #00641b;
}

.eml-form-messages.eml-error {
    background: #fcf0f1;
    border: 1px solid #d63638;
    color: #8a1f1d;
}

/* ========================================
   Hidden / Conditional
   ======================================== */

.eml-hidden {
    display: none !important;
}

.eml-hp-wrap {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .eml-w-75,
    .eml-w-66,
    .eml-w-50,
    .eml-w-33,
    .eml-w-25 {
        width: 100%;
    }

    .eml-layout-label-left .eml-field-wrap,
    .eml-layout-label-right .eml-field-wrap {
        flex-direction: column;
    }

    .eml-layout-label-left .eml-label,
    .eml-layout-label-right .eml-label {
        flex: none;
        text-align: left;
        padding-top: 0;
    }

    .eml-layout-label-left .eml-field-error {
        margin-left: 0;
    }

    .eml-step-nav {
        flex-direction: column;
        gap: 10px;
    }

    .eml-btn {
        width: 100%;
    }
}
