/* 
 * TCM AGRICOL - Premium Styles
 * Colors: 
 *   Primary: #1a5d3a (Green)
 *   Secondary: #d4a574 (Gold)
 *   Accent: #0f3a52 (Blue)
 *   Neutral: #f5f5f5
 *   Text: #2c2c2c
 */

:root {
    --primary-color: #1a5d3a;
    --secondary-color: #d4a574;
    --accent-color: #0f3a52;
    --neutral-color: #f5f5f5;
    --text-color: #2c2c2c;
    --white: #ffffff;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-accent: 'Playfair Display', serif;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--text-color);
    background-color: var(--neutral-color);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

.font-accent {
    font-family: var(--font-accent);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

.container {
    width: 90%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

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

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(212, 165, 116, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0); }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

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

/* --- Navigation --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: var(--transition);
    background: transparent;
}

header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    padding: 15px 0;
    backdrop-filter: blur(10px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px;
    transition: var(--transition);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--white);
    position: relative;
}

header.scrolled .nav-links a {
    color: var(--text-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--secondary-color);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.cta-btn {
    padding: 10px 25px;
    background-color: var(--secondary-color);
    color: var(--white);
    border-radius: 2px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid var(--secondary-color);
}

.cta-btn:hover {
    background-color: transparent;
    color: var(--secondary-color);
}

header.scrolled .cta-btn:hover {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.lang-switch {
    display: flex;
    align-items: center;
}

.lang-flags {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lang-flag {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 30px;
}

.lang-flag:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.lang-flag.active {
    background: rgba(255,255,255,0.2);
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
}

.flag-icon,
.fi {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
    width: 1.5em;
    height: 1.2em;
    vertical-align: middle;
}

header.scrolled .lang-flag {
    border-color: rgba(0,0,0,0.2);
    color: var(--text-color);
}

header.scrolled .lang-flag:hover {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.3);
}

header.scrolled .lang-flag.active {
    background: rgba(26, 93, 58, 0.1);
    border-color: var(--primary-color);
}

/* --- Hero Section --- */
#hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/field-hero.jpg');
    background-size: cover;
    background-position: center;
    z-index: -2;
    /* Performance optimization */
    will-change: transform;
    transform: translateZ(0);
}

/* Correction pour les pages dans sous-dossiers es/ et en/ */
body:has([lang="es"]) .hero-bg,
body:has([lang="en"]) .hero-bg,
html[lang="es"] .hero-bg,
html[lang="en"] .hero-bg {
    background-image: url('../../assets/images/field-hero.jpg');
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.6));
    z-index: -1;
}

.hero-content {
    max-width: 800px;
    padding: 20px;
}

.hero-tagline {
    font-size: 1.2rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: var(--secondary-color);
    opacity: 0;
    animation: fadeIn 1s ease-out forwards 0.5s;
}

.hero-title {
    font-size: 4rem;
    margin-bottom: 30px;
    line-height: 1.1;
    opacity: 0;
    animation: fadeIn 1s ease-out forwards 0.8s;
}

.hero-btns {
    display: flex;
    gap: 20px;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 1s ease-out forwards 1.1s;
}

.btn-primary {
    padding: 15px 40px;
    background-color: var(--secondary-color);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.btn-primary:hover {
    background-color: #c09160;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.btn-outline {
    padding: 15px 40px;
    border: 2px solid var(--white);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.btn-outline:hover {
    background-color: var(--white);
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* --- About Section --- */
#about {
    padding: 100px 0;
    background-color: var(--white);
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-subtitle {
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    display: block;
    margin-bottom: 15px;
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-text p {
    margin-bottom: 20px;
    color: #666;
}

.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.pillar-item {
    text-align: center;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: var(--transition);
}

.pillar-item:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    background-color: #fafafa;
}

.pillar-icon {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* --- Varieties Section --- */
#varieties {
    padding: 100px 0;
    background-color: #f0f4f1;
}

.varieties-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.variety-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.05);
    transition: var(--transition);
    position: relative;
}

.variety-card:hover {
    transform: translateY(-10px);
}

.variety-img {
    height: 300px;
    width: 100%;
    object-fit: cover;
}

.variety-content {
    padding: 40px;
}

.variety-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.specs-list {
    margin: 20px 0;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.specs-list li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* --- Products Section (Flip Cards) --- */
#products {
    padding: 100px 0;
    background-color: var(--white);
}

.products-container {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

.product-flip-card {
    background-color: transparent;
    width: 350px;
    height: 500px;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    border-radius: 15px;
}

.product-flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 15px;
    overflow: hidden;
}

.flip-card-front {
    background-color: var(--white);
}

.flip-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.product-flip-card:hover .flip-card-front img {
    transform: scale(1.1);
}

.flip-overlay-text {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
}

.flip-card-back {
    background-color: var(--primary-color);
    color: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
}

.comparison-slider {
    width: 100%;
    margin-top: 20px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.fill {
    height: 100%;
    background: var(--secondary-color);
    width: 0%; /* JS will animate this */
    transition: width 1s ease-out;
}

/* --- Certifications --- */
#certifications {
    padding: 100px 0;
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
}

.cert-badges {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 60px;
}

.cert-badge {
    background: rgba(255,255,255,0.1);
    padding: 40px;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
    animation: float 6s ease-in-out infinite;
    backdrop-filter: blur(5px);
}

.cert-badge:nth-child(2) {
    animation-delay: 2s;
    border-color: var(--secondary-color);
    box-shadow: 0 0 30px rgba(212, 165, 116, 0.2);
}

.cert-badge:nth-child(3) {
    animation-delay: 4s;
}

.cert-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

/* --- Stats --- */
#stats {
    padding: 80px 0;
    background-color: var(--accent-color);
    color: var(--white);
}

