/**
 * Main CSS file for Keptone website
 * Contains custom styling for the entire application
 */

/* General Styles */
/* Define as variáveis do design da página */
:root {
    --primary-color: #ff0000;
    --secondary-color: #001a3c;
    --text-color: #ffffff;
    --dark-blue: #001524;
    --blue-accent: #0084ff;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Font fallbacks para funcionar sem recursos externos */
@font-face {
    font-family: 'LocalFont';
    src: local('Arial');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--dark-blue);
    margin: 0;
    padding: 0;
    background-image: radial-gradient(rgba(0, 30, 60, 0.4) 1px, transparent 1px), url('/img/circuit-lines.png');
    background-size: 40px 40px, cover;
    background-position: center;
    background-repeat: repeat, no-repeat;
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Garantir que o texto seja legível em todos os elementos do site principal */
body > *:not(.chatbot-container) p, 
body > *:not(.chatbot-container) h1, 
body > *:not(.chatbot-container) h2, 
body > *:not(.chatbot-container) h3, 
body > *:not(.chatbot-container) h4, 
body > *:not(.chatbot-container) h5, 
body > *:not(.chatbot-container) h6, 
body > *:not(.chatbot-container) a, 
body > *:not(.chatbot-container) li, 
body > *:not(.chatbot-container) span, 
body > *:not(.chatbot-container) label, 
body > *:not(.chatbot-container) input, 
body > *:not(.chatbot-container) textarea, 
body > *:not(.chatbot-container) button {
    color: white !important;
    opacity: 1 !important;
}

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

.text-primary {
    color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-get-in-touch {
    padding: 15px 30px;
    font-weight: 700;
    letter-spacing: 1px;
    display: inline-block;
    margin-top: 20px;
    background-color: var(--primary-color) !important;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    opacity: 1 !important;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
}

.btn-primary:hover {
    background-color: #e00000;
}

/* Header & Navigation */
header {
    padding: 20px 0; /* Initial padding */
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    background-color: rgba(0, 21, 36, 0.9);
    transition: padding 0.3s ease-in-out; /* Add transition for padding */
}

/* Scrolled state for header */
header.scrolled {
    padding: 5px 0; /* Further reduced padding */
    /* Optional: add a subtle shadow when scrolled */
    /* box-shadow: 0 2px 5px rgba(0,0,0,0.2); */
}

header a {
    color: white !important;
    text-decoration: none;
}

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

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 50px;
    transition: height 0.3s ease-in-out; /* Add transition for height */
    vertical-align: middle; /* Align image nicely with text */
}

/* Scrolled state for logo image */
header.scrolled .logo img {
    height: 25px; /* Further reduced height */
}

.logo-text {
    color: white !important;
    font-size: 32px;
    font-weight: 700;
    margin-left: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    color: white !important;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--blue-accent);
}

/* Hero Section */
.hero-section {
    min-height: 65vh; /* Reduzido de 85vh para 65vh para tornar ainda mais compacto */
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 70px; /* Valor exato para compensar o header fixo */
    padding-bottom: 0; /* Removido o padding inferior */
    /* Add circuit-lines background layer below the gradient */
    background:
        url('/img/circuit-lines.png') center center / cover no-repeat, /* Layer 1: Circuit lines */
        linear-gradient(to right, rgba(0, 13, 31, 0.95) 0%, rgba(0, 21, 36, 0.8) 100%); /* Layer 2: Gradient */
    justify-content: flex-start;
}

/* Container within hero section to establish positioning context */
.hero-section > .container {
    position: relative; /* Keep for potential future absolute elements inside */
    height: auto; /* Alterado de 100% para auto para permitir que o conteúdo defina a altura */
    /* Setup Flexbox layout */
    display: flex;
    align-items: center; /* Vertically align items */
    gap: 40px; /* Space between content and graphics */
    padding-top: 10px;
    padding-bottom: 10px;
}

