/* =====================================================
   Base
   Reset, tipografia i variables globals
===================================================== */

/* Variables globals de color, tipografia i espaiat.
   Permeten mantenir coherència visual i facilitar canvis de disseny. */
:root {
    --bg: #ffffff;
    --text: #0a253a;
    --muted: #4B5C68;

    --font-base: 'Rubik', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

    --border: #d7dde2;
    --surface: #ffffff;

    --shadow: 0 8px 24px rgba(15, 37, 53, 0.08);

    --primary: #ff7a00;
    --secondary: #0a253a;

    --radius: 12px;
    --radius-sm: 10px;
}

/* Reset bàsic */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

/* Estils base de tipografia i color del document */
body {
    font-family: var(--font-base);
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
}

p,
.label,
.input,
.auth-card__desc {
    font-weight: 400;
}

h1,
h2,
h3,
.btn {
    font-weight: 700;
}

a:hover {
    opacity: 0.7;
}

/* =====================================================
   Components UI
   Formularis, botons, targetes i missatges
===================================================== */

/* Estils pels formularis de l'aplicació */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form__row {
    display: flex;
    align-items: center;
    justify-content: center;
}

.label {
    font-size: 14px;
    color: var(--text);
}

.input,
.select {
    width: 100%;
    height: 55px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    outline: none;
    background: #fff;
    color: var(--text);
}

.select {
    height: 40px;
    margin-top: 10px;
}

.input:focus,
.select:focus {
    border-color: rgba(255, 122, 0, 0.65);
}

.radio {
    margin-right: 20px;
}

.check {
    display: inline-flex;
    gap: 10px;
    user-select: none;
    color: var(--text);
    font-size: 14px;
}

.check__input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

.field {
    position: relative;
}

.field-floating {
    position: relative;
}

.field-floating__input {
    padding: 16px 12px 10px;
}

/* Label flotant: comença centrada i puja en tenir focus o valor */
.field-floating__label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--muted);
    pointer-events: none;
    background: white;
    padding: 0 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

/* Ajust de posició de la label per a textarea */
.form__field--textarea .field-floating__label {
    top: 15%;
}

/* Estat actiu: focus o camp amb valor (placeholder-shown) */
.field-floating__input:focus+.field-floating__label,
.field-floating__input:not(:placeholder-shown)+.field-floating__label {
    top: 0px;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--primary);
}

.form__help {
    font-size: 14px;
    font-style: italic;
    opacity: 0.7;
}

/* =====================================================
   Mostrar/amagar contrasenya
   (controlat per password-toggle.js)
===================================================== */

.field-password {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--muted);
    font-size: 16px;
}

.password-toggle:hover {
    color: var(--text);
}

/* Focus accessible per navegació amb teclat */
.password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Ajust de padding de l'input per evitar que el botó se sobreposi al text */
.field-password .field-floating__input {
    padding-right: 42px;
}

/* =====================================================
   Botons i enllaços
===================================================== */

.btn {
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
    padding: 20px;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--secondary);
}

.btn--secondary {
    background: var(--secondary);
    color: #fff;
}

.btn--secondary:hover {
    background: var(--primary);
}

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

.link {
    text-decoration: none;
    font-weight: 600;
}

.link--muted {
    color: var(--muted);
    text-decoration: underline;
}

.link--primary {
    color: var(--primary);
    text-decoration: underline;
}

/* =====================================================
   Missatges que es mostren després d'una acció de l'usuari
===================================================== */

.alert {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    margin: 10px auto 20px;
}

.alert--error {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #b91c1c;
}

.alert--success {
    background: rgba(12, 238, 49, 0.08);
    border: 1px solid rgba(83, 100, 78, 0.25);
    color: #6c9374;
}