/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;800;900&family=Inter:wght@300;400;500;600&display=swap');

/* Tailwind Custom Configuration */
:root {
    --n11-gold: #EEBC60;
    --n11-teal: #17383F;
    --n11-light: #F8FAFA;
    --n11-dark: #0A181B;
}

/* Global Fixes */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Hero Section Background */
.hero-section {
    background: linear-gradient(rgba(23, 56, 63, 0.8), rgba(23, 56, 63, 0.9)),
        url('https://images.unsplash.com/photo-1461896836934-ffe607ba8211?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
}

/* Reveal Animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Club Logo Hover Effects */
.club-logo-container {
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.4s ease;
}

.club-logo-container:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.05);
}

/* ================================
   Partners PNG Transparency Polish
   ================================ */
#partners .club-logo-container {
    background: transparent;
    border: 0;
    box-shadow: none;
    position: relative;
    border-radius: 12px;
}

#partners .club-logo-container::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 12px;
    background: radial-gradient(ellipse at center, rgba(238, 188, 96, 0.12) 0%, rgba(238, 188, 96, 0) 60%);
    pointer-events: none;
}

#partners .club-logo-container img {
    background-color: transparent;
    filter: grayscale(100%) drop-shadow(0 4px 12px rgba(23, 56, 63, 0.15));
    opacity: 0.95;
}

#partners .club-logo-container:hover img {
    filter: grayscale(0%) drop-shadow(0 8px 18px rgba(23, 56, 63, 0.2));
    opacity: 1;
}

/* Glass Navigation */
.glass-nav {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    transition: box-shadow 0.3s ease;
}

/* Mobile Menu Styling */
#mobileMenu {
    animation: slideDown 0.3s ease-out;
}

#mobileMenuBtn {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

#mobileMenuBtn:active {
    background-color: rgba(23, 56, 63, 0.1);
    border-radius: 8px;
}

#mobileMenu button {
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Typography Improvements */
@media (max-width: 640px) {

    h1,
    h2,
    h3,
    h4,
    h5 {
        word-break: keep-all;
        hyphens: none;
    }

    /* Ensure buttons are easy to tap */
    button {
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Section Divider */
.section-divider {
    height: 4px;
    width: 60px;
    background-color: #EEBC60;
}

/* Partners & Modalities Horizontal Scroll (Mobile) */
@media (max-width: 768px) {

    /* Partners: horizontal scroll on mobile */
    .partners-scroll {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0.25rem !important;
        padding-bottom: 1.5rem;
        scrollbar-width: thin;
        scrollbar-color: var(--n11-gold) var(--n11-light);
    }

    .partners-scroll>div {
        flex: 0 0 150px;
        scroll-snap-align: start;
        margin: 0 !important;
    }

    /* Ícones maiores no mobile */
    .partners-scroll img {
        max-height: 5rem !important;
    }

    /* Modalidades: keep comfortable spacing, but slimmer card width */
    .modalities-scroll {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 1rem !important; /* restore comfortable spacing */
        padding-bottom: 1.5rem;
        scrollbar-width: thin;
        scrollbar-color: var(--n11-gold) var(--n11-light);
    }

    .modalities-scroll>div {
        flex: 0 0 240px; /* slimmer width */
        scroll-snap-align: start;
        height: 360px !important; /* slightly reduced height to match width */
    }

    .partners-scroll::-webkit-scrollbar,
    .modalities-scroll::-webkit-scrollbar {
        height: 4px;
    }

    .partners-scroll::-webkit-scrollbar-track,
    .modalities-scroll::-webkit-scrollbar-track {
        background: rgba(238, 188, 96, 0.05);
    }

    .partners-scroll::-webkit-scrollbar-thumb,
    .modalities-scroll::-webkit-scrollbar-thumb {
        background: var(--n11-gold);
        border-radius: 4px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #17383F;
}

::-webkit-scrollbar-thumb {
    background: #EEBC60;
    border-radius: 0px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Touch-friendly tap targets */
    button,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Improve hero text readability */
    .hero-section h1 {
        font-size: 2.5rem !important;
        line-height: 1.1;
    }

    .hero-section p {
        font-size: 0.95rem;
    }

    /* Adjust section padding for mobile */
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    /* Make cards stack better */
    .grid {
        gap: 1rem;
    }

    /* Adjust font sizes for mobile */
    h2 {
        font-size: 2rem !important;
    }

    h3 {
        font-size: 1.75rem !important;
    }

    /* Better spacing for mobile */
    .px-4 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Fix navigation for mobile */
    nav .flex {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Reduce hero height on mobile */
    .hero-section {
        min-height: 70vh;
    }

    /* Better image sizing */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Stack buttons on mobile */
    .flex-col.sm\\:flex-row {
        gap: 0.75rem;
    }

    /* Optimize modality cards for mobile */
    .h-\[550px\] {
        height: 350px !important;
    }

    /* Disable hover effects on touch devices */
    .club-logo-container:hover {
        transform: none;
    }

    /* Better text wrapping */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Improve touch scrolling */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {

    /* Even smaller screens */
    .hero-section h1 {
        font-size: 2rem !important;
    }

    /* Reduce padding further */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Single column grid on small screens */
    .grid {
        grid-template-columns: 1fr !important;
    }

    /* Smaller text for very small screens */
    body {
        font-size: 14px;
    }

    /* Adjust tracking on small screens */
    .tracking-widest {
        letter-spacing: 0.1em;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh;
    }

    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* High DPI screens optimization */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ============================================
   ESTILOS PARA MODAL DE COOKIES E TERMOS
   ============================================ */

/* Cookie Consent Banner */
#cookieConsent {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Terms Modal Scrolling */
#termsModal {
    animation: fadeIn 0.3s ease-out;
}

#termsModal.hidden {
    display: none;
}

#termsModal:not(.hidden) {
    display: flex;
}

/* Modal Content Styling */
#termsModal .bg-n11-dark {
    max-height: 80vh;
    overflow-y: auto;
}

/* Scrollbar Styling for Modal */
#termsModal .bg-n11-dark::-webkit-scrollbar {
    width: 8px;
}

#termsModal .bg-n11-dark::-webkit-scrollbar-track {
    background: rgba(238, 188, 96, 0.1);
    border-radius: 4px;
}

