/* =========================================================
   VARIÁVEIS
========================================================= */

:root {
    --primary: #6c5ce7;
    --primary-dark: #5849d6;
    --primary-light: #f0eeff;

    --danger: #e74c3c;
    --danger-light: #fff1ef;

    --success: #27ae60;

    --background: #f5f6fa;
    --surface: #ffffff;

    --text: #222222;
    --text-secondary: #707070;
    --border: #e5e5e5;

    --shadow: 0 8px 30px rgba(0, 0, 0, 0.07);

    --radius: 16px;
    --radius-small: 10px;
}


/* =========================================================
   RESET
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: "Poppins", sans-serif;
}

button,
input,
select {
    font-family: inherit;
}

button {
    cursor: pointer;
}

input,
select {
    outline: none;
}


/* =========================================================
   LOGIN
========================================================= */

.login-container {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px 20px;

    background:
        radial-gradient(
            circle at top left,
            rgba(108, 92, 231, 0.12),
            transparent 35%
        ),
        radial-gradient(
            circle at bottom right,
            rgba(108, 92, 231, 0.08),
            transparent 35%
        ),
        var(--background);
}


/* Card */

.login-card {
    width: 100%;
    max-width: 430px;

    padding: 40px 35px;

    background: var(--surface);

    border: 1px solid rgba(0, 0, 0, 0.04);

    border-radius: 22px;

    box-shadow: var(--shadow);

    text-align: center;
}


/* Ícone */

.login-icon {
    width: 70px;
    height: 70px;

    margin: 0 auto 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 20px;

    background: var(--primary-light);
    color: var(--primary);

    font-size: 27px;
}


/* Título */

.login-card h1 {
    margin-bottom: 8px;

    color: var(--text);

    font-size: 25px;
    font-weight: 700;
}


/* Descrição */

.login-description {
    margin-bottom: 30px;

    color: var(--text-secondary);

    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
}


/* =========================================================
   CAMPOS
========================================================= */

.input-group {
    width: 100%;
    margin-bottom: 20px;

    text-align: left;
}

.input-group label {
    display: block;

    margin-bottom: 8px;

    color: var(--text);

    font-size: 13px;
    font-weight: 600;
}


/* Campo com ícone */

.input-wrapper {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
}

.input-wrapper > i {
    position: absolute;

    left: 15px;

    color: #999;

    font-size: 15px;

    pointer-events: none;
}


/* Inputs */

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    height: 48px;

    padding: 0 15px 0 43px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: #fafafa;

    color: var(--text);

    font-size: 14px;
    font-weight: 500;

    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--primary);

    background: #fff;

    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.10);
}

.input-wrapper input::placeholder {
    color: #aaa;
}


/* =========================================================
   BOTÕES
========================================================= */

.btn-primary {
    width: 100%;
    min-height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    border: none;
    border-radius: var(--radius-small);

    background: var(--primary);
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);

    box-shadow: 0 7px 18px rgba(108, 92, 231, 0.25);

    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}


/* =========================================================
   PAINEL ADMINISTRATIVO
========================================================= */

.admin-container {
    min-height: 100vh;

    padding-bottom: 50px;
}


/* =========================================================
   CABEÇALHO
========================================================= */

.admin-header {
    width: 100%;

    min-height: 82px;

    padding: 16px 5%;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}


/* Título */

.admin-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-title-icon {
    width: 50px;
    height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 14px;

    background: var(--primary-light);
    color: var(--primary);

    font-size: 21px;
}

.admin-header h1 {
    color: var(--text);

    font-size: 21px;
    font-weight: 700;
}

.admin-header p {
    margin-top: 2px;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 500;
}


/* Botão sair */

.btn-logout {
    min-height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 0 17px;

    border: 1px solid #f0d6d3;
    border-radius: 10px;

    background: var(--danger-light);
    color: var(--danger);

    font-size: 13px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.btn-logout:hover {
    background: #ffe5e2;

    transform: translateY(-1px);
}


/* =========================================================
   CONTEÚDO
========================================================= */

.admin-content {
    width: min(1100px, 90%);

    margin: 35px auto;

    display: grid;

    grid-template-columns: minmax(0, 430px) minmax(0, 1fr);

    align-items: start;

    gap: 25px;
}


/* =========================================================
   CARDS
========================================================= */

.admin-card {
    width: 100%;

    background: var(--surface);

    border: 1px solid rgba(0, 0, 0, 0.04);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    overflow: hidden;
}


/* Cabeçalho do card */

.card-header {
    padding: 23px 25px;

    border-bottom: 1px solid #eeeeee;
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--text);

    font-size: 17px;
    font-weight: 700;
}

.card-header h2 i {
    color: var(--primary);

    font-size: 16px;
}

.card-header p {
    margin-top: 5px;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}


/* =========================================================
   FORMULÁRIO
========================================================= */

.product-form {
    padding: 25px;
}

.form-group {
    width: 100%;

    margin-bottom: 19px;
}

.form-group > label {
    display: block;

    margin-bottom: 8px;

    color: var(--text);

    font-size: 13px;
    font-weight: 600;
}


/* =========================================================
   LINHA DE PREÇOS
========================================================= */

.form-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 15px;
}


/* =========================================================
   PREFIXO R$
========================================================= */

.input-prefix {
    position: absolute;

    left: 14px;

    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 600;

    pointer-events: none;

    z-index: 2;
}


/*
   Como os campos de preço usam .input-prefix
   em vez de um ícone, o input também precisa
   reservar espaço para o R$.
*/

.input-prefix + input {
    padding-left: 40px;
}


/* =========================================================
   SELECT
========================================================= */

.input-wrapper select {
    appearance: none;

    padding-right: 40px;

    cursor: pointer;
}


