@charset "UTF-8";

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');


:root{
    /* Cores Molde.me */
    --roxo-principal: #7D5ABE;    /* primária: botões e destaques */
    --roxo-hover: #5C4489;        /* hover */
    --texto: #322941;             /* cor do texto corrido */
    --superficie: #EDECEE;        /* superfícies claras / bordas suaves */
    --amarelo-acento: #FFBE46;    /* foco/destaque */

    /* Derivados */
    --fundo: #FFFFFF;
    --muted: rgba(50, 41, 65, 0.7);
    --anel-acento: rgba(255, 190, 70, 0.45);   /* “ring” de foco acessível */

    /* Espaços */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* Radius e sombra */
    --radius: 12px;
    --shadow-card: 0 6px 20px rgba(0,0,0,0.06);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.10);

    /* Largura do container */
    --container: 1080px;
}

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

html, body { 
    height: 100%; 
}

body {
    margin: 0;
    font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--texto);
    background: var(--fundo);
    display: flex; 
    flex-direction: column;
}

/* Tipografia base */
h1, h2, p { 
    margin: 0 0 var(--space-4); 
}

/* Mídia base */
img { 
    max-width: 100%; 
    height: auto; 
    display: block; 
}

/* Foco acessível global */
:where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid var(--amarelo-acento);
    outline-offset: 2px;
}

/* Layout*/
main.container { 
    flex: 1; 
} 

.container {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

#form-medida .grid { 
    margin-bottom: var(--space-4); 
}

/* Componentes */
header.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
}

header.container img {
    height: 56px;
    width: auto;
}

header.container h1 {
    font-size: clamp(1.75rem, 1.1rem + 1.5vw, 2.25rem);
    font-weight: 600;
    color: var(--roxo-hover);
}

/* Card */
.card {
    background: #fff;
    border: 1px solid var(--superficie);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: var(--space-5);
    margin-block: var(--space-5);
    transition: box-shadow .2s ease;
    max-width: 920px;
    margin-inline: auto;
}

.card:hover { 
    box-shadow: var(--shadow-hover); 
}

.card > h2 {
    font-size: clamp(1.25rem, 1.05rem + .5vw, 1.5rem);
    font-weight: 600;
    color: var(--roxo-principal);
    margin-bottom: var(--space-4);
    text-align: left;
}

/* Campos */
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.925rem;
    color: var(--muted);
}

/* Inputs/select com baixa especificidade */
:where(input[type="text"], input[type="number"], select) {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--superficie);
    border-radius: var(--radius);
    background: #fff;
    color: var(--texto);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

:where(input[type="text"], input[type="number"], select):hover {
    border-color: #d9d7de;
}

:where(input[type="text"], input[type="number"], select):focus {
    border-color: var(--roxo-principal);
    box-shadow: 0 0 0 3px var(--anel-acento);
}

/* Botões principais */
#btn-adicionar, button[type="submit"], button.btn-primary {
    appearance: none;
    border: none;
    border-radius: var(--radius);
    background: var(--roxo-principal);
    color: #fff;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, box-shadow .15s ease, transform .03s ease;
}

#btn-adicionar:hover, button[type="submit"]:hover, button.btn-primary:hover {
    background: var(--roxo-hover);
}

#btn-adicionar:active, button[type="submit"]:active, button.btn-primary:active {
    transform: translateY(1px);
}

#btn-adicionar:disabled, button[type="submit"]:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Tabela */
.table-wrapper {
    width: 100%;
    border: 1px solid var(--superficie);
    border-radius: var(--radius);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

thead th {
    text-align: center;
    font-weight: 600;
    padding: 12px;
    background: var(--superficie);
    color: var(--texto);
    position: sticky; 
    top: 0;
    z-index: 1;
    word-break: normal;
    overflow-wrap: normal; 
}

tbody td {
    padding: 12px;
    border-top: 1px solid var(--superficie);
    word-break: normal;
    text-align: center;
}

tbody td:nth-child(1) {
    white-space: normal;
    overflow-wrap: normal;  
    word-break: keep-all; 
}

tbody tr:nth-child(even) {
    background: #faf9fb;
}

/* Botão secundário */
.btn-remover {
    appearance: none;
    border: 1px solid var(--roxo-principal);
    background: transparent;
    color: var(--roxo-principal);
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    line-height: 1;
    white-space: nowrap;
}

.btn-remover:hover {
    background: rgba(125, 90, 190, 0.08);
}

.btn-remover:focus-visible {
    box-shadow: 0 0 0 3px var(--amarelo-acento);
}

.btn-remover span { 
    pointer-events: none; 
}

/* Status tabela */
.table-wrapper > #status-tabela {
    margin-top: 0px;
    padding: var(--space-4) 12px 0; 
    border-top: 1px solid var(--superficie);
    color: var(--muted);
    font-size: 0.925rem;
    display: flex;
    align-items: center;  
} 

/* Rodapé */
.site-footer { 
  border-top: 1px solid var(--superficie);
  padding: var(--space-1);
  text-align: center;
}

/* Utilitários */
.muted { 
    color: var(--muted); 
    font-size: 0.925rem; 
    margin-top: var(--space-3); 
}

/* Esconder visualmente (acessibilidade) */
.sr-only{
    position: absolute !important;  
    width: 1px; 
    height: 1px;        
    padding: 0; 
    margin: -1px;       
    overflow: hidden;               
    clip: rect(0,0,0,0);           
    white-space: nowrap;           
    border: 0;
}

/* Padrão desktop: mostra textos completos, esconde abreviações */
.full { 
    display: inline; 
}

.short { 
    display: none; }

/* Media queries */
/* Tablet */
@media (max-width: 768px) {
    .grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
}

/* Mobile */
@media (max-width: 480px) {
    .grid { 
        grid-template-columns: 1fr; 
    }

    .card > h2 { 
        text-align: center !important; 
    }

    #btn-adicionar, button[type="submit"], button.btn-primary {
        display: block !important;
        width: 100% !important;             
        margin: var(--space-4) auto 0;
        text-align: center !important; 
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    thead th, tbody td { 
        padding: 8px; 
    }

    thead th {
        white-space: nowrap;
        word-break: keep-all;
    }

    .full { 
        display: none; 
    }

    .short { 
        display: inline; 
    }
    
    .btn-remover { 
        padding: 8px 10px;
        min-width: 36px;
        line-height: 1;
    }

}