/* ==========================================================================
   1. ESTILOS GLOBAIS E RESET
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #EE4D2D; /* Laranja Shopee */
    --secondary-color: #FF7B5A;
    --background-color-light: #f4f6f9; /* Cinza claro para fundos */
    --dark-color: #333;
    --light-color: #FFF;
    --grey-color: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    --green-color: #00a884; /* Verde para ações de sucesso/conexão */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color-light);
    color: var(--dark-color);
}

/* ==========================================================================
   2. ESTILOS DA PÁGINA DE LOGIN
   ========================================================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background-color: var(--light-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h1 {
    margin-bottom: 10px;
}

.login-container p {
    margin-bottom: 30px;
    color: var(--grey-color);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: var(--light-color);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #d73b1a;
}

.error-message {
    background-color: #ffdddd;
    color: #d8000c;
    border: 1px solid #d8000c;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
}

/* ==========================================================================
   3. ESTILOS DO DASHBOARD (ÁREA INTERNA)
   ========================================================================== */

/* Layout Principal */
.main-header {
    background-color: var(--light-color);
    padding: 10px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.logo h1 {
    color: var(--primary-color);
    font-size: 24px;
}

.user-nav span {
    margin-right: 20px;
    font-weight: 600;
}

.user-nav .logout-btn {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.main-footer {
    text-align: center;
    padding: 20px;
    color: var(--grey-color);
    margin-top: 40px;
}

/* Estilo dos Cards */
.card {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--box-shadow);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
}

.card p {
    color: #666;
    margin-bottom: 20px;
}

.connect-btn {
    display: inline-block;
    background-color: var(--green-color);
    color: var(--light-color);
    padding: 12px 25px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
}

.connect-btn:hover {
    background-color: #008a6e;
}

/* Estilo da Lista de Lojas */
.store-list {
    list-style: none;
    padding: 0;
}

.store-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
}

.store-list li:not(:last-child) {
    margin-bottom: 15px;
}

.store-list .store-name {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 18px;
}

.store-list .store-icon {
    margin-right: 15px;
    color: var(--primary-color);
}

.store-list .store-id {
    font-size: 14px;
    color: #777;
    background-color: #f5f5f5;
    padding: 5px 10px;
    border-radius: 5px;
}
/* ==========================================================================
   4. ESTILOS ADICIONAIS (Menu e Página de Produtos)
   ========================================================================== */

/* Estilos do Menu de Navegação Principal */
.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav a {
    text-decoration: none;
    color: var(--grey-color);
    font-weight: 600;
    padding: 10px;
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-nav a:hover, .main-nav a.active {
    background-color: #fcebe8;
    color: var(--primary-color);
}


/* Estilos da Tabela de Produtos */
.product-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.product-table th, .product-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.product-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--grey-color);
}

.product-table tbody tr:hover {
    background-color: #f8f9fa;
}

.product-image {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    object-fit: cover;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    margin: 0 4px;
    transition: background-color 0.3s ease;
}

.action-btn .material-icons {
    color: #fff;
    font-size: 18px;
}

.view-btn {
    background-color: #17a2b8; /* Azul */
}
.view-btn:hover {
    background-color: #138496;
}

.edit-btn {
    background-color: #ffc107; /* Amarelo */
}
.edit-btn:hover {
    background-color: #e0a800;
}
/* ==========================================================================
   5. ESTILOS DO GRID DE PRODUTOS
   ========================================================================== */

.product-grid {
    display: flex;
    flex-wrap: wrap; /* Permite que os cards quebrem para a próxima linha */
    gap: 25px;       /* Espaçamento entre os cards */
}

.product-card {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: calc(33.333% - 17px); /* <-- ESTE É O CRÍTICO para 3 colunas */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-image { /* Adicionamos o fundo branco ao container da imagem */
    background-color: #fff;
}

.card-image img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain; /* Exibe a imagem inteira, sem cortar */
}

