/* ===========================================================
   Form page — styles for form.html / form_send.js
   Matches brand: red #ff0000 (hover #c70000), IBM Plex,
   neumorphic white cards on #ececec.
   Works alongside PicoCSS (scoped to the .pico wrapper).
   =========================================================== */

.form-section {
    background-color: #ececec;
    padding: 50px 0 80px;
}

.form-card {
    max-width: 780px;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    padding: 40px 44px;
}

/* ---- Header ---- */
.form-header {
    text-align: center;
    margin-bottom: 34px;
}
.form-header h1 {
    font-size: 30px;
    font-weight: bold;
    margin: 0 auto 10px;
    width: fit-content;
    padding-bottom: 6px;
    border-bottom: 4px solid #ff0000;
}
.form-header p {
    color: #666;
    font-size: 15px;
    margin: 0 auto;
    max-width: 440px;
}

/* ---- Sections ---- */
.form-block {
    border: none;
    padding: 0;
    margin: 0 0 30px;
}
.form-block-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 4px;
}
.form-block-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 20px;
    background: #ff0000;
    border-radius: 3px;
}
.form-block-hint {
    color: #808080;
    font-size: 13px;
    margin: 0 0 18px;
}

/* ---- Field grid ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 22px;
}
.form-grid .full {
    grid-column: 1 / -1;
}
.pico .form-card label {
    font-weight: 600;
    font-size: 14px;
}
.req {
    color: #ff0000;
    font-weight: bold;
}

/* Invalid fields (set via aria-invalid in JS) */
.pico .form-card input[aria-invalid="true"],
.pico .form-card select[aria-invalid="true"] {
    border-color: #c0392b;
}
.field-error {
    display: none;
    color: #c0392b;
    font-size: 12.5px;
    font-weight: 600;
    margin-top: -8px;
    margin-bottom: 12px;
}
.field-error.is-visible {
    display: block;
}

/* ---- File upload tiles ---- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.file-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 140px;
    padding: 14px;
    text-align: center;
    background: #fafafa;
    border: 2px dashed #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.file-tile:hover {
    border-color: #ff0000;
    background: #fff;
}
.file-tile.has-file {
    border-style: solid;
    border-color: #ff0000;
    background: #fff;
}
.file-tile input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.file-tile-icon {
    font-size: 26px;
    line-height: 1;
}
.file-thumb {
    display: none;
    width: 100%;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
}
.file-tile.has-file .file-thumb {
    display: block;
}
.file-tile.has-file .file-tile-icon {
    display: none;
}
.file-tile-label {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}
.file-tile-name {
    font-size: 11.5px;
    color: #777;
    word-break: break-word;
}
/* Scoped under .pico .form-card so it outranks Pico's button styling. */
.pico .form-card .file-remove {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: #ff0000;
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.pico .form-card .file-tile.has-file .file-remove {
    display: flex;
}
.pico .form-card .file-remove:hover {
    background: #c70000;
}

/* ---- Status / alert ---- */
.form-status {
    display: none;
    margin: 24px 0 0;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: break-word;
}
.form-status.is-visible {
    display: block;
}
.form-status.is-loading {
    background: #eef1fb;
    color: #33406b;
}
.form-status.is-loading::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 9px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: form-spin 0.7s linear infinite;
}
@keyframes form-spin {
    to {
        transform: rotate(360deg);
    }
}
.form-status.is-success {
    background: #e7f6ec;
    color: #1c7c3f;
    border: 1px solid #b7e2c4;
}
.form-status.is-error {
    background: #fdecec;
    color: #c0392b;
    border: 1px solid #f2c4c0;
}

/* ---- Submit button (brand red, overrides Pico blue) ---- */
.pico .form-card #send {
    width: 100%;
    margin-top: 6px;
    background: #ff0000;
    border-color: #ff0000;
    color: #fff;
    font-weight: bold;
    font-size: 18px;
}
.pico .form-card #send:hover {
    background: #c70000;
    border-color: #c70000;
}
.pico .form-card #send:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---- Responsive ---- */
@media screen and (max-width: 768px) {
    .form-card {
        padding: 28px 20px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-header h1 {
        font-size: 25px;
    }
}
