/* =========================================================================
   SISTEMA DE ESTILOS CSS - E-SHOP ACADÊMICO
   CSS Puro, Moderno, Responsivo e Sem Dependência de Frameworks.
   ========================================================================= */

/* --- Variáveis de Design (Design Tokens) --- */
:root {
    --font-primary: 'Inter', sans-serif;
    
    /* Cores Primárias e Secundárias */
    --color-primary: #4f46e5;       /* Índigo */
    --color-primary-hover: #4338ca;
    --color-primary-light: #e0e7ff;
    --color-secondary: #0f172a;     /* Slate Dark */
    --color-text-dark: #1e293b;     /* Texto principal */
    --color-text-light: #64748b;    /* Texto secundário */
    --color-bg-main: #f8fafc;       /* Fundo da página */
    --color-bg-card: #ffffff;       /* Fundo de cartões */
    
    /* Estados de Feedback */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    
    /* Bordas e Sombras */
    --color-border: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transições */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* --- Reset e Configurações Globais --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-main);
    color: var(--color-text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Cabeçalho (Header) --- */
.main-header {
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-secondary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.logo-accent {
    color: var(--color-primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-light);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-primary);
    background-color: var(--color-bg-main);
}

.nav-divider {
    width: 1px;
    height: 24px;
    background-color: var(--color-border);
}

/* Carrinho Link e Badge */
.cart-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-badge {
    background-color: var(--color-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Status do Usuário Autenticado */
.welcome-user {
    font-size: 14px;
    color: var(--color-text-dark);
}

.my-orders-btn {
    border: 1px solid var(--color-primary-light);
    color: var(--color-primary) !important;
}

.my-orders-btn:hover {
    background-color: var(--color-primary) !important;
    color: #ffffff !important;
}

/* Botões de Ação na Nav */
.login-btn-nav {
    border: 1px solid var(--color-border);
}

.register-btn-nav {
    background-color: var(--color-primary);
    color: #ffffff !important;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition-fast);
}

.register-btn-nav:hover {
    background-color: var(--color-primary-hover);
}

.logout-btn {
    color: var(--color-danger);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    transition: var(--transition-fast);
}

.logout-btn:hover {
    background-color: var(--color-danger-light);
    border-radius: var(--radius-sm);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle .bar {
    height: 2px;
    width: 100%;
    background-color: var(--color-secondary);
    border-radius: 2px;
    transition: var(--transition-fast);
}

/* --- Área de Conteúdo Principal --- */
.main-content {
    flex: 1;
    padding: 40px 0;
}

/* --- Rodapé (Footer) --- */
.main-footer {
    background-color: var(--color-secondary);
    color: #ffffff;
    padding: 40px 0 20px 0;
    margin-top: auto;
}

.footer-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.footer-info h3 {
    margin-bottom: 10px;
    font-weight: 600;
}

.footer-info p {
    color: #94a3b8;
    font-size: 14px;
}

.footer-divider {
    height: 1px;
    background-color: #334155;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #64748b;
}

.academic-credits {
    color: #94a3b8;
    font-style: italic;
}

/* --- Página Inicial (Hero Section) --- */
.hero-section {
    background: linear-gradient(135deg, #4f46e5 0%, #312e81 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    margin-bottom: 48px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.hero-section h1 {
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.hero-section p {
    font-size: 18px;
    color: #e0e7ff;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition-normal);
    border: none;
}

.btn-primary {
    background-color: #ffffff;
    color: var(--color-primary);
}

.btn-primary:hover {
    background-color: #f1f5f9;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* --- Títulos de Seção --- */
.section-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-secondary);
    margin-bottom: 24px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 4px;
    background-color: var(--color-primary);
    border-radius: 2px;
    margin-top: 8px;
}

/* --- Grid de Produtos --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.product-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary-light);
}

.product-info {
    flex: 1;
    margin-bottom: 20px;
}

.product-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-secondary);
    margin-bottom: 10px;
}

.product-desc {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

/* Indicadores de estoque */
.stock-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.stock-ok {
    background-color: var(--color-success-light);
    color: var(--color-success);
}

.stock-out {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}

/* Botões de Ação do Card */
.btn-buy {
    width: 100%;
    padding: 10px 16px;
    background-color: var(--color-primary);
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-buy:hover {
    background-color: var(--color-primary-hover);
}

.btn-buy:disabled {
    background-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

/* --- Formulários (Login, Cadastro, Admin) --- */
.form-container {
    max-width: 460px;
    margin: 40px auto;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    color: var(--color-secondary);
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-dark);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-primary);
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--color-text-dark);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.btn-form {
    width: 100%;
    background-color: var(--color-primary);
    color: #ffffff;
    margin-top: 10px;
}

.btn-form:hover {
    background-color: var(--color-primary-hover);
}

.form-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--color-text-light);
}

.form-footer a {
    color: var(--color-primary);
    font-weight: 500;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* --- Alertas de Status --- */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
    border: 1px solid #fecaca;
}

/* --- Tabelas de Carrinho e Pedidos --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-bg-card);
    text-align: left;
    font-size: 15px;
}

.table th, .table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: var(--color-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background-color: #f8fafc;
}

/* Carrinho: Ações e Input de Quantidade */
.cart-qty-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cart-qty-input {
    width: 60px;
    padding: 6px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.btn-remove {
    color: var(--color-danger);
    background: transparent;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
}

.btn-remove:hover {
    text-decoration: underline;
}

/* Carrinho Checkout Card */
.cart-checkout-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.checkout-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.checkout-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 16px;
}

.checkout-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-secondary);
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
    margin-top: 16px;
}

.btn-checkout {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--color-success);
    color: #ffffff;
    margin-top: 20px;
}