#termsModal .bg-n11-dark::-webkit-scrollbar-thumb {
    background: rgba(238, 188, 96, 0.3);
    border-radius: 4px;
}

#termsModal .bg-n11-dark::-webkit-scrollbar-thumb:hover {
    background: rgba(238, 188, 96, 0.5);
}

/* Firefox Scrollbar */
#termsModal .bg-n11-dark {
    scrollbar-color: rgba(238, 188, 96, 0.3) rgba(238, 188, 96, 0.1);
    scrollbar-width: thin;
}

/* Button Animations */
button {
    transition: all 0.3s ease;
}

button:active {
    transform: scale(0.98);
}

/* Modal Link Styling */
#termsModal a {
    word-break: break-word;
}

/* ============================================
   ESTILOS PARA SECÇÃO MODALIDADES
   ============================================ */

/* Modalidades Cards */
#modalidades .group {
    position: relative;
    display: block;
}

#modalidades .group img {
    will-change: transform;
}

#modalidades .group:hover img {
    filter: brightness(1.1);
}

/* Texto aparece suavemente no hover */
#modalidades .group p {
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.500s cubic-bezier(0.4, 0, 0.2, 1);
}

#modalidades .group:hover p {
    opacity: 1;
    transform: translateY(0);
}

/* Melhor espaçamento no mobile */
@media (max-width: 640px) {
    #modalidades .group {
        min-height: 280px;
    }

    #modalidades .group h4 {
        font-size: 1.5rem;
    }
}

/* Efeito de borda com hover */
#modalidades .group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    pointer-events: none;
    border-radius: 0.5rem;
    z-index: 10;
}

#modalidades .group:hover::before {
    border-color: rgba(238, 188, 96, 0.3);
}

/* CTA Button Enhancement */
#modalidades button {
    position: relative;
    overflow: hidden;
}

#modalidades button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
}

#modalidades button:hover::before {
    left: 100%;
}