.hero-content {
    flex: 0 0 50%; /* Take up 50% of the flex container width */
    z-index: 10; /* Keep potentially for overlays if needed */
    padding: 30px; /* Redução significativa do padding */
    position: relative;
    color: white !important;
    display: block;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 0;
}

/* Estilo especial para o título principal, simulando a fonte da imagem */
.hero-section h1 {
    color: white !important;
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    display: block;
    text-transform: uppercase;
    opacity: 1 !important;
    letter-spacing: 2px;
    font-family: Arial, Helvetica, sans-serif;
    background-color: transparent;
    padding: 10px 0;
    border-radius: 0;
}

.hero-section p {
    color: white !important;
    font-size: 1.2rem;
    margin-bottom: 40px;
    max-width: 600px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.hero-section .btn-get-in-touch {
    margin-top: 20px;
}

.hero-graphics {
    flex: 0 0 50%; /* Take up 50% of the flex container width */
    /* Styles moved to the img tag inside */
    display: flex; /* Optional: Helps center image if needed */
    justify-content: center; /* Optional: Center image horizontally */
    align-items: center; /* Optional: Center image vertically */
    padding-top: 30px; /* Adicionado padding-top para compensar a altura do header fixo */
}

/* Style the actual image within the hero-graphics container */
.hero-graphics img {
    display: block; /* Remove extra space below image */
    max-width: 100%; /* Ensure image scales down */
    height: auto; /* Maintain aspect ratio */
    max-height: 600px; /* Limit maximum height */
}

/* Container for hero tags */
.hero-tags {
    display: flex;
    flex-wrap: wrap; /* Allow tags to wrap to next line */
    gap: 10px; /* Space between tags */
    margin-top: 20px; /* Space below H1 */
    margin-bottom: 30px; /* Space above paragraph */
}

/* Individual tag style */
.tag {
    display: inline-block;
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.15); /* Semi-transparent white */
    color: #f0f0f0; /* Light text color */
    border-radius: 15px; /* Rounded corners */
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.tag:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Card Styles */
/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 21, 36, 0.9);
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 300px;
    overflow: hidden;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Estado compacto do chatbot */
.chatbot-container.compact {
    width: 280px;
    height: auto;
    border-radius: 10px; /* Manter cantos arredondados */
}

.chatbot-container.compact .chatbot-header {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.chatbot-container.compact .chatbot-history {
    display: none; /* Esconder apenas o histórico quando compacto */
}

.chatbot-container.compact .chatbot-avatar {
    margin-right: 10px;
    width: 40px;
    height: 40px;
}

.chatbot-container.compact .chatbot-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-container.compact .chatbot-message {
    padding: 8px 10px;
    border-top: 1px solid rgba(0, 40, 70, 0.6);
}

.chatbot-container.compact .chatbot-input-field {
    height: 30px;
    font-size: 13px;
}

.chatbot-container.compact .chatbot-send {
    padding: 4px 8px;
    font-size: 16px;
}

/* Adiciona um indicador para mostrar que é clicável */
.chatbot-container.compact .chatbot-header:hover {
    background-color: rgba(0, 30, 60, 0.8);
}

.chatbot-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: rgba(0, 30, 60, 0.6);
    position: relative; /* Para posicionamento do botão toggle */
}

/* Estilo do avatar do chatbot */
.chatbot-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    overflow: hidden; /* Para garantir que a imagem fique dentro do círculo */
}

.chatbot-avatar img {
    width: 100%; /* Garantir que a imagem preencha o espaço disponível */
    height: 100%;
    object-fit: cover; /* Manter proporções da imagem sem distorção */
    border-radius: 50%; /* Manter o formato circular */
}

.chatbot-message {
    display: flex;
    align-items: center; /* Vertically center items */
    padding: 10px 15px;
    background-color: rgba(0, 21, 36, 0.9); /* Fundo azul escuro com transparência */
    border-top: 1px solid rgba(0, 40, 70, 0.9);
}