.btn-checkout:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

/* Carrinho Vazio */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.empty-state h2 {
    margin-bottom: 12px;
    color: var(--color-secondary);
}

.empty-state p {
    color: var(--color-text-light);
    margin-bottom: 24px;
}

/* --- Consulta de Pedidos (Acordeão/Listas) --- */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.order-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.order-header {
    background-color: #f1f5f9;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--color-border);
}

.order-meta-group {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.order-meta-item {
    font-size: 14px;
    color: var(--color-text-light);
}

.order-meta-item strong {
    color: var(--color-secondary);
}

.order-total-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
}

.order-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.order-details-table th, .order-details-table td {
    padding: 12px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.order-details-table th {
    font-weight: 600;
    color: var(--color-text-light);
    text-align: left;
    background-color: #fafafa;
}

.order-details-table tr:last-child td {
    border-bottom: none;
}

/* --- Sucesso e Confirmação de Pedidos --- */
.success-card {
    text-align: center;
    max-width: 600px;
    margin: 40px auto;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 50px 40px;
    box-shadow: var(--shadow-lg);
}

.success-icon {
    width: 72px;
    height: 72px;
    background-color: var(--color-success-light);
    color: var(--color-success);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    margin: 0 auto 24px auto;
}

.success-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-secondary);
    margin-bottom: 16px;
}

.success-card p {
    color: var(--color-text-light);
    margin-bottom: 30px;
}

/* --- Responsividade (Media Queries) --- */
@media (max-width: 768px) {
    /* Menu de Navegação Colapsado */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--color-bg-card);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 12px;
        box-shadow: var(--shadow-lg);
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-divider {
        display: none;
    }
    
    .welcome-user {
        text-align: center;
        padding: 8px 0;
    }
    
    .mobile-menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .mobile-menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    /* Outros ajustes móveis */
    .hero-section {
        padding: 40px 20px;
    }
    
    .hero-section h1 {
        font-size: 28px;
    }
    
    .form-container {
        padding: 24px;
    }
    
    .order-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
