/* ==============================================
   DOC Form — Frontend Styles
   Path: css/doc-form.css
   =============================================== */

/* ── Wrapper ──────────────────────────────────── */
.doc-form-wrap {
    width: 100%;
    max-width: 720px;
}

/* ── Fields Grid ──────────────────────────────── */
.doc-form-field {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.fb-100, .fb100,
.fb-50, .fb50,
.fb-33, .fb33,
.fb-25, .fb25 {
    flex-basis: 100%;
}

@media (min-width: 768px) {
    .fb-50, .fb50 {
        flex-basis: calc(50% - (var(--parent-gap, 0px) * 1 / 2));
    }
    .fb-33, .fb33 {
        flex-basis: calc((100% / 3) - (var(--parent-gap, 0px) * 2 / 3));
    }
    .fb-25, .fb25 {
        flex-basis: calc(25% - (var(--parent-gap, 0px) * 3 / 4));
    }
}

/* ── Labels ───────────────────────────────────── */
.doc-form-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
    color: #1a1a1a;
}

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

/* ── Controls ─────────────────────────────────── */
.doc-form-control {
    min-height: 44px;
    padding: 0.6rem 1.2rem;
    font-size: 14px;
    color: #1a1a1a;
    background: var(--doc-gray-5, #f8fafc);
    border: 1px solid var(--doc-border, #ccd0d4);
    border-radius: var(--doc-radius, 6px);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    font-family: var(--font-inter, inherit);
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.doc-form-control:focus {
    border-color: var(--doc-blue-2, #4f9dd4);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(79, 157, 212, 0.15);
}

.doc-form-control.doc-form-control--error {
    border-color: #ef4444;
    background-color: #fff;
}

textarea.doc-form-control {
    resize: vertical;
    min-height: 120px;
}

select.doc-form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 1.2rem) center;
    background-size: 16px;
    padding-right: 45px;
    cursor: pointer;
}

/* Ensure url, number, and search fields get identical styling on the site */
.doc-form-style input[type="url"],
.doc-form-style input[type="number"],
.doc-form-style input[type="search"] {
    min-height: 44px !important;
    padding: 0.6rem 1.2rem !important;
    background: var(--doc-gray-5);
    border: 1px solid var(--doc-border) !important;
    border-radius: var(--doc-radius);
    font-family: var(--font-inter);
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.doc-form-style input[type="url"]:focus,
.doc-form-style input[type="number"]:focus,
.doc-form-style input[type="search"]:focus {
    background: #fff;
    border-color: var(--doc-blue-2) !important;
    box-shadow: 0 0 0 4px rgba(79, 157, 212, 0.15) !important;
    outline: none;
}

/* ── Fieldsets (radio / checkbox) ─────────────── */
.doc-form-fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.doc-form-fieldset legend.doc-form-label {
    margin-bottom: 6px;
}

.doc-form-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #334155;
    padding: 4px 0;
    cursor: pointer;
}

.doc-form-option-label input[type="radio"],
.doc-form-option-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ts-primary-color, #000);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Inline Error ─────────────────────────────── */
.doc-form-error {
    font-size: 12px;
    color: #ef4444;
    min-height: 16px;
    display: none;
}

.doc-form-error.is-visible {
    display: block;
}

/* ── Footer & Submit Button ───────────────────── */
.doc-form-footer {
    margin-top: 2rem;
}

.doc-form-submit {
    font-family: var(--font-ubuntu, inherit);
    font-size: var(--font-size-s, 14px);
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    color: #fff;
    border-radius: var(--doc-radius, 6px);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--box-shadow-3, 0 4px 6px rgba(0,0,0,0.05));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: linear-gradient(180deg, #575757 0%, #000000 100%) !important;
    border: 1px solid #000 !important;
}

.doc-form-submit:hover {
    background: linear-gradient(180deg, #676767 0%, #353535 100%) !important;
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-3-hover, 0 6px 8px rgba(0,0,0,0.1));
}

.doc-form-submit:active {
    transform: translateY(-1px);
}

.doc-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Spinner ──────────────────────────────────── */
.doc-form-submit__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: doc-form-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.doc-form-submit.is-loading .doc-form-submit__spinner {
    display: inline-block;
}

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

/* ── Response Message ─────────────────────────── */
.doc-form-response {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.doc-form-response.is-success {
    display: block;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    color: #15803d;
}

.doc-form-response.is-error {
    display: block;
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #b91c1c;
}
