@layer reset, base, layout, components, utilities;

@layer reset {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    /* https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/ */
    html {
        -moz-text-size-adjust: none;
        -webkit-text-size-adjust: none;
        text-size-adjust: none;
    }

    body,
    h1,
    h2,
    h3,
    h4,
    p,
    figure,
    blockquote,
    dl,
    dd {
        margin: 0;
    }

    body {
        min-block-size: 100vh;
        line-height: 1.6;
    }

    h1,
    h2,
    h3,
    button,
    input,
    label {
        line-height: 1.1;
    }

    h1,
    h2,
    h3,
    h4 {
        text-wrap: balance;
    }

    p,
    li {
        text-wrap: pretty;
    }

    img,
    picture {
        max-inline-size: 100%;
        display: block;
    }

    input,
    button,
    textarea,
    select {
        font: inherit;
    }

    ul {
        margin: 0;
        padding: 0;
    }
}

@layer base {
    :root {

        /*CUSTOM PROPERTIES*/
        --primary-white: #f2f5f9;
        --secondary-white: #fafaf9;
        --primary-black: #030616;
        --primary-blue: #263fa9;
        --secondary-blue: #5371f9;
        --primary-gray: #f8fafc1a;
        --fly-success: #28a745;
        --fly-warning: #ffc107;
        --fly-error: #dc3545;
        --transparent-white: ;

        font-family: "Outfit", sans-serif;

        font-size: 16px;

        /*BORDER RADIUS*/
        --border-radius-sm: 0.4rem;
        --border-radius-md: 0.8rem;
        --border-radius-lg: 1rem;
        --border-radius-xl: 1.2rem;
        --border-radius-full: 100%;
    }
}

@layer layout {
    body {
        max-width: 1280px;
        width: 100%;
        height: 100vh;
        margin: 0 auto;
        padding-inline: 1rem;
        background-image: url("./assets/qa-bg.jpg");
        background-position: center;
        background-size: cover;
    }

    section {
        flex-direction: column;
    }

    label {
        position: relative;
        display: block;
    }

    .logo {
        padding: 2rem;
    }

    .input-container {
        display: flex;
    }

    .input-wrapper {
        align-items: center;
        justify-content: space-between;
        position: relative;
        max-width: 616px;
    }

    .button-input {
        position: absolute;
        right: 9px;
    }

    .qr-code {
        background-color: var(--primary-white);
        padding: 1.6rem;
        border-radius: var(--border-radius-lg);
    }

    .qrcode-background {
        background-color: rgba(255, 255, 255, 0.15);
        width: 17.75rem;
        height: 17.75rem;
        border-radius: var(--border-radius-full);
        margin: 2rem;
    }

    .buttons {
        gap: 2rem;
        margin-top: 2rem;
    }

    .button-qrcode {
        gap: 0.8rem;
    }

    @media(width < 1025px) {
        body {
            max-width: 1024px;
        }
    }
}

@layer components {

    /*INPUT*/
    input {
        border-radius: var(--border-radius-xl);
        border: 2px solid var(--primary-blue);
        background: var(--primary-black);
        color: var(--primary-white);
        padding: 1.35rem;
    }

    input::placeholder {
        color: var(--primary-white);
        opacity: 1;
    }

    /*BUTTON*/
    button {
        background-color: var(--primary-blue);
        padding: 1rem 2.6rem;
        border: none;
        color: var(--primary-white);
        border-radius: 0.8rem;
        cursor: pointer;
    }

    button:hover {
        background-color: var(--secondary-blue);
        transition: all 0.2s ease-in-out;
    }

    button:active {
        transform: scale(0.9);
        filter: brightness(0.95);
        transition: all 0.2s ease-in-out;
    }

    /*FLY ALERT*/
    .fly-alert {
        position: fixed;
        top: 1.5rem;
        right: 1.5rem;
        padding: 1rem;
        border-radius: var(--border-radius-sm);
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        z-index: 1000;
        color: var(--primary-white);
    }

    .fly-alert.show {
        opacity: 1;
        transform: translateY(0);
    }

    .fly-success {
        background-color: var(--fly-success);
    }

    .fly-warning {
        background-color: var(--fly-warning);
        color: var(--primary-black);
    }

    .fly-error   {
        background-color: var(--fly-error);
    }

    /*SPINNER*/
    .spinner {
        border: 4px solid rgba(255, 255, 255, 0.4);
        border-top: 4px solid var(--primary-blue);
        border-radius: var(--border-radius-full);
        width: 3rem;
        height: 3rem;
        animation: spin 1s linear infinite;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 999;
    }

    /*SPINNER ANIMATION*/
    @keyframes spin {
        0% { transform: translate(-50%, -50%) rotate(0deg); }
        100% { transform: translate(-50%, -50%) rotate(360deg); }
    }

    @media(width < 1025px) {
        .fly-alert {
            padding: 0.8rem;
            font-size: 12px;
        }
    }

    @media(width < 641px) {
        .fly-alert {
            padding: 0.6rem;
            font-size: 10px;
        }
    }
}

@layer utilities {

    /*FLEX*/
    .flex {
        display: flex;
    }

    .flex-column {
        display: flex;
        flex-direction: column;
    }

    /*ALIGNMENT*/
    .align-center {
        align-items: center;
        justify-content: center;
    }

    /*WIDTH & HEIGHT*/
    .full-width {
        width: 100%;
    }

    .full-height {
        height: 100vh;
    }

    /*HIDDEN ELEMENTS*/
    .hidden{
        display: none;
    }

    .visually-hidden {
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        height: 1px;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }
}
