/* === VARIÁVEIS GLOBAIS === */
:root {
    --primary: #ff6600;
    --primary-hover: #cc5200;
    --secondary: #0a0a0a;
    --secondary-light: #1a1a1a;
    --bg-light: #f4f6f8;
    --text-dark: #1e293b;
    --text-muted: #475569;
    --white: #ffffff;
    --transition: all 0.3s ease;
    --header-height: 80px;
}

/* === RESET E BLINDAGEM MOBILE FIRST === */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden; /* Impede a página de criar barra horizontal no telemóvel */
    scroll-behavior: smooth;
    background-color: var(--white);
    color: var(--text-dark);
}

html { scroll-padding-top: calc(var(--header-height) + 10px); }
img { max-width: 100%; height: auto; display: block; }

.container { width: 100%; max-width: 1300px; margin: 0 auto; padding: 0 20px; }
.text-primary { color: var(--primary); }
.bg-light { background-color: var(--bg-light); }
.section-padding { padding: 60px 0; }

/* === TIPOGRAFIA SEGURA (Sem quebrar palavras) === */
.section-title { 
    font-size: clamp(1.6rem, 3.5vw, 2.5rem); 
    line-height: 1.2; 
    margin-bottom: 15px; 
    color: var(--secondary); 
    font-weight: 800; 
    text-transform: uppercase; 
}
.section-title.center { text-align: center; }
.section-title::after { content: ''; display: block; width: 60px; height: 4px; background-color: var(--primary); margin: 15px 0 0 0; }
.section-title.center::after { margin: 15px auto 0 auto; }
.section-subtitle { color: var(--text-muted); max-width: 800px; margin: 0 0 40px 0; font-size: 1rem; }
.section-title.center + .section-subtitle { text-align: center; margin: 0 auto 40px auto; }

/* === BOTÕES === */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 14px 24px; border-radius: 6px; font-weight: 600; text-decoration: none; transition: var(--transition); cursor: pointer; border: none; font-size: 1rem; }
.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); color: var(--white); }
.btn-secondary { background-color: rgba(255, 255, 255, 0.1); color: var(--white); border: 1px solid var(--white); backdrop-filter: blur(5px); }
.btn-secondary:hover { background-color: var(--white); color: var(--secondary); }
.btn-block { width: 100%; padding: 16px; font-size: 1.1rem; }

/* --- Top Bar (Oculta no mobile) --- */
.top-bar { display: none; } 

