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

/* CSS Variables */
:root {
    --bg-primary: #fefefe;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.95);
    --nav-blur: rgba(255, 255, 255, 0.9);
    --accent: #2d3748;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a202c;
        --bg-secondary: #2d3748;
        --bg-tertiary: #4a5568;
        --text-primary: #ffffff;
        --text-secondary: #e2e8f0;
        --text-muted: #cbd5e1;
        --glass-bg: rgba(45, 55, 72, 0.9);
        --glass-border: rgba(74, 85, 104, 0.95);
        --nav-blur: rgba(26, 32, 44, 0.9);
        --accent: #f7fafc;
    }
}

/* Global Styles */
* {
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
}

/* Utility Classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.bg-secondary { background-color: var(--bg-secondary); }
.border-secondary { border-color: var(--text-secondary); }
.border-muted { border-color: var(--text-muted); }

/* Gradients */
.gradient-subtle {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent) 0%, var(--text-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glass Effect */
.glass-subtle {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
}

/* Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

.hover-lift {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.floating-gentle {
    animation: floating-gentle 8s ease-in-out infinite;
}

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

/* Decorative Elements */
.blur-decoration {
    position: absolute;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    z-index: -1;
}

/* Hide decorative elements on mobile to prevent overflow */
@media (max-width: 768px) {
    .blur-decoration {
        display: none;
    }
}

/* Section Animations */
.section-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-animation {
    animation-delay: var(--delay, 0s);
}

/* Icon Animations */
.icon-float {
    transition: all 0.4s ease;
}

.icon-float:hover {
    transform: translateY(-4px) scale(1.1);
}

/* Navigation */
.nav-blur {
    background: var(--nav-blur);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Hero Section */
.hero-text {
    opacity: 0;
    animation: hero-reveal 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes hero-reveal {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Link Animations */
.line-through-animation {
    position: relative;
    overflow: hidden;
}

.line-through-animation::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    transition: width 0.6s ease;
}

.line-through-animation:hover::after {
    width: 100%;
}

.line-through-animation:hover {
    color: var(--text-primary) !important;
}

/* Form Styles */
.form-input {
    width: 100%;
    border: 1px solid var(--text-muted);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    background-color: var(--glass-bg);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Dark mode specific styles */
@media (prefers-color-scheme: dark) {
    option {
        background-color: var(--bg-secondary);
        color: var(--text-primary);
    }
    
    .opacity-60 {
        opacity: 0.8;
    }
    
    .text-xs {
        color: var(--text-muted) !important;
    }
}

/* Portfolio Styles */
.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 4/3;
    background-color: var(--bg-tertiary);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-content {
    text-align: center;
    color: white;
}

.portfolio-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.05);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #10b981;
}

.notification.error {
    border-left: 4px solid #ef4444;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .hero-text {
        text-align: center;
        padding: 0 1rem;
    }
    
    .hero-text h1 {
        font-size: 3rem !important;
        line-height: 1.1;
    }
    
    .hero-text p {
        font-size: 1.125rem !important;
        padding: 0 0.5rem;
    }
    
    .glass-subtle {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .portfolio-item {
        aspect-ratio: 3/2;
    }
    
    /* Ensure no horizontal overflow */
    .grid {
        width: 100%;
        max-width: 100%;
    }
    
    .px-6, .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Fix CTA buttons on mobile */
    .cta-primary, .cta-secondary {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
}

/* Center Content Fix */
section {
    width: 100%;
    max-width: 100vw;
    position: relative;
    overflow-x: hidden;
}

.max-w-6xl, .max-w-4xl {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (min-width: 1024px) {
    .max-w-6xl {
        max-width: 72rem;
    }
    
    .max-w-4xl {
        max-width: 56rem;
    }
}

/* Ensure proper text alignment */
.text-center {
    text-align: center;
}

/* Fix button alignment in hero */
#accueil .hero-text > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 640px) {
    #accueil .hero-text > div {
        flex-direction: row;
        justify-content: center;
    }
}

/* CTA Button Styles */
.cta-primary {
    background-color: white;
    color: #1f2937;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    min-width: 200px;
    text-align: center;
}

.cta-primary:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    background-color: #f9fafb;
}

.cta-secondary {
    background-color: transparent;
    color: var(--text-primary);
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--text-secondary);
    min-width: 200px;
    text-align: center;
}

.cta-secondary:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* Improve mobile navigation */
@media (max-width: 768px) {
    nav .hidden {
        display: none;
    }
    
    nav .mobile-menu {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--nav-blur);
        backdrop-filter: blur(16px);
        padding: 1rem;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    nav .mobile-menu a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--text-muted);
        width: 100%;
    }
    
    /* Ensure nav container doesn't overflow */
    nav > div {
        max-width: 100%;
        overflow-x: hidden;
    }
}