form {
    display: flex;
    flex-flow: column nowrap;
    gap: 1rem;
    margin: 0 0 2rem 0;
}

form.change-password {
    max-width: 24rem;
}

form.change-password fieldset {
    flex-flow: column nowrap;
}

form h1,
form h2,
form h3,
form h4,
form h5,
form h6 {
    margin-bottom: 0;
}

form h1:first-child,
form h2:first-child,
form h3:first-child,
form h4:first-child,
form h5:first-child,
form h6:first-child {
    margin-top: 0;
}

details+form,
summary+form {
    margin-top: 2rem;
}

fieldset {
    border-radius: 0.5em;
    display: flex;
    flex-flow: column nowrap;
    padding: 1rem;
    gap: 1rem;
    border: 1px solid var(--border-color);
    align-items: flex-start;
}

fieldset:empty {
    display: none;
}

form>fieldset {
    flex-flow: row wrap;
}

.revisao form>fieldset {
    flex-wrap: nowrap;
}

@media (max-width: 670px) {
    .revisao form>fieldset {
        flex-flow: column nowrap;
    }
}

.revisao form>fieldset .field {
    flex: 1;
}

.revisao form>fieldset .field.textarea {
    flex: 2;
}

.revisao form>fieldset textarea {
    min-height: 4.5rem;
}

.field {
    display: flex;
    flex-flow: row wrap;
    gap: 0.5rem 0.25rem;
    margin-bottom: 1rem;
}

fieldset.field,
.field:last-child {
    margin: 0;
    /* flex: 0 1 calc(20% - 0.80em); */
}

.field:first-child {
    flex: 1 1 100%;
}

.field>* {
    flex: 0 1 100%;
}

.field p {
    margin: 0.25em 0 0 0;
    font-size: 0.92em;
    font-weight: 500;
    line-height: 1.2em;
}

.field.title {
    flex: 0 1 100%;
}

@keyframes error-field-show {
    0% {
        opacity: 0;
        padding: 0;
        max-height: 0;
    }

    100% {
        opacity: 1;
        padding: 0.5em 1em;
        max-height: max-content;
    }
}

.error-field {
    color: var(--color-error);
    background-color: var(--color-error-inverse);
    padding: 0.5em 1em;
    border-radius: 0.5em;
    font-size: 0.9em;
    font-weight: 500;
    max-height: 5em;
    animation: error-field-show 0.5s ease-out;
    transition: 0.4ms;
}

.error-field.removing {
    opacity: 0;
    padding: 0;
    max-height: 0;
    transition: 0.5s;
    margin: -0.5rem 0;
}

.error-form {
    color: var(--color-error);
    background-color: var(--color-error-inverse);
    padding: 0.5em 1em;
    border-radius: 0.5em;
    font-size: 0.9em;
    font-weight: 500;
    max-height: 5em;
    animation: error-field-show 0.5s ease-out;
    transition: 0.4ms;
}

.error-form.removing {
    opacity: 0;
    padding: 0;
    max-height: 0;
    transition: 0.5s;
    margin: -0.5rem 0;
}


.msg-form {
    padding: 0.75em 1em;
    border-radius: 0.5em;
    border: 1px solid;
    font-size: 1.2em;
    font-weight: 500;
    max-height: 5em;
    width: max-content;
    animation: error-field-show 0.5s ease-out;
    transition: 0.4ms;
    position: sticky;
    top: 1em;
    left: 1em;
    max-width: 100%;
}

.msg-form.error {
    color: var(--color-error);
    background-color: var(--color-error-inverse);
}

.msg-form.success {
    color: var(--color-success);
    background-color: var(--color-success-inverse);
}

.msg.removing,
.msg-form.removing {
    opacity: 0;
    padding: 0;
    max-height: 0;
    transition: 0.5s;
    margin: -0.5rem 0;
}

.field.password input {
    flex: 0 1 calc(100% - 2.75rem);
}

.field.password button {
    flex: 0 1 2.5rem;
    background: hsl(from var(--surface-color) h s calc(l - 20)) url('/assets/eye-closed-white.svg') no-repeat center / 1.3em;
    position: relative;
}

.field.password button.allow {
    background-image: url('/assets/eye-open-white.svg');
}

.field.textarea,
.field.file,
.field.text {
    flex-basis: 100%;
    width: 100%;
}

.field>label {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-weight: 700;
}

.field>label small {
    font-weight: lighter;
}

.field.image img {
    width: 100%;
    object-fit: cover;
    border-radius: 0.25rem;
}

input,
select,
textarea {
    font-size: inherit;
    border-radius: 0.25em;
    border: 1px solid var(--border-color);
    padding: 0.5em;
}

textarea {
    resize: vertical;
    min-height: 4em;
}

.input-checkbox input+label {
    display: inline;
}

.buttons {
    display: flex;
    flex-flow: column wrap;
    gap: 0.5rem;
    align-items: center;
}

.button,
button {
    cursor: pointer;
    font-weight: 600;
    font-size: inherit;
    transition: 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25em;
    border-radius: 0.5rem;
    padding: 0.5em 0.75em;
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

@media (max-width: 640px) {

    .button .button,
    .buttons button {
        width: 100%;
    }
}

button:not(.see-password):hover {
    opacity: 0.8;
}

.submit,
button[type="submit"] {
    font-family: var(--font-title);
    font-weight: 700;
    background-color: var(--color-emphasis);
    color: var(--color-emphasis-over);
    border: none;
}

button[type='submit']:disabled,
button[type='submit']:disabled:hover,
button:disabled {
    background-color: var(--bg-disabled) !important;
    opacity: 0.4;
    cursor: default;
}

button.super {
    border-width: 3px;
    color: #000;
    background-color: var(--theme-color-amarelo);
    height: 3.5rem;
    border-radius: 4rem;
    font-size: 110%;
    font-weight: 800;
    margin: 1rem 0;
}

button.delete {
    background-color: var(--color-error);
    color: var(--color-error-inverse);
}

@keyframes spin {
    0% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(359deg);
    }
}