/* --- Cabeçalho e Navegação --- */
header { background-color: var(--secondary); position: sticky; top: 0; width: 100%; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
header .container { display: flex; justify-content: space-between; align-items: center; height: var(--header-height); position: relative; }
.logo img { max-height: 45px; transition: transform 0.3s; }

nav#nav-menu { display: none; position: absolute; top: 100%; left: 0; width: 100%; background-color: var(--secondary); box-shadow: 0 10px 15px rgba(0,0,0,0.3); }
nav#nav-menu.active { display: block; border-top: 1px solid #334155; }
nav ul { list-style: none; display: flex; flex-direction: column; }
nav ul a { display: block; color: var(--white); text-decoration: none; font-weight: 600; padding: 15px 20px; border-bottom: 1px solid #1f2937; text-transform: uppercase; }
nav ul a:hover { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 15px; }
.header-cta { padding: 10px 15px; font-size: 1.2rem; }
.header-cta .cta-text { display: none; }
.mobile-toggle { background: none; border: none; color: var(--white); font-size: 1.8rem; cursor: pointer; display: block; }

/* --- Hero Section --- */
.hero { background: linear-gradient(to right, rgba(10, 10, 10, 0.9) 0%, rgba(10, 10, 10, 0.6) 100%), url('https://images.unsplash.com/photo-1581091226825-a6a2a5aee158?auto=format&fit=crop&q=80&w=1920') center/cover; min-height: 500px; display: flex; align-items: center; color: var(--white); padding: 60px 0; }
.hero h1 { font-size: 2.2rem; margin-bottom: 15px; font-weight: 900; text-transform: uppercase; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.1rem; margin-bottom: 30px; color: #cbd5e1; border-left: 4px solid var(--primary); padding-left: 15px; }
.hero-buttons { display: flex; flex-direction: column; gap: 15px; }

/* --- Sobre Nós & Carrossel Inicial --- */
.about-wrapper { display: flex; flex-direction: column; gap: 40px; width: 100%; min-width: 0;}
.carousel-container, .about-text { width: 100%; min-width: 0;}
.about-text p { margin-bottom: 15px; font-size: 1.05rem; }
.about-list { list-style: none; margin-top: 20px; }
.about-list li { margin-bottom: 12px; font-weight: 600; }
.about-list i { margin-right: 10px; }

.carousel-container { position: relative; overflow: hidden; border-radius: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); background-color: var(--secondary); aspect-ratio: 4/3; }
.carousel-track { display: flex; width: 100%; height: 100%; transition: transform 0.4s ease-in-out; }
.carousel-slide { flex: 0 0 100%; width: 100%; height: 100%; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(10,10,10,0.5); color: var(--white); border: none; width: 40px; height: 40px; cursor: pointer; border-radius: 50%; font-size: 1.2rem; z-index: 10; }
.prev-btn { left: 10px; } .next-btn { right: 10px; }
.carousel-btn:hover { background: var(--primary); }
.carousel-dots { position: absolute; bottom: 15px; width: 100%; display: flex; justify-content: center; gap: 8px; }
.dot { width: 12px; height: 12px; background: rgba(255,255,255,0.5); border-radius: 50%; cursor: pointer; }
.dot.active { background: var(--primary); }

/* --- Estrutura de Grelhas (Mobile = 1 Coluna) --- */
.services-grid, .catalog-grid, .contact-wrapper, .footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; width: 100%; }

/* --- Serviços (Página Inicial) --- */
.service-card { background-color: var(--white); padding: 30px 20px; border-radius: 6px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; min-width: 0;}
.service-card.highlight { background-color: var(--secondary); color: var(--white); border: none; }
.service-card.highlight h3 { color: var(--white); }
.service-card.highlight p { color: #cbd5e1; }
.service-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 15px; }
.service-card h3 { font-size: 1.3rem; margin-bottom: 10px; color: var(--secondary); }


/* =========================================================
   RESTAURADO: SERVIÇOS DETALHADOS (Ziguezague Mobile)
   ========================================================= */
.service-row { display: flex; flex-direction: column; gap: 30px; margin-bottom: 70px; align-items: center; width: 100%; min-width: 0;}
.service-image-container { width: 100%; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.1); height: 280px; min-width: 0;}
.service-image-container img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.service-row:hover .service-image-container img { transform: scale(1.05); }


/* =========================================================
   RESTAURADO: GALERIA PORTFÓLIO
   ========================================================= */
.portfolio-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 30px; }
.portfolio-item { width: 100%; aspect-ratio: 4/3; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.08); background-color: #f1f5f9; }
.portfolio-item img { width: 100%; height: 100%; object-fit: cover; transition: 0.4s ease; cursor: pointer;}
.portfolio-item:hover img { transform: scale(1.1); filter: brightness(1.1); }


/* --- Catálogo (Máquinas) --- */
.catalog-card { background: var(--white); border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; text-decoration: none; color: var(--text-dark); display: flex; flex-direction: column; transition: var(--transition); box-shadow: 0 4px 15px rgba(0,0,0,0.05); min-width: 0;}
.catalog-card:hover { transform: translateY(-8px); box-shadow: 0 15px 30px rgba(0,0,0,0.1); border-color: var(--primary); }
.catalog-image { width: 100%; height: 250px; background-color: #f1f5f9; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden; }
.catalog-image img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.5s ease; }
.catalog-card:hover .catalog-image img { transform: scale(1.08); }
.catalog-info { padding: 25px; display: flex; flex-direction: column; flex-grow: 1; }
.catalog-info h3 { font-size: 1.25rem; color: var(--secondary); margin-bottom: 10px; }
.catalog-info p { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 20px; flex-grow: 1; }
.btn-link { color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 8px; transition: var(--transition); }
.catalog-card:hover .btn-link { gap: 12px; }