.card-content {
    padding: 20px;
    flex-grow: 1; /* Faz esta área crescer para empurrar as ações para baixo */
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    /* Limita o nome a uma linha e adiciona "..." se for muito longo */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-sku {
    font-size: 12px;
    color: var(--grey-color);
    margin-bottom: 15px;
    flex-grow: 1; /* Empurra os detalhes para baixo */
}

.product-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.product-price {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
}

.product-stock {
    font-weight: 600;
    background-color: #f4f6f9;
    padding: 4px 8px;
    border-radius: 5px;
}

.card-actions {
    display: flex;
    border-top: 1px solid #f0f0f0;
}

.action-btn-card {
    flex: 1; /* Faz os botões dividirem o espaço igualmente */
    text-align: center;
    padding: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.action-btn-card.view-btn {
    color: #17a2b8;
}
.action-btn-card.view-btn:hover {
    background-color: #e8f7fa;
}

.action-btn-card.edit-btn {
    color: #e0a800;
    border-left: 1px solid #f0f0f0;
}
.action-btn-card.edit-btn:hover {
    background-color: #fff8e1;
}

/* --- Responsividade para Telas Menores --- */

/* Telas de tablet */
@media (max-width: 992px) {
    .product-card {
        width: calc(50% - 13px); /* 2 colunas */
    }
}

/* Telas de celular */
@media (max-width: 768px) {
    .product-card {
        width: 100%; /* 1 coluna */
    }
}

/* ==========================================================================
   6. ESTILOS DO COMPONENTE DE PAGINAÇÃO
   ========================================================================== */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin-top: 20px;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
}

.page-item {
    margin: 0;
}

.page-link {
    display: block;
    padding: 10px 15px;
    background-color: #fff;
    color: var(--primary-color);
    text-decoration: none;
    border-left: 1px solid #eee;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.page-item:first-child .page-link {
    border-left: none;
}

.page-item:not(.disabled) .page-link:hover {
    background-color: #fcebe8;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    color: #fff;
    cursor: default;
}

.page-item.disabled .page-link {
    color: #ccc;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

/* Estilos para o selo de Variações */
.product-title-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.product-name {
    margin-bottom: 0; /* Remove a margem que estava antes */
}

.variation-badge {
    background-color: var(--secondary-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap; /* Impede que o texto quebre */
    text-transform: uppercase;
}
/* ==========================================================================
   7. ESTILOS DO MODAL DE VARIAÇÕES
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    color: #888;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

/* Estilo do Loader (Animação de Carregamento) */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    margin: 40px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ajuste no botão do card */
.action-btn-card.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
}
/* ==========================================================================
   7. ESTILOS DO MODAL DE VARIAÇÕES
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    color: #888;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.modal-body .product-table {
    margin-top: 0;
}

/* Loader */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    margin: 40px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ajuste no botão do card para parecer um link */
.action-btn-card.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}/* ==========================================================================
   7. ESTILOS DO ACORDEÃO DE VARIAÇÕES
   ========================================================================== */

/* Ajustes no botão para incluir ícone */
.toggle-variations-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Container da "gaveta" de variações */
.variations-container {
    padding: 0px 20px 20px 20px; /* Espaçamento interno */
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
}

.variations-container .product-table {
    margin-top: 0;
}
.variations-container .product-table td,
.variations-container .product-table th {
    font-size: 13px; /* Fonte menor para a tabela interna */
    padding: 10px;
}

/* Loader pequeno para o acordeão */
.loader-small {
    width: 25px;
    height: 25px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ==========================================================================
   8. ESTILOS DE PREÇO COM DESCONTO
   ========================================================================== */

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.original-price {
    font-size: 0.9rem;
    color: var(--grey-color);
    text-decoration: line-through;
    opacity: 0.8;
}

.current-price {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Estilo menor para a tabela de variações */
.product-table .original-price {
    font-size: 0.8rem;
    margin-right: 5px;
}
.product-table .current-price-small {
    font-weight: 700;
    color: var(--primary-color);
}
/* ==========================================================================
   9. ESTILOS DAS MÉTRICAS DO PRODUTO
   ========================================================================== */

.product-metrics {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 15px;
    border-top: 1px solid #f0f0f0;
    background-color: #fdfdfd;
    font-size: 0.9rem;
    color: var(--grey-color);
}

.product-metrics span {
    display: flex;
    align-items: center;
    gap: 6px; /* Espaço entre o ícone e o número */
}

.product-metrics .material-icons {
    font-size: 18px; /* Tamanho do ícone */
}