/* ============================================
   Carticor Home — Styles
   Design moderne, responsive, professionnel
   ============================================ */

:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-elevated: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #2ea043;
    --accent-hover: #3fb950;
    --accent-soft: rgba(46, 160, 67, 0.15);
    --gradient-start: #2ea043;
    --gradient-end: #56d364;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---- Header ---- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.header.is-scrolled {
    background: rgba(13, 17, 23, 0.95);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo:hover {
    color: var(--accent);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition);
}

.nav-link:hover,
.nav-link:focus {
    color: var(--text);
}

.nav-link-cta {
    color: var(--accent);
}

.nav-link-cta:hover {
    color: var(--accent-hover);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

/* ---- Hero ---- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6rem 0 4rem;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--accent-soft) 0%, transparent 50%),
                radial-gradient(ellipse 60% 40% at 80% 80%, rgba(46, 160, 67, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
    max-width: 18ch;
    margin-left: auto;
    margin-right: auto;
}

.gradient-text {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 42ch;
    margin: 0 auto 2rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.1s;
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hero-scroll {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    border-radius: 2px;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.5; transform: scaleY(0.8); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ---- Sections communes ---- */
.section {
    padding: 5rem 0;
}

.section-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

/* ---- Services ---- */
.services {
    background: var(--bg-card);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.service-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: border-color var(--transition), transform var(--transition);
}

.service-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.service-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1.25rem;
    color: var(--accent);
}

.service-icon svg {
    width: 100%;
    height: 100%;
}

.service-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.service-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

/* ---- À propos ---- */
.about {
    background: var(--bg-dark);
}

.about-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-content .section-title {
    margin-bottom: 1.5rem;
}

.about-text {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.about-visual {
    display: flex;
    justify-content: center;
}

.about-card {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--accent-soft), transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
}

.about-stat {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.about-stat-label {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ---- Contact ---- */
.contact {
    background: var(--bg-card);
}

.contact-intro {
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 50ch;
}

.contact-form {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: var(--text-muted);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.btn-submit {
    align-self: flex-start;
    min-width: 140px;
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-success {
    color: var(--accent);
    font-weight: 500;
    margin-top: 0.5rem;
}

.form-error {
    color: #f85149;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ---- Footer ---- */
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-brand {
    font-weight: 700;
    color: var(--text);
}

.footer-copy {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---- Chatbot widget ---- */
.chatbot-widget {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    font-family: var(--font-sans);
}

.chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: background var(--transition), transform var(--transition);
}

.chatbot-toggle:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.chatbot-toggle .chatbot-icon-close {
    display: none;
}

.chatbot-toggle[aria-expanded="true"] .chatbot-icon-open {
    display: none;
}

.chatbot-toggle[aria-expanded="true"] .chatbot-icon-close {
    display: block;
}

.chatbot-toggle svg {
    width: 26px;
    height: 26px;
}

.chatbot-panel {
    position: absolute;
    bottom: calc(56px + 12px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 480px;
    max-height: calc(100vh - 8rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-panel[hidden] {
    display: none !important;
}

.chatbot-header {
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.chatbot-close:hover {
    color: var(--text);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chatbot-msg {
    max-width: 85%;
    animation: msgIn 0.25s ease;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-msg-content {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1.5;
}

.bot-msg {
    align-self: flex-start;
}

.bot-msg .chatbot-msg-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
}

.user-msg {
    align-self: flex-end;
}

.user-msg .chatbot-msg-content {
    background: var(--accent);
    color: #fff;
}

.chatbot-msg-content a {
    color: inherit;
    text-decoration: underline;
}

.bot-msg .chatbot-msg-content a {
    color: var(--accent-hover);
}

.chatbot-input-wrap {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color var(--transition);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.chatbot-send:hover {
    background: var(--accent-hover);
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Scrollbar chatbot */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .nav {
        display: none;
    }

    .nav.is-open {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 1rem;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
    }

    .nav.is-open .nav-link {
        padding: 0.75rem;
        border-radius: var(--radius);
    }

    .nav.is-open .nav-link:hover {
        background: var(--bg-elevated);
    }

    .menu-toggle {
        display: flex;
    }

    .hero {
        padding: 5rem 0 3rem;
    }

    .section {
        padding: 3.5rem 0;
    }

    .about-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-visual {
        order: -1;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .chatbot-panel {
        width: calc(100vw - 2rem);
        height: 70vh;
        right: -0.5rem;
    }
}

@media (max-width: 480px) {
    .hero-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .chatbot-widget {
        bottom: 1rem;
        right: 1rem;
    }

    .chatbot-panel {
        bottom: calc(56px + 8px);
        width: calc(100vw - 1rem);
    }
}