/* =========================================================
   BOTÃO DO FORMULÁRIO
========================================================= */

.btn-submit {
    margin-top: 5px;
}


/* =========================================================
   LISTA DE PRODUTOS
========================================================= */

.products-card {
    min-width: 0;
}

.admin-product-list {
    padding: 20px 25px;
}


/* =========================================================
   ITEM DO PRODUTO
========================================================= */

.admin-product-item {
    position: relative;

    padding: 16px 17px !important;

    margin-bottom: 10px !important;

    border: 1px solid var(--border) !important;

    border-radius: 12px;

    background: #fff;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

.admin-product-item:last-child {
    margin-bottom: 0 !important;
}

.admin-product-item:hover {
    border-color: #d8d3fa !important;

    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.05);

    transform: translateY(-1px);
}


/* Nome do produto */

.admin-product-item strong {
    display: inline-block;

    max-width: calc(100% - 10px);

    margin-bottom: 8px;

    color: var(--text);

    font-size: 14px;
    font-weight: 700;

    line-height: 1.5;
}


/* =========================================================
   BOTÕES GERADOS PELO JAVASCRIPT
========================================================= */

.admin-product-item button {
    min-height: 34px;

    padding: 0 12px;

    margin-top: 7px;
    margin-right: 5px;

    border-radius: 8px;

    font-family: "Poppins", sans-serif;

    font-size: 12px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}


/* Editar */

.admin-product-item button:first-of-type {
    border: 1px solid #d9d5fa;

    background: var(--primary-light);
    color: var(--primary);
}

.admin-product-item button:first-of-type:hover {
    background: #e6e2ff;

    transform: translateY(-1px);
}


/* Excluir */

.admin-product-item button:last-of-type {
    border: 1px solid #f2d2ce;

    background: var(--danger-light);
    color: var(--danger) !important;
}

.admin-product-item button:last-of-type:hover {
    background: #ffe4e1;

    transform: translateY(-1px);
}

/* =========================================================
   Pesquisa
========================================================= */

.search-box {
    flex: 1;

    height: 48px;

    background: white;

    border: 1px solid var(--border);

    border-radius: 14px;

    display: flex;
    align-items: center;

    padding: 0 13px;

    transition: .2s;

    margin-top: 10px;
}


.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, .10);
}


.search-box > i {
    color: #999;
    font-size: 15px;

    margin-right: 9px;
}


.search-box input {
    width: 100%;
    height: 48px;

    border: 0;
    outline: 0;

    background: transparent;

    font-family: inherit;
    font-size: 13px;
    color: var(--text);
}


.search-box input::placeholder {
    color: #999;
}


/* =========================================================
   CARREGANDO
========================================================= */

.loading {
    min-height: 100px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 500;

    text-align: center;
}

.loading i {
    color: var(--primary);

    font-size: 16px;
}


/* =========================================================
   RESPONSIVIDADE
========================================================= */

@media (max-width: 850px) {

    .admin-content {
        grid-template-columns: 1fr;

        width: min(700px, 92%);
    }

    .products-card {
        order: 2;
    }

    .admin-card:first-child {
        order: 1;
    }
}


/* =========================================================
   TABLET / CELULAR
========================================================= */

@media (max-width: 600px) {

    .login-container {
        padding: 20px 15px;
    }

    .login-card {
        padding: 32px 23px;

        border-radius: 18px;
    }

    .login-icon {
        width: 62px;
        height: 62px;

        margin-bottom: 18px;

        border-radius: 17px;

        font-size: 24px;
    }

    .login-card h1 {
        font-size: 22px;
    }


    /* Cabeçalho */

    .admin-header {
        min-height: auto;

        padding: 15px 18px;

        align-items: flex-start;
    }

    .admin-header-title {
        gap: 10px;
    }

    .admin-title-icon {
        width: 43px;
        height: 43px;

        border-radius: 12px;

        font-size: 18px;
    }

    .admin-header h1 {
        font-size: 18px;
    }

    .admin-header p {
        font-size: 10px;
    }

    .btn-logout {
        min-height: 39px;

        padding: 0 12px;

        font-size: 11px;
    }

    .btn-logout i {
        font-size: 12px;
    }


    /* Conteúdo */

    .admin-content {
        width: calc(100% - 24px);

        margin: 20px auto;

        gap: 18px;
    }


    /* Cards */

    .card-header {
        padding: 19px 18px;
    }

    .card-header h2 {
        font-size: 15px;
    }

    .card-header p {
        font-size: 11px;
    }

    .product-form {
        padding: 20px 18px;
    }


    /* Preços */

    .form-row {
        grid-template-columns: 1fr;

        gap: 0;
    }


    /* Lista */

    .admin-product-list {
        padding: 16px;
    }

    .admin-product-item {
        padding: 14px !important;
    }

    .admin-product-item strong {
        font-size: 13px;
    }
}


/* =========================================================
   CELULARES PEQUENOS
========================================================= */

@media (max-width: 380px) {

    .login-card {
        padding: 28px 18px;
    }

    .login-card h1 {
        font-size: 20px;
    }

    .admin-header {
        padding: 13px;
    }

    .admin-header p {
        display: none;
    }

    .btn-logout {
        padding: 0 10px;
    }

    .btn-logout {
        font-size: 0;
    }

    .btn-logout i {
        font-size: 14px;
        margin: 0;
    }

    .admin-content {
        width: calc(100% - 18px);
    }
}


/* =========================================================
   ACESSIBILIDADE
========================================================= */

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(108, 92, 231, 0.25);
    outline-offset: 2px;
}


/* =========================================================
   REDUZIR ANIMAÇÕES
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}