:root {
    /* Cores da Marca */
    --azul-escuro: #334563;
    --azul-medio: #4a618a;
    --azul-claro: #7793c1;
    --vermelho: #c83134;
    --vermelho-hover: #a52a2c;
    
    /* Cores de Interface */
    --branco: #ffffff;
    --cinza-fundo: #ecf0f5;
    --cinza-borda: #e0e0e0;
    --cinza-texto: #333333;
    --cinza-leitura: #666666;
    
    /* Status */
    --sucesso: #28a745;
    --erro: #dc3545;
    --alerta: #ffc107;
    
    /* Efeitos */
    --sombra: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 6px;
    --transicao: all 0.3s ease;
    
    /* ============== CARRINHO DE COMPRAS ============== */
    --cart-primary: #334563;
    --cart-success: #10b981;
    --cart-danger: #ef4444;
    --cart-warning: #f59e0b;
    --cart-info: #3b82f6;
    --cart-border: #e2e8f0;
    --cart-bg: #f8fafc;
    --cart-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- 1. RESET & BASE --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--cinza-fundo);
    color: var(--cinza-texto);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: var(--transicao); }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- 2. LAYOUT & GRID --- */
.container {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.main-content {
    flex: 1;
    padding: 30px 0;
    width: 100%;
}

/* --- 3. HEADER SIMPLES (Login/Erro) --- */
.simple-header {
    width: 100%;
    padding: 30px 0;
    background: transparent;
    z-index: 10;
}

.simple-header .header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.simple-header .logo a {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.simple-header .logo img {
    height: 70px;
    width: auto;
    background: none; border: none; box-shadow: none;
}

.simple-header h1 {
    color: var(--azul-escuro);
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

/* --- 4. RODAPÉ PADRÃO (Global) --- */
footer {
    background-color: var(--azul-escuro);
    color: var(--branco);
    padding: 25px 0;
    width: 100%;
    margin-top: auto;
    text-align: center;
}

footer .footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

footer p { margin: 0; opacity: 0.9; font-size: 0.9rem; }

footer .footer-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

footer .footer-links a {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
}
footer .footer-links a:hover { color: var(--branco); text-decoration: underline; }

/* --- 5. COMPONENTES GLOBAIS (Usados no Admin) --- */

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transicao);
    gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sombra); }

.btn-primary { background-color: var(--azul-escuro); color: var(--branco); }
.btn-primary:hover { background-color: var(--azul-medio); }
.btn-danger { background-color: var(--vermelho); color: var(--branco); }
.btn-secondary { background-color: var(--branco); border: 1px solid var(--azul-escuro); color: var(--azul-escuro); }

/* Cards (Caixas Brancas do Dashboard) */
.card {
    background: var(--branco);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--sombra);
    margin-bottom: 20px;
    border: 1px solid var(--cinza-borda);
}

/* Tabelas (Listagens) */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--branco);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--sombra);
}

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--cinza-borda);
}

.table th {
    background-color: var(--azul-escuro);
    color: var(--branco);
    font-weight: 600;
}

/* --- FORMULÁRIOS MODERNOS (Substitua a seção de formulários antiga) --- */

.form-group { margin-bottom: 20px; }

.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    color: var(--azul-escuro); 
    font-weight: 600; 
    font-size: 0.9rem;
}

/* O Estilo do Input Bonito */
.form-control, 
input[type="text"], 
input[type="email"], 
input[type="password"], 
select, 
textarea {
    width: 100%;
    padding: 12px 16px; /* Mais espaço interno */
    
    /* Borda suave e elegante */
    border: 1px solid #d1d9e6; 
    background-color: #fcfdfe; /* Fundo quase branco */
    border-radius: 8px; /* Cantos mais arredondados */
    
    font-size: 1rem;
    color: var(--cinza-texto);
    transition: all 0.3s ease; /* Animação suave */
    
    /* Sombra interna muito sutil para profundidade */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Estado de Foco (Quando clica no campo) */
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    /* A borda fica da cor da marca */
    border-color: var(--azul-escuro);
    background-color: #ffffff;
    outline: none;
    
    /* Sombra externa azulada (Glow) */
    box-shadow: 0 0 0 4px rgba(51, 69, 99, 0.15); 
}

/* Placeholders (Texto de ajuda) */
::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

/* Alertas */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    border-left: 5px solid transparent;
}
.alert-error { background-color: #f8d7da; color: #721c24; border-left-color: var(--vermelho); }
.alert-success { background-color: #d4edda; color: #155724; border-left-color: var(--sucesso); }

/* --- COMPONENTES DE FORMULÁRIO AVANÇADO (Vindo do caduser.php) --- */

/* Títulos de Seção com linha inferior */
.form-section-title {
    color: var(--azul-escuro);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eef2f6;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Sistema de Abas (Tabs) */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 25px;
    gap: 5px;
    overflow-x: auto; /* Permite rolagem no mobile */
}

.tab-link {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-link:hover {
    color: var(--azul-escuro);
    background-color: #f9f9f9;
}

.tab-link.active {
    color: var(--azul-escuro);
    border-bottom-color: var(--azul-escuro);
    background-color: #f0f7ff;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid de Permissões (Checkboxes) */
.permissions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--cinza-texto);
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.perm-item:hover {
    background-color: #e9ecef;
}

.perm-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--azul-escuro);
}

/* Grid Responsivo para Formulários */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media(min-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr 1fr; /* 2 colunas no PC */
    }
}

/* --- COMPONENTES: MODAIS (Janelas Flutuantes) --- */
.modal {
    display: none; /* Escondido por padrão */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5); /* Fundo escuro transparente */
    backdrop-filter: blur(4px); /* Desfoque no fundo */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