.stats-container {
    display: flex;
    justify-content: space-between;
    text-align: center;
}

.stat-item h3 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.stat-item p {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Contact Section --- */
#contact {
    padding: 100px 0;
    background: linear-gradient(135deg, #f5f5f5 50%, #e0e0e0 100%);
}

.contact-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--white);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 93, 58, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
}

/* --- Footer --- */
footer {
    background-color: #111;
    color: #999;
    padding: 80px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

.footer-logo {
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: block;
}

.footer-col h4 {
    color: var(--white);
    margin-bottom: 25px;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a:hover {
    color: var(--secondary-color);
}

.footer-bottom {
    border-top: 1px solid #333;
    padding-top: 30px;
    text-align: center;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 992px) {
    .about-grid, .varieties-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-container {
        flex-wrap: wrap;
        gap: 40px;
        justify-content: center;
    }
    
    .stat-item {
        width: 45%;
    }
}

/* --- CoA Section --- */
#coa {
    padding: 100px 0;
    background-color: var(--white);
}

.coa-filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
}

.coa-filter-btn {
    padding: 10px 25px;
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.coa-filter-btn:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.coa-filter-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
}

.coa-table-container {
    overflow-x: auto;
    margin: 40px 0;
}

.coa-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.coa-table thead {
    background-color: var(--primary-color);
    color: var(--white);
}

.coa-table th {
    padding: 20px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.coa-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.coa-table tbody tr:hover {
    background-color: #f5f5f5;
}

.coa-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Vision Section --- */
#vision {
    padding: 100px 0;
}

.vision-pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.vision-pillar {
    text-align: center;
    padding: 40px;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.vision-pillar:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

/* --- Mobile Menu --- */
.mobile-menu-btn {
    display: none;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-btn i {
    color: var(--white);
    font-size: 1.5rem;
    transition: var(--transition);
}

header.scrolled .mobile-menu-btn i {
    color: var(--text-color);
}

/* Additional responsive improvements */
@media (max-width: 992px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .about-grid {
        gap: 40px;
    }
    
    .varieties-grid {
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background-color: var(--white);
        flex-direction: column;
        padding: 80px 30px 30px;
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        gap: 20px;
    }
    
    .nav-links.mobile-active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
    }
    
    .nav-links a {
        color: var(--text-color);
        display: block;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
    }
    
    .nav-links .cta-btn {
        margin-top: 20px;
        text-align: center;
    }
    
    .lang-switch {
        margin-top: 20px;
    }
    
    .lang-flags {
        flex-direction: column;
        width: 100%;
    }
    
    .lang-flag {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .pillars {
        grid-template-columns: 1fr;
    }
    
    .products-container {
        flex-direction: column;
        align-items: center;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .cert-badges {
        flex-direction: column;
        align-items: center;
    }
    
    .coa-filters {
        flex-wrap: wrap;
    }
    
    .coa-table {
        font-size: 0.85rem;
    }
    
    .coa-table th,
    .coa-table td {
        padding: 10px 15px;
    }
    
    .vision-pillars {
        grid-template-columns: 1fr;
    }
    
    .hero-btns {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .btn-primary,
    .btn-outline {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
    
    .contact-info {
        grid-template-columns: 1fr !important;
    }
}

/* Performance optimizations */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) {
    opacity: 1;
}

/* S'assurer que les images chargées sont visibles */
img.loaded {
    opacity: 1 !important;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
