/* ==============================
   FORM BASE
   ============================== */
form {
    width: 100%;
}

/* ==============================
   FORM GROUP / FLOATING LABEL
   ============================== */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--gainsboro-color);
    border-radius: 6px;
    background-color: var(--white-color);
    color: var(--dark-charcoal-color);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue-color);
    box-shadow: 0 0 5px rgba(0, 0, 255, 0.2);
}

/* Floating label */
.form-group label {
    position: absolute;
    top: 12px;
    left: 12px;
    color: var(--sonic-silver-color);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-group input:focus+label,
.form-group input:not(:placeholder-shown)+label,
.form-group textarea:focus+label,
.form-group textarea:not(:placeholder-shown)+label,
.form-group select:focus+label,
.form-group select:not([value=""]):valid+label {
    top: -8px;
    left: 10px;
    font-size: 12px;
    background-color: var(--white-color);
    padding: 0 4px;
    color: var(--blue-color);
}

/* ==============================
   TEXTAREA
   ============================== */
textarea {
    min-height: 120px;
    resize: vertical;
}

/* ==============================
   SELECT
   ============================== */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M2%204l4%204%204-4'%20stroke='%23777'%20stroke-width='2'%20fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    padding-right: 36px;
}

/* ==============================
   CHECKBOX AND RADIO
   ============================== */
input[type="checkbox"],
input[type="radio"] {
    display: none;
}

input[type="checkbox"]+label,
input[type="radio"]+label {
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    display: inline-block;
    font-size: 16px;
    color: var(--dark-charcoal-color);
    user-select: none;
}

/* Checkbox custom */
input[type="checkbox"]+label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    border: 1px solid var(--gainsboro-color);
    border-radius: 4px;
    background-color: var(--white-color);
    transition: all 0.3s ease;
}

input[type="checkbox"]:checked+label::before {
    background-color: var(--blue-color);
    border-color: var(--blue-color);
}

input[type="checkbox"]:checked+label::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 9px;
    width: 6px;
    height: 12px;
    border: solid var(--white-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Radio custom */
input[type="radio"]+label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    border: 1px solid var(--gainsboro-color);
    border-radius: 50%;
    background-color: var(--white-color);
    transition: all 0.3s ease;
}

input[type="radio"]:checked+label::before {
    border-color: var(--blue-color);
}

input[type="radio"]:checked+label::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--blue-color);
}

/* ==============================
   FILE INPUT
   ============================== */
input[type="file"] {
    padding: 6px;
}

/* ==============================
   DISABLED / ERROR STATES
   ============================== */
input:disabled,
textarea:disabled,
select:disabled {
    background-color: var(--anti-flash-white-color);
    cursor: not-allowed;
    color: var(--sonic-silver-color);
}

.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: var(--lust-color);
}

.form-group.error label {
    color: var(--lust-color);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media screen and (max-width: 768px) {

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 14px;
        padding: 10px;
    }

    .form-group label {
        font-size: 14px;
    }

    input[type="checkbox"]+label,
    input[type="radio"]+label {
        font-size: 14px;
        padding-left: 24px;
    }

    input[type="checkbox"]+label::before,
    input[type="radio"]+label::before {
        width: 18px;
        height: 18px;
    }

    input[type="radio"]:checked+label::after {
        width: 8px;
        height: 8px;
        top: 5px;
        left: 5px;
    }

    input[type="checkbox"]:checked+label::after {
        left: 4px;
        top: 8px;
        width: 5px;
        height: 10px;
    }
}

@media screen and (max-width: 480px) {

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 13px;
        padding: 8px;
    }

    .form-group label {
        font-size: 13px;
    }

    input[type="checkbox"]+label,
    input[type="radio"]+label {
        font-size: 13px;
        padding-left: 22px;
    }

    input[type="checkbox"]+label::before,
    input[type="radio"]+label::before {
        width: 16px;
        height: 16px;
    }

    input[type="radio"]:checked+label::after {
        width: 7px;
        height: 7px;
        top: 4px;
        left: 4px;
    }

    input[type="checkbox"]:checked+label::after {
        left: 3px;
        top: 7px;
        width: 4px;
        height: 9px;
    }
}