/* Conteúdo do Modal */
.modal-content {
    background-color: var(--branco);
    margin: auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
    width: 90%;
    max-width: 500px; /* Largura padrão */
    position: relative;
    animation: slideUp 0.3s;
    border: 1px solid var(--cinza-borda);
}

.modal-content.large { max-width: 800px; } /* Modal maior se precisar */

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; color: var(--azul-escuro); font-size: 1.2rem; }

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
}
.close-modal:hover { color: var(--vermelho); }

.modal-body { padding: 25px; }

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- CAMPO DE SENHA COM ÍCONE --- */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 40px; /* Espaço para o ícone não ficar em cima do texto */
}

.password-toggle-icon {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: #a0aec0;
    font-size: 1.1rem;
    transition: color 0.3s;
    z-index: 5;
    background: none;
    border: none;
    padding: 0;
}

.password-toggle-icon:hover {
    color: var(--azul-escuro);
}

/* ============================================
   CARRINHO DE COMPRAS - CSS MOBILE FIRST
   Versão: 1.0 | Data: 2024
   ============================================ */

/* Estados de Loading */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.spinner {
    font-size: 2.5rem;
    color: var(--cart-primary);
    margin-bottom: 15px;
}

.loading-state p {
    font-size: 1.1rem;
}

/* Container Principal */
.cart-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin-top: 20px;
}

/* Estado Vazio */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--cart-shadow);
}

.empty-state-icon {
    font-size: 4rem;
    color: #e2e8f0;
    margin-bottom: 20px;
}

.empty-state h2 {
    color: var(--cart-primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.empty-state p {
    color: #64748b;
    margin-bottom: 25px;
    font-size: 1rem;
    line-height: 1.5;
}

/* Grid de Itens */
.cart-items {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--cart-shadow);
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 15px;
    padding: 20px 0;
    border-bottom: 1px solid var(--cart-border);
    align-items: center;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--cart-border);
    background: white;
    padding: 5px;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-item-title {
    font-weight: 600;
    color: var(--cart-primary);
    font-size: 1rem;
    line-height: 1.3;
}

.cart-item-price {
    color: var(--cart-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.cart-item-sku {
    color: #64748b;
    font-size: 0.85rem;
}

/* Controle de Quantidade */
.qtd-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--cart-bg);
    padding: 8px 12px;
    border-radius: 10px;
    width: fit-content;
}

.qtd-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--cart-primary);
    font-weight: 600;
    padding: 0 8px;
    font-size: 1.2rem;
    transition: all 0.2s;
    border-radius: 5px;
}

.qtd-btn:not(:disabled):hover {
    background: rgba(51, 69, 99, 0.1);
}

.qtd-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qtd-input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 1rem;
    color: var(--cart-primary);
    outline: none;
}

/* Botões de Ação */
.btn-remove {
    color: var(--cart-danger);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    padding: 10px;
    border-radius: 8px;
    font-size: 1.1rem;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.05);
}

/* Resumo do Pedido */
.cart-summary {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--cart-shadow);
    position: sticky;
    top: 20px;
}

.cart-summary h3 {
    color: var(--cart-primary);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

/* Cupom de Desconto */
.coupon-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 25px;
}

.coupon-input {
    padding: 12px 15px;
    border: 2px solid var(--cart-border);
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
    transition: border-color 0.2s;
    text-transform: uppercase;
}

.coupon-input:focus {
    border-color: var(--cart-primary);
}

.btn-apply {
    background: var(--cart-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-apply:hover {
    background: #2a3a53;
    transform: translateY(-2px);
}

/* Cashback Switch */
.cashback-switch {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #bbf7d0;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cashback-label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #166534;
}

.cashback-label small {
    display: block;
    font-weight: normal;
    font-size: 0.85rem;
    color: #15803d;
}

/* Toggle Switch Moderno */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--cart-success);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Linhas do Resumo */
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    color: #64748b;
    font-size: 1rem;
}

.summary-row.discount {
    color: var(--cart-success);
    font-weight: 600;
}

.summary-row.cashback {
    color: #3b82f6;
    font-weight: 600;
}

.summary-row.cashback-earned {
    color: #f59e0b;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

.summary-row.total {
    color: var(--cart-primary);
    font-weight: 800;
    font-size: 1.3rem;
    border-top: 2px dashed var(--cart-border);
    padding-top: 20px;
    margin-top: 20px;
}

/* Botão de Checkout */
.btn-checkout {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--cart-success) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    margin-top: 20px;
}

.btn-checkout:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

/* Security Badge */
.security-badge {
    text-align: center;
    margin-top: 15px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.security-badge i {
    margin-right: 5px;
}

/* Animações adicionais */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsividade para Carrinho */
@media (min-width: 768px) {
    .cart-container {
        grid-template-columns: 1fr 350px;
        gap: 30px;
    }
    
    .cart-item {
        grid-template-columns: 100px 1fr auto auto;
    }
}

@media (min-width: 1024px) {
    .cart-container {
        grid-template-columns: 1fr 400px;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .btn-checkout,
    .btn-apply,
    .qtd-btn,
    .btn-remove {
        transition: none !important;
        transform: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cart-item {
        border-bottom: 2px solid #000;
    }
    
    .summary-row.total {
        border-top: 3px dashed #000;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .cart-items,
    .cart-summary,
    .empty-state {
        background: #1e293b;
        color: #e2e8f0;
    }
    
    .cart-item-title,
    .cart-item-price,
    .cart-summary h3 {
        color: #e2e8f0;
    }
    
    .cart-item {
        border-color: #475569;
    }
    
    .qtd-control {
        background: #334155;
    }
}

/* Fim do CSS do Carrinho */