form.loading {
    opacity: 0.5;
}

form.loading .field.password button.allow::after {
    display: none;
}

form.loading button[type="submit"] {
    color: transparent;
    position: relative;
}

.loading button[type="submit"]::before {
    content: "";
    background: transparent url(/assets/loading.png) no-repeat center / 80%;
    animation: spin 1s linear infinite;
    position: absolute;
    width: 2em;
    height: 2em;
    margin: -1em auto auto -1em;
    top: 50%;
    left: 50%;
    border-radius: 50%;
}

.field.input-checkbox {
    flex-flow: row nowrap;
    align-items: center;
}

input[type="checkbox"] {
    flex: 0 0 1.5em;
}

.placeholder-loading {
    background: url('/assets/placeholder-loading.svg') 0 0 / 100%;
    height: calc(50vw - 4rem);
    width: 100%;
    animation: placeholder-loading 2s ease-in-out infinite;
}

form.inscricao .field.id_categoria {
    flex-basis: 100%;
}

form.inscricao .field.id_categoria.selected {
    flex-basis: calc(100% - 15rem);
}

form.inscricao .valores {
    flex-basis: 10rem;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

form.inscricao .descricoes>div,
form.inscricao .valores>div {
    display: none;
}

form.inscricao .descricoes>div {
    margin: 1rem 0 3rem 0;
}

form.inscricao .descricoes b {
    white-space: pre-line;
}

form.inscricao .valores b {
    font-size: 1.75rem;
    font-weight: 700;
}

form.inscricao .descricoes>div.show,
form.inscricao .valores>div.show {
    display: flex;
    flex-flow: column nowrap;
    gap: 0.25rem;
}

.dados {
    display: flex;
    flex-flow: column nowrap;
    gap: 1.5rem;
    flex: 1;
}

.dados .field.read label {
    color: var(--text-color-weak);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.dados .field.read label+* {
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 400;
}

.confirmacao {
    display: none;
}

.confirmacao fieldset {
    background-color: var(--bg-color-over);
}

.descricoes {
    flex: 100%;
}

@keyframes placeholder-loading {
    0% {
        opacity: 0.2;
    }

    50% {
        opacity: 0.9;
    }

    100% {
        opacity: 0.2;
    }
}

@media (max-width: 580px) {
    form.inscricao .field.id_categoria.selected {
        flex-basis: 100%;
    }

    form.inscricao .descricoes,
    form.inscricao .valores {
        flex-basis: 100%;
        text-align: center;
    }

    form.inscricao .descricoes>div,
    form.inscricao .valores>div {
        padding: 1rem 0 0 0;
    }
}

@media (min-width: 640px) {
    .field {
        flex: 1 1 calc(40% - 0.5rem);
        align-content: flex-start;
    }

    .buttons {
        flex-flow: row wrap;
        width: 100%;
    }

    .auth-dialog .buttons {
        flex-flow: column nowrap;
    }

    .button.submit,
    button[type="submit"] {
        order: 2;
        margin-left: auto;
    }

    .auth-dialog button[type="submit"] {
        order: unset;
        margin-left: unset;
    }
}

@media (min-width: 960px) {
    .field {
        flex: 1 1 calc(25% - 0.5rem);
        align-content: flex-start;
    }
}

table input[type='checkbox'],
table input[type='radio'] {
    width: 60%;
    height: 1em;
}

form header {
    flex: 1 0 100%;
    display: flex;
    align-items: center;
    text-align: center;
    flex-flow: column nowrap;
}
form header figure {
    margin: 0;
}
form header figure img {
    border-radius: 50%;
    margin: -2em 0 1em 0;
    border: 0.5em solid var(--color-base-surface-opaque);
}
form header .buttons {
    justify-content: center;
}


/* Esconde o input file nativo, mas mantém acessível se necessário */
.field.write.video input[type="file"] {
    display: none; 
}

/* Estilo do preview de vídeo */
.field.write.video video {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 4px;
    background: #000;
    margin-bottom: 10px;
}

/* Área de botões */
.video-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.file-controls {
    display: flex;
    gap: 0.5rem;
}

/* Botão principal (Label estilizada) */
.btn-upload {
    display: inline-block;
    padding: 8px 16px;
    background-color: #007bff; /* Azul */
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.3s;
    text-align: center;
}

.btn-upload:hover {
    background-color: #0056b3;
}

/* Botão de remover */
.btn-remove {
    padding: 8px 16px;
    background-color: #dc3545; /* Vermelho */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-remove:hover {
    background-color: #a71d2a;
}

/* Texto de ajuda dinâmico */
.video-status-text {
    font-size: 0.9em;
    color: #555;
    font-style: italic;
    margin-top: 5px;
    padding: 8px;
    background: #e9ecef;
    border-left: 3px solid #007bff;
    border-radius: 2px;
}

/* Texto de instrução original */
.field.write.video > p {
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
}

/* Campo de upload com erro de validação */
.field.error {
    border: 2px solid var(--color-error, #dc3545);
    border-radius: 0.5em;
    padding: 0.5em;
    background-color: hsl(from var(--color-error, #dc3545) h s l / 0.05);
}

.field.error .file-controls button[type="button"]:first-child {
    animation: pulse-error 2s ease-in-out infinite;
}

@keyframes pulse-error {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(220, 53, 69, 0);
    }
}