/* ========================================
   POÈTE CLAIR - Style Moderne élégant (thème clair KULTSE)
   ======================================== */

/* Variables Globales */
:root {
    /* Couleurs Light Theme - Élégance claire */
    --bg-primary: #ffffff;
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-tertiary: #f1f3f5;
    --bg-glass: #ffffff;
    --bg-glass-hover: #f8f9fa;

    /* Gradients sarcelle */
    --gradient-primary: linear-gradient(135deg, #4a7c7e 0%, #7fb8a6 100%);
    --gradient-secondary: linear-gradient(135deg, #3d6669 0%, #4a7c7e 100%);
    --gradient-dark: linear-gradient(180deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    --gradient-glass: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);

    /* Textes */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #7a7a7a;
    --text-accent: #4a7c7e;

    /* Bordures et effets */
    --border-glass: #e5e7eb;
    --border-glow: rgba(74, 124, 126, 0.5);
    --shadow-glow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    /* Accents */
    --accent-primary: #4a7c7e;
    --accent-secondary: #7fb8a6;
    --accent-hover: #3d6669;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Crimson Text', Georgia, serif;
    --font-display: 'Playfair Display', serif;

    /* Spacing */
    --header-height: 70px;
    --input-area-height: 140px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: #ffffff;
    color: #1a1a1a;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Fond animé avec touches sarcelle très subtiles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(74, 124, 126, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 70% 60%, rgba(74, 124, 126, 0.03) 0%, transparent 45%),
        radial-gradient(circle at 90% 20%, rgba(74, 124, 126, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Container principal */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header clair avec léger flou */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 999999 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    isolation: isolate;
}

/* Force tous les éléments du header au premier plan */
.app-header * {
    position: relative;
    z-index: 999999 !important;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 999999;
}

/* Logo élégant */
.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 999999 !important;
    isolation: isolate;
}

.logo i {
    font-size: 1.8rem;
    color: #4a7c7e;
    filter: none;
}

.logo a {
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    position: relative !important;
    z-index: 1003 !important;
}

.logo h1 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
    filter: none;
    position: relative !important;
    z-index: 999999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
}

/* Actions du header */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Boutons clairs */
.btn-glass {
    padding: 0.6rem 1.2rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-glass:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    color: var(--text-primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.theme-toggle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-top: var(--header-height);
    margin-bottom: var(--input-area-height);
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

/* Écran d'accueil poétique */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--input-area-height));
    padding: 2rem;
}

.welcome-content {
    text-align: center;
    max-width: 700px;
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow-card);
}

.welcome-icon {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 2rem;
    filter: none;
}

.welcome-content h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.welcome-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.8;
    font-style: italic;
}

/* Chips de suggestion claires */
.suggestion-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 100%;
}

.chip {
    padding: 1rem 1.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 50px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.chip:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    color: var(--text-primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.chip i {
    font-size: 1.2rem;
    color: var(--text-accent);
}

/* Chat Container */
.chat-container {
    display: none;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--input-area-height));
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 0;
    scroll-behavior: smooth;
}

/* Messages clairs */
.message {
    margin-bottom: 2rem;
}

.message-content {
    display: inline-block;
    max-width: 85%;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px 10px 5px 10px;
    margin-left: auto;
    display: block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.message.assistant .message-content {
    background: #ffffff;
    color: var(--text-primary);
    padding: 1.2rem 1.5rem;
    border-radius: 5px 10px 10px 10px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card);
}

.message.assistant .poem {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 2;
    white-space: pre-wrap;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--gradient-glass);
    border-radius: 10px;
    border-left: 3px solid var(--accent-primary);
    font-style: italic;
    color: var(--text-primary);
    position: relative;
}

.message.assistant .poem::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 4rem;
    color: var(--accent-primary);
    opacity: 0.3;
}

/* Actions des messages */
.message-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.message-action {
    padding: 0.4rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-action:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    color: var(--text-accent);
}

/* Indicateur de frappe animé */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: 5px 10px 10px 10px;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: var(--gradient-primary);
    border-radius: 50%;
    margin: 0 3px;
    animation: typingWave 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingWave {
    0%, 80%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.5);
        opacity: 1;
    }
}

/* Zone de saisie claire */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    padding: 1.5rem;
    z-index: 100;
    box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.05);
}

.input-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.message-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    max-height: 120px;
    line-height: 1.5;
}

.message-input:focus {
    border-color: var(--border-glow);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(74, 124, 126, 0.1);
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    width: 55px;
    height: 55px;
    border: none;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.send-button:hover:not(:disabled) {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #9ca3af, #d1d5db);
}

.send-button i {
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
}

/* Info de saisie */
.input-info {
    max-width: 1000px;
    margin: 0.5rem auto 0;
    display: flex;
    justify-content: flex-end;
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    background: #ffffff;
    padding: 2rem;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card);
    text-align: center;
}

.loading-spinner i {
    font-size: 3.5rem;
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
    display: block;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 1.5rem);
    right: 1.5rem;
    z-index: 1000;
}

.toast {
    background: #ffffff;
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 250px;
    box-shadow: var(--shadow-card);
}

.toast.success {
    border-color: rgba(74, 124, 126, 0.5);
    background: rgba(74, 124, 126, 0.08);
}

.toast.error {
    border-color: rgba(74, 124, 126, 0.5);
    background: rgba(74, 124, 126, 0.1);
}

.toast i {
    font-size: 1.5rem;
}

.toast.success i {
    color: var(--accent-primary);
}

.toast.error i {
    color: var(--accent-secondary);
}

/* Bouton Feed avec style moderne */
.btn-feed {
    padding: 0.7rem 1.5rem;
    background: var(--gradient-secondary);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-feed:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-feed i {
    font-size: 1rem;
}

/* Bouton retour */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--bg-glass);
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid var(--border-glass);
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2rem;
}

.btn-back:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Modes d'accueil */
.welcome-modes {
    font-size: 0.95rem;
    line-height: 2;
    color: var(--text-secondary);
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-glass);
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    font-style: italic;
}

.welcome-expansion {
    font-size: 1rem;
    color: var(--text-accent);
    font-weight: 500;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --input-area-height: 120px;
    }

    .welcome-content h2 {
        font-size: 1.6rem;
    }

    .welcome-icon {
        font-size: 2rem;
    }

    .suggestion-chips {
        grid-template-columns: 1fr;
    }

    .message-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 55px;
        --input-area-height: 110px;
    }

    .logo h1 {
        font-size: 1.2rem;
        filter: none;
    }

    .welcome-content {
        padding: 2rem 1.5rem;
    }

    .welcome-content h2 {
        font-size: 1.4rem;
    }

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

    .chip {
        padding: 0.8rem 1.2rem;
        font-size: 0.85rem;
    }

    .message-input {
        font-size: 16px;
    }

    .send-button {
        width: 48px;
        height: 48px;
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f3f5;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-secondary);
}

/* Effets poétiques supplémentaires */
.poem-container {
    position: relative;
    overflow: hidden;
}

.poem-container::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(74, 124, 126, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* Focus visible pour accessibilité */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Selection personnalisée */
::selection {
    background: var(--accent-primary);
    color: white;
}

::-moz-selection {
    background: var(--accent-primary);
    color: white;
}