.chatbot-input-field {
    flex-grow: 1; /* Take available space */
    padding: 8px 15px;
    border: 1px solid #ced4da; /* Standard border */
    border-radius: 20px; /* Rounded corners */
    background-color: #ffffff; /* White background */
    color: #212529 !important; /* Dark text color - with !important to override global */
    font-size: 0.95rem;
    margin-right: 10px; /* Space between input and button */
    line-height: 1.5;
}

/* Garantir que o texto digitado seja visível */
.chatbot-input-field::placeholder {
    color: #6c757d; /* Cor cinza padrão para placeholder */
}

.chatbot-input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(255, 0, 0, 0.25);
    color: #212529 !important; /* Reforçar cor do texto quando em foco */
}

.chatbot-send {
    flex-shrink: 0; /* Prevent button from shrinking */
    padding: 8px 12px;
    background-color: var(--primary-color); /* Use primary blue */
    color: white; /* White arrow icon */
    border: none;
    border-radius: 50%; /* Make it circular */
    font-size: 18px; /* Adjust icon size */
    line-height: 1; /* Ensure icon is centered */
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chatbot-send:hover {
    background-color: var(--secondary-color); /* Darker blue on hover */
}

/* Ícones de Expandir/Minimizar */
.chatbot-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.chatbot-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Estado dos ícones - alterna visibilidade baseado no estado */
.chatbot-container.compact .minimize-icon {
    display: none;
}

.chatbot-container:not(.compact) .expand-icon {
    display: none;
}

/* Chat History Area */
.chatbot-history {
    height: 300px; /* Adjust as needed */
    overflow-y: auto; /* Enable scrolling for messages */
    padding: 15px;
    background-color: rgba(0, 21, 36, 0.8); /* Fundo azul escuro com transparência */
    border-top: 1px solid rgba(0, 40, 70, 0.9);
    border-bottom: 1px solid rgba(0, 40, 70, 0.9);
    margin-bottom: 10px;
    display: flex;
    flex-direction: column; /* Stack messages vertically */
    transition: all 0.3s ease;
}

/* Individual message bubble */
.chat-message {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
    font-size: 0.95rem;
}

/* User message styling */
.user-message {
    background-color: var(--primary-color); /* Red background for user */
    color: #ffffff !important; /* White text for user messages */
    align-self: flex-end; /* Align to the right */
    border-bottom-right-radius: 5px; /* Slightly different corner */
}

/* Assistant message styling */
.assistant-message {
    background-color: #ffffff; /* White background */
    color: #333 !important; /* Dark text for assistant messages */
    align-self: flex-start; /* Align to the left */
    border: 1px solid #d8d8d8;
    border-bottom-left-radius: 5px; /* Slightly different corner */
}

/* Styling for typing indicator in chatbot */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 10px 15px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 2px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

/* Animation for typing indicator */
.typing-indicator span:nth-of-type(1) {
    animation: pulseTyping 1s infinite 0.2s;
}

.typing-indicator span:nth-of-type(2) {
    animation: pulseTyping 1s infinite 0.4s;
}

.typing-indicator span:nth-of-type(3) {
    animation: pulseTyping 1s infinite 0.6s;
}

@keyframes pulseTyping {
    0% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0.4;
        transform: scale(1);
    }
}

/* Styling for error messages */
.error-message {
    background-color: #fff8f8; /* Light red background */
    border: 1px solid #ffdddd;
    color: #d32f2f !important; /* Red text color */
}

/* Footer Styles */
footer {
    background-color: var(--dark-blue);
    padding: 10px 0;
    margin-top: 30px;
}

footer a {
    text-decoration: none;
    transition: color 0.3s ease;
    color: rgba(255, 255, 255, 0.8) !important;
}

footer a:hover {
    color: var(--blue-accent) !important;
}

.footer-links ul {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 0;
    margin: 0 0 8px 0;
    list-style: none;
}

.copyright {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    margin-top: 2px;
    line-height: 1.2;
}

