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

body {
    font-family: 'Blinker', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    background-image:
        radial-gradient(at 20% 30%, rgba(150, 150, 150, 0.08) 0px, transparent 50%),
        radial-gradient(at 80% 70%, rgba(120, 120, 120, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(100, 100, 100, 0.05) 0px, transparent 50%);
    color: #ffffff;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(150, 150, 150, 0.2);
    position: relative;
}

.logo {
    width: 60px;
    height: 60px;
    margin-right: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(150, 150, 150, 0.1);
    border: 1.5px solid rgba(150, 150, 150, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(150, 150, 150, 0.2);
    transition: all 0.3s ease;
}

.logo:hover {
    box-shadow: 0 0 30px rgba(200, 200, 200, 0.4);
    border-color: rgba(200, 200, 200, 0.5);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.title {
    flex-grow: 1;
}

h1 {
    font-family: 'Blinker', sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(200, 200, 200, 0.3), 0 0 40px rgba(150, 150, 150, 0.2);
    animation: pulse 3s ease-in-out infinite;
    transition: color 0.3s ease;
}

h1:hover {
    color: #1a1a1a;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 40px rgba(200, 200, 200, 0.5);
}

@keyframes pulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(200, 200, 200, 0.3), 0 0 40px rgba(150, 150, 150, 0.2);
    }
    50% {
        text-shadow: 0 0 30px rgba(200, 200, 200, 0.5), 0 0 60px rgba(150, 150, 150, 0.3);
    }
}

.subtitle {
    font-family: 'Blinker', sans-serif;
    font-size: 14px;
    color: #c0c0c0;
    opacity: 0.9;
    margin-top: 4px;
    transition: color 0.3s ease;
}

.subtitle:hover {
    color: #404040;
}

h2 {
    font-family: 'Blinker', sans-serif;
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #d0d0d0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(200, 200, 200, 0.3);
    transition: color 0.3s ease;
}

h2:hover {
    color: #2a2a2a;
}

h2::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #c0c0c0, #8b9098);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(150, 150, 150, 0.3);
}

.card {
    background: rgba(255, 255, 255, 0.09);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 35px;
    padding: 30px;
    margin-bottom: 25px;
    backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
    border-color: rgba(200, 200, 200, 0.4);
    box-shadow:
        0 12px 48px rgba(150, 150, 150, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

.prompt-section {
    position: relative;
    overflow: hidden;
}

.prompt-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #c0c0c0, #8b9098, transparent);
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(150, 150, 150, 0.3);
}

.prompt-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 15px;
    gap: 10px;
}

.prompt-subtitle {
    font-family: 'Blinker', sans-serif;
    font-size: 16px;
    color: #9ca3af;
    font-weight: 400;
}

#chat-container {
    height: 500px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid rgba(150, 150, 150, 0.2);
    scrollbar-width: thin;
    scrollbar-color: rgba(150, 150, 150, 0.3) transparent;
}

#chat-container::-webkit-scrollbar {
    width: 6px;
}

#chat-container::-webkit-scrollbar-track {
    background: transparent;
}

#chat-container::-webkit-scrollbar-thumb {
    background: rgba(150, 150, 150, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

#chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(150, 150, 150, 0.5);
}

.chat-message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    animation: fadeInUp 0.3s ease-out;
}

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