/* Animação de entrada em cascata */
#modalidades .reveal {
    animation: fadeInUp 0.6s ease forwards;
}

#modalidades .group:nth-child(1) {
    animation-delay: 0ms;
}

#modalidades .group:nth-child(2) {
    animation-delay: 100ms;
}

#modalidades .group:nth-child(3) {
    animation-delay: 200ms;
}

#modalidades .group:nth-child(4) {
    animation-delay: 300ms;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   AJUSTES DE TAMANHO PARA MODALIDADES
   ============================================ */
/* Cards mais pequenos e achatados */
#modalidades .group {
    height: 220px !important;
}

@media (min-width: 640px) {
    #modalidades .group {
        height: 300px !important;
    }
}

@media (min-width: 1024px) {
    #modalidades .group {
        height: 360px !important;
    }
}

/* Reduzir padding interno dos cards */
#modalidades .group .absolute.inset-0 {
    padding: 1rem !important;
}

@media (min-width: 640px) {
    #modalidades .group .absolute.inset-0 {
        padding: 1.25rem !important;
    }
}

/* Tipografia mais compacta nos cards */
#modalidades h4 {
    font-size: 1.125rem !important; /* ~18px */
}

@media (min-width: 640px) {
    #modalidades h4 {
        font-size: 1.25rem !important; /* ~20px */
    }
}

#modalidades p {
    font-size: 0.8rem !important;
}

/* ============================================
   ALINHAMENTO E QUEBRA DE TEXTO (MOBILE)
   ============================================ */
@media (max-width: 768px) {
    /* Alinhar conteúdo do header à esquerda no mobile */
    #modalidades .reveal.flex {
        align-items: flex-start !important;
    }

    /* Melhorar legibilidade e evitar corte de texto */
    #modalidades h2 {
        letter-spacing: 0.08em !important;
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    #modalidades h3 {
        font-size: 1.6rem !important;
        line-height: 1.25 !important;
        word-break: break-word;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    #modalidades p {
        word-break: break-word;
        overflow-wrap: anywhere;
        white-space: normal;
    }
}

@media (max-width: 640px) {
    /* Overrides ainda mais agressivos para ecrãs muito pequenos */
    #modalidades h2 {
        letter-spacing: 0.06em !important;
    }

    #modalidades h3 {
        font-size: 1.5rem !important;
        line-height: 1.25 !important;
    }
}

/* ============================================
   CORREÇÕES MOBILE
   ============================================ */

/* Melhorar legibilidade da secção Parceiros em mobile */
@media (max-width: 768px) {
    #partners {
        background: #ffffff !important;
    }
    
    #partners h2,
    #partners h3 {
        text-shadow: none;
    }
    
    /* Garantir contraste no texto */
    #partners .text-n11-gold {
        color: #EEBC60 !important;
    }
    
    #partners .text-n11-teal {
        color: #17383F !important;
    }
    
    /* Adicionar fundo nos títulos para melhor legibilidade */
    #partners h2 {
        padding: 0.75rem 1rem 0.5rem 1rem !important;
        display: block;
        font-size: 10px !important;
        margin-top: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    #partners h3 {
        padding: 0.75rem 1rem 0.5rem 1rem !important;
        display: block;
        font-size: 22px !important;
        margin-top: 0.5rem;
    }
    
    /* Reduzir tamanho do botão CTA nas modalidades */
    #modalidades button {
        font-size: 9px !important;
        padding: 0.625rem 1.5rem !important;
        letter-spacing: 0.1em !important;
    }
}

/* Normalizar tracking das headings específicas em mobile */
@media (max-width: 768px) {
    #empresa h2,
    #exames h2 {
        letter-spacing: 0.15em !important;
    }
}

@media (max-width: 640px) {
    #empresa h2,
    #exames h2 {
        letter-spacing: 0.12em !important;
    }
}

/* Reduzir tamanho do logo+lettring no iPad para não sobrepor */
@media (min-width: 769px) and (max-width: 1024px) {
    .empresa-branding-img {
        max-width: 60% !important;
    }
}

/* Reduzir tamanho do logo no mobile */
@media (max-width: 768px) {
    .empresa-branding-img {
        max-width: 82% !important;
    }
}