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

:root {
    /* Colori Agenzia Lignano: Verde mare, Azzurro, Blu mare, Arancione sole */
    --sea-green: #00a99d;
    --light-blue: #4fc3f7;
    --deep-blue: #0277bd;
    --sun-orange: #ff9800;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --white: #ffffff;
    --gradient: linear-gradient(135deg, #00a99d 0%, #4fc3f7 50%, #0277bd 100%);
    --gradient-warm: linear-gradient(135deg, #ff9800 0%, #00a99d 100%);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    background: #f8fafc;
}

/* Hidden SEO Content - Visibile solo ai crawler */
.seo-content {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Main Language Selection Page */
.language-selector-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 40px 20px;
}

/* Animated Background - Colori Agenzia */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #00a99d 0%, #4fc3f7 25%, #0277bd 50%, #ff9800 75%, #00a99d 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    z-index: -2;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.background-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 152, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 169, 157, 0.12) 0%, transparent 50%);
    animation: float 25s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -30px); }
    66% { transform: translate(-20px, 20px); }
}

.background-animation::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(79, 195, 247, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(0, 169, 157, 0.08) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Content Wrapper */
.content-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 30px;
    padding: 60px 50px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* Brand Section */
.brand-section {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-logo {
    height: 100px;
    width: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 10px rgba(0, 169, 157, 0.3));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.brand-tagline {
    font-size: 1.25rem;
    color: var(--text-light);
    font-weight: 400;
    max-width: 700px;
    margin: 0 auto 20px;
}

/* Rotating Text */
.rotating-text {
    font-size: 1.35rem;
    color: var(--deep-blue);
    font-weight: 600;
    font-style: italic;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    padding: 0 20px;
    margin-top: 15px;
}

/* Language Grid - 3x3 Layout */
.language-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 50px;
}

.language-card {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 35px 25px;
    text-align: center;
    text-decoration: none;
    color: var(--text-dark);
    box-shadow: 0 5px 20px rgba(0, 169, 157, 0.15);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    border: 2px solid transparent;
}

.language-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.language-card:hover::before {
    opacity: 0.08;
}

.language-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 40px rgba(0, 169, 157, 0.35);
    border-color: var(--sea-green);
}

.language-card > * {
    position: relative;
    z-index: 1;
}

.flag {
    height: 60px;
    width: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.language-card:hover .flag {
    transform: scale(1.1);
}

/* Flag Group - Due bandiere affiancate STESSE DIMENSIONI */
.flag-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.flag-group .flag {
    height: 60px;
    width: auto;
}

.language-name {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.language-subtitle {
    display: block;
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 400;
    font-style: italic;
}

/* Trust Section */
.trust-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap;
    padding: 30px 0;
    border-top: 2px solid rgba(0, 169, 157, 0.15);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--deep-blue);
}

.trust-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.trust-text {
    font-size: 1rem;
}

/* Mini Footer */
.mini-footer {
    margin-top: 40px;
    text-align: center;
    color: white;
    font-size: 0.9rem;
    opacity: 0.95;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.mini-footer p {
    margin: 5px 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .language-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .content-wrapper {
        padding: 50px 40px;
    }
}

@media (max-width: 968px) {
    .language-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .brand-title {
        font-size: 2.8rem;
    }

    .brand-tagline {
        font-size: 1.1rem;
    }
    
    .rotating-text {
        font-size: 1.15rem;
        min-height: 60px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 40px 30px;
        border-radius: 20px;
    }

    .brand-title {
        font-size: 2.3rem;
    }

    .brand-tagline {
        font-size: 1rem;
    }
    
    .rotating-text {
        font-size: 1.05rem;
        min-height: 80px;
        padding: 0 10px;
    }

    .main-logo {
        height: 80px;
    }

    .language-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .language-card {
        padding: 30px 20px;
    }

    .flag {
        height: 55px;
    }

    .flag-group .flag {
        height: 55px;
    }

    .language-name {
        font-size: 1.35rem;
    }

    .language-subtitle {
        font-size: 0.9rem;
    }

    .trust-section {
        gap: 25px;
        flex-direction: column;
    }

    .trust-item {
        font-size: 0.95rem;
    }

    .trust-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 30px 20px;
    }

    .brand-title {
        font-size: 1.9rem;
    }

    .brand-tagline {
        font-size: 0.95rem;
    }
    
    .rotating-text {
        font-size: 0.95rem;
        min-height: 90px;
    }

    .language-card {
        padding: 25px 15px;
    }
    
    .flag {
        height: 50px;
    }
    
    .flag-group .flag {
        height: 50px;
    }

    .mini-footer {
        font-size: 0.8rem;
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .background-animation {
        display: none;
    }
    
    .content-wrapper {
        box-shadow: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .language-card {
        border: 3px solid currentColor;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #0f172a;
    }
    
    .content-wrapper {
        background: rgba(30, 41, 59, 0.95);
    }
    
    .brand-tagline,
    .rotating-text {
        color: #94a3b8;
    }
    
    .language-card {
        background: #1e293b;
        color: white;
    }
    
    .language-name {
        color: white;
    }
    
    .trust-item {
        color: white;
    }
}