/* === PÁGINA DE DETALHES COM MULTI-FOTOS E LIGHTBOX === */
.breadcrumb { padding: 20px 0; background-color: var(--bg-light); font-size: 0.95rem; border-bottom: 1px solid #e2e8f0; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.product-detail-wrapper { display: flex; flex-direction: column; gap: 40px; margin-top: 30px; margin-bottom: 60px; min-width: 0; width: 100%;}
.product-gallery-container { display: flex; flex-direction: column; gap: 15px; width: 100%; }

.main-image-wrapper { width: 100%; aspect-ratio: 4/3; background-color: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 20px; cursor: zoom-in; position: relative;}
.main-image-wrapper img { max-width: 100%; max-height: 100%; object-fit: contain; transition: opacity 0.3s ease; }
.zoom-hint { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
.main-image-wrapper:hover .zoom-hint { opacity: 1; }
.zoom-hint i { color: #ffffff; font-size: 3rem; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }

.thumbnail-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.thumb-item { aspect-ratio: 1; background-color: #f1f5f9; border: 2px solid transparent; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 5px; transition: var(--transition); overflow: hidden;}
.thumb-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-item.active { border-color: var(--primary); background-color: #fff; }
.thumb-item:hover { border-color: var(--primary-hover); }

/* --- Lightbox (Ecrã Inteiro com Navegação) --- */
.lightbox-overlay { display: none; position: fixed; z-index: 999999; left: 0; top: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.92); backdrop-filter: blur(8px); align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
.lightbox-overlay.show { display: flex; opacity: 1; }
.lightbox-img { max-width: 90%; max-height: 85vh; object-fit: contain; border-radius: 4px; box-shadow: 0 5px 25px rgba(0,0,0,0.5); transform: scale(0.95); transition: transform 0.3s ease; }
.lightbox-overlay.show .lightbox-img { transform: scale(1); }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: #f1f1f1; font-size: 40px; font-weight: bold; cursor: pointer; transition: 0.3s; z-index: 1000000; }
.lightbox-close:hover { color: var(--primary); transform: scale(1.1); }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #ffffff; font-size: 3rem; cursor: pointer; user-select: none; transition: 0.3s ease; z-index: 1000001; padding: 20px; text-shadow: 0 2px 10px rgba(0,0,0,0.8); }
.lightbox-nav:hover { color: var(--primary); transform: translateY(-50%) scale(1.1); }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }


.product-info { width: 100%; }
.product-info h1 { font-size: 1.8rem; color: var(--secondary); margin-bottom: 10px; line-height: 1.2; }
.product-info .brand { display: inline-block; background-color: var(--secondary); color: var(--white); padding: 4px 12px; border-radius: 4px; font-size: 0.85rem; font-weight: bold; margin-bottom: 15px; text-transform: uppercase; }
.product-description { font-size: 1.05rem; margin-bottom: 30px; color: var(--text-muted); }

.table-responsive { width: 100%; overflow-x: auto; margin-bottom: 30px; }
.specs-table { width: 100%; border-collapse: collapse; min-width: 300px;}
.specs-table th, .specs-table td { padding: 12px; border-bottom: 1px solid #e2e8f0; text-align: left; font-size: 0.95rem; }
.specs-table th { background-color: var(--bg-light); color: var(--secondary); font-weight: 600; width: 45%; }
.specs-table td { color: var(--text-muted); }
.product-actions { display: flex; flex-direction: column; gap: 15px; }

/* === GOOGLE MAPS E CONTATO === */
.map-container { width: 100%; height: 250px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 25px; border: 1px solid #e2e8f0; }
.map-container iframe { width: 100%; height: 100%; border: none; }
.info-item { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 25px; }
.info-item-icon { width: 50px; height: 50px; background-color: #ffeedd; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 1.3rem; flex-shrink: 0; }
.info-item h4 { color: var(--secondary); font-size: 1.1rem; margin-bottom: 5px;}
.info-item p, .info-item a { color: var(--text-muted); text-decoration: none; }
.info-item a:hover { color: var(--primary); }

.contact-form { background-color: var(--white); padding: 25px; border-radius: 8px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; min-width: 0;}
.form-row { display: flex; flex-direction: column; gap: 0; }
.form-group { margin-bottom: 20px; width: 100%; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--secondary); }
.form-control { width: 100%; padding: 14px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 1rem; }
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 120px; }

/* --- Rodapé --- */
footer { background-color: var(--secondary-light); color: #94a3b8; padding: 50px 0 20px 0; text-align: center;}
.footer-grid { border-bottom: 1px solid #334155; padding-bottom: 30px; margin-bottom: 20px; }
.footer-col h4 { color: var(--white); font-size: 1.2rem; margin-bottom: 15px; position: relative; padding-bottom: 10px; }
.footer-col h4::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 30px; height: 2px; background-color: var(--primary); }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul a { color: #94a3b8; text-decoration: none; transition: 0.3s;}
.footer-social { display: flex; justify-content: center; gap: 10px; margin-top: 15px;}
.footer-social a { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; background-color: #334155; color: var(--white); border-radius: 50%; text-decoration: none; transition: 0.3s; }
.footer-social a:hover { background-color: var(--primary); }
.footer-bottom { text-align: center; font-size: 0.85rem; }

/* =========================================================
   MEDIA QUERIES (ADAPTAÇÃO DESKTOP E TABLET)
   ========================================================= */

@media (min-width: 768px) {
    .section-padding { padding: 80px 0; }
    .hero { min-height: 600px; padding: 0; }
    .hero h1 { font-size: 3.2rem; }
    .hero p { font-size: 1.25rem; }
    .hero-buttons { flex-direction: row; }
    
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    .catalog-grid { grid-template-columns: repeat(2, 1fr); }
    .contact-wrapper { grid-template-columns: 1fr 1fr; gap: 40px; }
    .form-row { flex-direction: row; gap: 20px; }
    
    .product-actions { flex-direction: row; }
    .product-detail-wrapper { flex-direction: row; align-items: flex-start; }
    .product-gallery-container { width: 45%; position: sticky; top: 120px;}
    .product-info { width: 55%; }

    /* Layout Ziguezague na Página de Serviços (Restaurado) */
    .service-row { flex-direction: row; gap: 50px; margin-bottom: 80px; align-items: center;}
    .service-row:nth-child(even) { flex-direction: row-reverse; } 
    .service-row .product-info { width: 65%; } 
    .service-row .service-image-container { width: 35%; height: 300px; } 

    footer { text-align: left; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-col h4::after { left: 0; transform: none; }
    .footer-social { justify-content: flex-start; }
}

@media (min-width: 1024px) {
    .top-bar { display: flex; background-color: var(--primary); color: var(--white); height: var(--topbar-height); font-size: 0.85rem; align-items: center; }
    .top-bar-content { display: flex; justify-content: space-between; align-items: center; width: 100%; }
    .top-bar-info span { margin-right: 20px; font-weight: 500; }
    .top-bar-social a { color: var(--white); margin-left: 15px; font-size: 1rem; }
    .top-bar-social a:hover { color: var(--secondary); }

    .logo img { max-height: 55px; }
    
    .mobile-toggle { display: none; }
    nav#nav-menu { display: block; position: static; background: none; box-shadow: none; width: auto; border: none; }
    nav ul { flex-direction: row; gap: 30px; }
    nav ul a { padding: 0; border: none; letter-spacing: 0.5px; }
    nav ul a:hover { color: var(--primary); }
    
    .header-cta { font-size: 1rem; padding: 12px 24px; border-radius: 6px; }
    .header-cta .cta-text { display: inline; }
    .header-cta i { margin-right: 8px; }

    .about-wrapper { flex-direction: row; align-items: center; }
    .carousel-container { width: 55%; aspect-ratio: auto; height: 420px; }
    .about-text { width: calc(45% - 40px); }

    .product-info h1 { font-size: 2.2rem; }

    .services-grid { grid-template-columns: repeat(4, 1fr); }
    .catalog-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
    
    .service-row .product-info { width: 68%; } 
    .service-row .service-image-container { width: 32%; height: 320px; } 
}

@media (max-width: 768px) {
    .lightbox-nav { font-size: 2rem; padding: 10px; }
}