/* Reset e Estilos Gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;

/* Estilos para alertas */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

/* Estilos para estatísticas */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Estilos para avaliações */
.star {
    color: #ffc107;
    font-size: 1.2rem;
}

.rating-input .star {
    cursor: pointer;
    transition: color 0.2s ease;
}

.rating-input .star:hover {
    color: #ffb300;
}

/* Estilos para paginação */
.paginacao .btn {
    margin: 0 0.25rem;
    text-decoration: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Estilos para menu do cliente */
.cliente-menu .menu-link {
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.cliente-menu .menu-link:hover {
    background: rgba(255,255,255,0.2) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.3);
}

.cliente-menu .menu-link.active {
    background: rgba(255,255,255,0.3) !important;
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.cliente-menu .menu-link:active {
    transform: translateY(0);
}

.cliente-menu .menu-links {
    margin-bottom: 1.5rem;
}

/* Estilos responsivos para filtros */
@media (max-width: 768px) {
    .filtros-busca > form > div:first-child {
        grid-template-columns: 1fr;
    }
    
    .filtros-busca > form > div:last-child {
        flex-direction: column;
        align-items: stretch;
    }
    
    .estatisticas-cliente {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cliente-menu .menu-links {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cliente-menu div[style*="display: flex"] {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .cliente-menu div[style*="display: flex"] > * {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 0.8;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.carrinho-link {
    position: relative;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
}

.carrinho-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('images/hero-bg.svg?v=2');
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Seções */
.section {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: #333;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 2rem;
    color: #666;
}

/* Cards de Produtos */
.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.produto-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.produto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* Cards clicáveis */
.produto-card[onclick] {
    cursor: pointer;
    user-select: none;
}

.produto-card[onclick]:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

.produto-card[onclick]:active {
    transform: translateY(-2px);
    transition: transform 0.1s ease;
}

.produto-imagem {
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    overflow: visible;
}

.produto-imagem img {
    max-width: calc(100% - 10px);
    max-height: calc(100% - 10px);
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    border-radius: 4px;
}

.produto-card:hover {
    transform: translateY(-2px);
}

.produto-info {
    padding: 1.5rem;
}

.produto-nome {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.produto-artesao {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.produto-preco {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 1rem;
}

.produto-avaliacao {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stars {
    color: #ffc107;
}

/* Categorias */
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.categoria-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    /* cursor moved to link so whole card is clickable via the anchor wrapper */
}

.categoria-card:hover {
    transform: translateY(-5px);
}

.categoria-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

/* Link wrapper for category cards: make full-card clickable and remove link default styles */
.categoria-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.categoria-card-link .categoria-card {
    cursor: pointer;
}
.categoria-card-link:focus,
.categoria-card-link:active {
    outline: none;
}

/* Formulários */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.form-btn:hover {
    background: #5a6fd8;
}

/* Carrinho */
.carrinho-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.carrinho-item-imagem {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.carrinho-item-info {
    flex: 1;
}

.carrinho-item-quantidade {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantidade-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
}

.quantidade-input {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    padding: 5px;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #555;
    color: #ccc;
}

/* Mensagens de Alerta */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsividade */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* Search form in header */
.search-form {
    display: flex;
    align-items: center;
}
.search-form .form-input {
    padding: 8px 10px;
    border-radius: 4px;
    width: 220px;
}
.search-form .btn {
    padding: 8px 10px;
    font-size: 0.9rem;
}

/* Campos desabilitados */
.form-input:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.8;
}

.form-input:disabled + small {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
    display: block;
}

/* Seções do perfil */
.section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section h2 {
    color: #667eea;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

/* Melhorias para formulários em grid */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Galeria de Produtos - Estilos Específicos */
.galeria-produto {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: visible;
    position: relative;
    z-index: 2;
}

.imagem-principal-container {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: visible;
    border-radius: 8px;
    background: #f8f9fa;
    z-index: 3;
}

.imagem-principal-container img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.imagem-principal-container img:hover {
    transform: scale(1.02);
}

.miniaturas-container {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}

.miniatura {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.miniatura:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.miniatura.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

/* Indicador de loading para imagens */
.imagem-principal-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
}

.imagem-principal-container.loading::before {
    opacity: 1;
}

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

/* Responsividade da galeria */
@media (max-width: 768px) {
    .galeria-produto {
        padding: 0.75rem;
    }
    
    .imagem-principal-container img {
        max-height: 300px;
    }
    
    .miniatura {
        width: 60px;
        height: 60px;
    }
    
    .miniaturas-container {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .imagem-principal-container img {
        max-height: 250px;
    }
    
    .miniatura {
        width: 50px;
        height: 50px;
    }
}

/* Correções para evitar sobreposição de elementos */
.produto-info {
    position: relative;
    z-index: 5;
    background: transparent;
}

.produto-compra {
    position: relative !important;
    z-index: 10 !important;
    clear: both !important;
    margin-top: 2rem !important;
}

.produto-detalhes-tecnicos {
    position: relative;
    z-index: 6;
    clear: both;
}

.produto-cuidados {
    position: relative;
    z-index: 7;
    clear: both;
}

.produto-descricao {
    position: relative;
    z-index: 8;
    clear: both;
}

/* Garantir que a galeria não sobreponha outros elementos */
.produto-galeria {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

/* Responsividade melhorada para evitar sobreposições */
@media (max-width: 768px) {
    .produto-detalhes {
        grid-template-columns: 1fr;
        gap: 1rem;
        overflow: visible !important;
    }
    
    .produto-galeria {
        margin-bottom: 1rem;
    }
    
    .produto-info > * {
        margin-bottom: 1rem;
        position: relative;
        z-index: 5;
    }
}