.chat-message.user {
    background: linear-gradient(135deg, #c0c0c0, #8b9098);
    color: #fff;
    margin-left: auto;
    text-align: right;
    transition: all 0.3s ease;
}

.chat-message.user:hover {
    background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
    color: #000;
}

.chat-message.assistant {
    background: rgba(150, 150, 150, 0.1);
    border: 1px solid rgba(150, 150, 150, 0.2);
    color: #fff;
    transition: all 0.3s ease;
}

.chat-message.assistant:hover {
    background: rgba(200, 200, 200, 0.15);
    border-color: rgba(200, 200, 200, 0.3);
}

.message-role {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 5px;
}

.message-content {
    line-height: 1.6;
}

.message-content strong {
    font-weight: 600;
}

.message-content a {
    color: #c0c0c0;
    text-decoration: none;
    border-bottom: 1px solid rgba(192, 192, 192, 0.3);
    transition: all 0.3s ease;
}

.message-content a:hover {
    color: #1a1a1a;
    background: rgba(200, 200, 200, 0.2);
    border-bottom-color: #8b9098;
    padding: 2px 4px;
    border-radius: 4px;
}

/* Règles génériques pour textarea - empêche le zoom sur mobile */
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    border: 1.5px solid rgba(150, 150, 150, 0.3);
    border-radius: 16px;
    padding: 15px;
    font-family: 'Blinker', sans-serif;
    font-size: 16px; /* 16px minimum pour éviter le zoom automatique sur iOS */
    resize: vertical;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

textarea:focus {
    outline: none;
    border-color: #c0c0c0;
    box-shadow:
        0 0 0 3px rgba(150, 150, 150, 0.1),
        0 0 20px rgba(150, 150, 150, 0.2);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

textarea::placeholder {
    color: #888888;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

#chat-input {
    flex: 1;
    height: 60px;
    resize: none;
    min-height: 50px;
}

button {
    background: rgba(150, 150, 150, 0.1);
    color: #fff;
    border: 1.5px solid rgba(150, 150, 150, 0.4);
    padding: 1rem 2.5rem;
    font-family: 'Blinker', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(200, 200, 200, 0.2), transparent);
    transition: left 0.5s ease;
}

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

button:hover {
    color: #000;
    background: rgba(200, 200, 200, 0.2);
    border-color: #c0c0c0;
    box-shadow: 0 5px 20px rgba(150, 150, 150, 0.3);
    transform: translateY(-2px) scale(1.02);
}

button.primary {
    background: linear-gradient(135deg, #c0c0c0, #8b9098);
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: 0 5px 25px rgba(150, 150, 150, 0.4);
    height: 60px;
    padding: 0 20px;
    min-width: 80px;
    white-space: nowrap;
}

button.primary:hover {
    background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
    color: #000;
    box-shadow: 0 8px 30px rgba(150, 150, 150, 0.5);
    transform: translateY(-4px) scale(1.02);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#typing-indicator {
    color: #c0c0c0;
    font-style: italic;
    margin-top: 10px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        margin-bottom: 20px;
        padding: 15px 0;
    }

    .logo {
        margin-right: 0;
        width: 50px;
        height: 50px;
    }

    h1 {
        font-size: 22px;
        letter-spacing: 1.5px;
    }

    .subtitle {
        font-size: 13px;
    }

    .card {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 25px;
    }

    /* Messages chat - amélioration débordement */
    .chat-message {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 15px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }

    .message-content {
        line-height: 1.5;
    }

    /* Zone de texte plus grande sur mobile */
    textarea {
        font-size: 16px !important; /* Évite le zoom automatique sur iOS */
        padding: 12px;
    }

    #chat-container {
        height: 400px !important;
        padding: 12px;
    }

    /* Chat responsive fixes - FORCE sur mobile */
    #chat-input {
        height: 100px !important;
        max-height: 100px !important;
        min-height: 100px !important;
        font-size: 16px !important; /* Évite le zoom automatique sur iOS */
        padding: 12px !important;
        flex: 1 !important;
        line-height: 1.4;
    }

    #send-message-btn {
        height: 50px !important;
        max-height: 50px !important;
        min-height: 50px !important;
        padding: 0 20px !important;
        font-size: 12px !important;
        min-width: 80px !important;
        max-width: 90px !important;
        flex: none !important;
    }

    .chat-input-container {
        gap: 10px !important;
        display: flex !important;
        align-items: center !important;
    }
}

/* Smartphones très petits */
@media (max-width: 480px) {
    .chat-message {
        max-width: 95%;
        font-size: 14px;
    }

    #chat-container {
        height: 350px !important;
    }

    #chat-input {
        height: 96px !important;
        max-height: 96px !important;
        font-size: 16px !important; /* Maintenir 16px pour éviter le zoom */
        padding: 10px !important;
    }

    #send-message-btn {
        height: 48px !important;
        max-height: 48px !important;
        padding: 0 16px !important;
        font-size: 11px !important;
        min-width: 70px !important;
        max-width: 80px !important;
    }

    .chat-input-container {
        gap: 8px !important;
    }
}

/* Optimisation tactile pour tous les mobiles */
@media (hover: none) and (pointer: coarse) {
    button,
    #chat-input {
        touch-action: manipulation;
    }

    /* Augmente les zones tactiles */
    button {
        min-height: 48px;
    }

    /* Empêche la sélection de texte sur les boutons */
    button {
        -webkit-user-select: none;
        user-select: none;
    }
}