/* Services Section Styles */
.services-section {
    padding: 40px 0 50px 0; /* Ajustado o padding */
    background-color: rgba(0, 11, 26, 0.7);
    position: relative;
    margin-top: -30px; /* Aumentado o valor negativo para reduzir ainda mais o espaço */
}

.services-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 132, 255, 0.5), rgba(0, 0, 0, 0));
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 40px;
    color: white;
    font-weight: 700;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60%;
    height: 3px;
    background-color: var(--primary-color);
    left: 50%;
    transform: translateX(-50%);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.service-card {
    background-color: rgba(0, 21, 36, 0.6);
    border-radius: 8px;
    padding: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 40, 70, 0.6);
}

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

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-icon {
    margin-bottom: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.service-card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: white;
    font-weight: 600;
}

.service-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.service-link {
    display: inline-block;
    color: var(--blue-accent) !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    padding-bottom: 2px;
    transition: all 0.2s ease;
}

.service-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--blue-accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.service-link:hover {
    color: var(--primary-color) !important;
}

.service-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
    background-color: var(--primary-color);
}

/* Responsive Styles */
@media screen and (max-width: 1200px) {
    .container {
        max-width: 90%;
    }
    
    .hero-section > .container {
        gap: 30px;
    }
}

@media screen and (max-width: 992px) {
    .section-title {
        font-size: 2rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-menu {
        gap: 20px;
    }
    
    .hero-content {
        padding: 25px;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
}

/* Esconder o botão toggle-menu por padrão */
#toggle-menu {
    display: none;
}

@media screen and (max-width: 768px) {
    .hero-section > .container {
        flex-direction: column;
        padding-top: 0;
    }
    
    .hero-content {
        flex: 0 0 100%;
        order: 1; /* Mudado de 2 para 1 para aparecer primeiro */
        padding: 20px;
    }
    
    .hero-image {
        flex: 0 0 100%;
        order: 2; /* Mudado de 1 para 2 para aparecer depois */
        margin-top: 10px; /* Mudado de margin-bottom para margin-top */
        height: 80vw; /* Aumentado para 80% da largura do ecrã */
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    
    #hero-main-image {
        width: 100%; /* Preenche toda a largura disponível */
        height: 75vw; /* Aumentado para 75% da largura do ecrã */
        margin: 0 auto;
        display: block;
        object-fit: contain; /* Mantém a proporção original */
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    header {
        padding: 10px 0;
    }
    
    .logo img {
        max-width: 120px;
    }
    
    #toggle-menu {
        display: block; /* Mostrado apenas em ecrãs menores */
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        position: absolute;
        right: 15px;
        top: 15px;
        z-index: 1000;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -300px;
        width: 250px;
        height: 100vh;
        background-color: var(--dark-blue);
        flex-direction: column;
        padding: 80px 20px 20px;
        transition: right 0.3s ease;
        z-index: 999;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-link {
        margin: 10px 0;
        width: 100%;
        text-align: left;
    }
    
    .footer-links ul {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .copyright {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .chatbot-container {
        width: 280px;
        right: 10px;
        bottom: 10px;
    }
    
    .chatbot-header {
        padding: 8px 10px;
    }
    
    .chatbot-title {
        font-size: 0.9rem;
    }
    
    .chatbot-avatar img {
        width: 35px;
        height: 35px;
    }
}

@media screen and (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.7rem;
        margin-bottom: 30px;
    }
    
    .service-card {
        padding: 20px 15px;
    }
    
    .service-icon {
        width: 80px;
        height: 80px;
    }
    
    .service-card h3 {
        font-size: 1.2rem;
    }
    
    .service-card p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .chatbot-container {
        width: 250px;
    }
    
    .message-input {
        font-size: 0.85rem;
    }
}

/* Contact Form */
.form-control {
    padding: 0.75rem;
    border-radius: 0.375rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 4rem 0;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
}

/* Animation effects */
.fade-in {
    animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Language dropdown styling */
.dropdown-menu {
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border: none;
}

.dropdown-item {
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: var(--light-color);
}
