/* ==========================================================
   STYLE.CSS - Design Mobile-First Optimisé + UX Améliorée
   ========================================================== */

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

/* VARIABLES */
:root {
    --bg-main: #0a0e1a;
    --glass: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.12);
    --glass-strong: rgba(255, 255, 255, 0.12);
    --border: rgba(255, 255, 255, 0.15);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --header-height: 56px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --btn-size: 40px;
    --icon-size: 20px;
}

/* RESET & BASE */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 50%, #0a0e1a 100%);
}

html {
    scroll-behavior: smooth;
}

/* FLUIDITÉ iOS/ANDROID */
* {
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
}

.chat-messages {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.typing-dot {
    will-change: transform;
    transform: translate3d(0,0,0);
}

/* ICÔNES SVG */
.icon-svg {
    width: var(--icon-size);
    height: var(--icon-size);
    flex-shrink: 0;
}
.icon-inline {
    margin-right: 4px;
    vertical-align: -0.2em;
}
.avatar-icon {
    width: 20px;
    height: 20px;
}
.voice-mic-icon {
    width: 28px;
    height: 28px;
}

/* BANNIÈRE PWA INSTALL */
.pwa-install-banner {
    display: none;
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 12px;
    right: 12px;
    z-index: 1500;
    background: var(--glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: pwaBannerIn 0.4s ease;
}
.pwa-install-banner.visible {
    display: block;
}
@keyframes pwaBannerIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pwa-install-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 12px;
}
.pwa-install-icon svg {
    width: 22px;
    height: 22px;
    color: var(--accent);
}
.pwa-install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pwa-install-text strong {
    font-size: 0.95rem;
    color: var(--text-main);
}
.pwa-install-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pwa-install-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.pwa-install-btn:active {
    transform: scale(0.97);
}
.pwa-install-dismiss {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}
.pwa-install-dismiss:active {
    background: var(--glass-hover);
}

/* HEADER */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 16px;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.header-btn .icon-keyboard.hidden,
.header-btn .icon-mic.hidden {
    display: none;
}

.header-btn:active {
    transform: scale(0.95);
    background: var(--glass-hover);
}

/* MAIN CONTAINER */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-top: calc(var(--header-height) + var(--safe-top));
    padding-bottom: var(--safe-bottom);
}

/* CHAT CONTAINER */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--glass);
    border-bottom: 1px solid var(--border);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* BOUTON STOP GÉNÉRATION (NOUVEAU) */
.stop-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--danger), #dc2626);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.stop-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.stop-btn:active {
    transform: scale(0.95);
}

.stop-btn.hidden {
    display: none;
}

.icon-btn {
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:active {
    transform: scale(0.95);
    background: var(--glass);
}

/* MESSAGES */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

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

.message-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--accent);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
}

.message-content {
    flex: 1;
    padding: 12px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

.message.assistant .message-content {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px 16px 16px 4px;
}

.message.welcome .message-content {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ANIMATION TYPING AMÉLIORÉE */
.message.typing .message-content {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.typing-text {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* PULSE GLOW pendant génération */
.message.typing {
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

/* FEEDBACK BUTTONS */
.feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.feedback-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-btn.good:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
}

.feedback-btn.bad:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.feedback-btn:active {
    transform: scale(0.98);
}

/* INPUT ZONE */
.input-zone {
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
}

/* MODE VOCAL - Style GPT moderne */
.voice-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    transition: all 0.3s ease;
}

.voice-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
}
.voice-waveform span {
    width: 4px;
    height: 12px;
    background: var(--glass);
    border-radius: 2px;
    opacity: 0.4;
    transition: height 0.15s ease, opacity 0.15s ease;
}
.voice-mode.recording .voice-waveform span {
    animation: voiceWave 0.8s ease-in-out infinite;
    background: var(--accent);
    opacity: 0.9;
}
.voice-mode.recording .voice-waveform span:nth-child(1) { animation-delay: 0s; }
.voice-mode.recording .voice-waveform span:nth-child(2) { animation-delay: 0.1s; }
.voice-mode.recording .voice-waveform span:nth-child(3) { animation-delay: 0.2s; }
.voice-mode.recording .voice-waveform span:nth-child(4) { animation-delay: 0.3s; }
.voice-mode.recording .voice-waveform span:nth-child(5) { animation-delay: 0.4s; }
.voice-mode.recording .voice-waveform span:nth-child(6) { animation-delay: 0.3s; }
.voice-mode.recording .voice-waveform span:nth-child(7) { animation-delay: 0.2s; }
.voice-mode.recording .voice-waveform span:nth-child(8) { animation-delay: 0.1s; }
.voice-mode.recording .voice-waveform span:nth-child(9) { animation-delay: 0.2s; }
.voice-mode.recording .voice-waveform span:nth-child(10) { animation-delay: 0.3s; }
@keyframes voiceWave {
    0%, 100% { height: 12px; }
    50% { height: 28px; }
}

.voice-status {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    min-height: 1.4em;
}
.voice-mode.recording .voice-status {
    color: var(--accent);
}

.voice-btn-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
}
.voice-btn-large:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.45);
}
.voice-btn-large:active {
    transform: scale(0.96);
}
.voice-btn-large.recording {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.4);
    animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.15); }
}

/* MODE TEXTE */
.text-mode, .voice-mode {
    animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.text-mode {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.voice-btn-mini {
    flex-shrink: 0;
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: all 0.2s;
}
.voice-btn-mini .icon-svg {
    width: 22px;
    height: 22px;
}
.voice-btn-mini:active {
    transform: scale(0.95);
    background: rgba(59, 130, 246, 0.2);
}

#userInput {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    resize: none;
}

#userInput::placeholder {
    color: var(--text-muted);
}

#userInput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.send-btn {
    flex-shrink: 0;
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}
.send-btn .icon-svg {
    width: 20px;
    height: 20px;
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* SIDE PANELS */
.side-panels {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: var(--bg-main);
    max-height: 50vh;
    overflow-y: auto;
}

.panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(59, 130, 246, 0.05);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.panel-header span {
    font-weight: 600;
    font-size: 0.9rem;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.3s;
}

.panel.collapsed .toggle-btn {
    transform: rotate(-90deg);
}

.panel-content {
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.panel.collapsed .panel-content {
    display: none;
}

/* ROLE TABS */
.role-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.role-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.role-tab.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent);
    color: var(--text-main);
}

/* SUGGESTIONS */
.suggestions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-btn {
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-btn:active {
    transform: scale(0.98);
    background: rgba(59, 130, 246, 0.2);
}

/* PLACEHOLDER */
.placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* LOGS */
.logs-content {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.log-entry {
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    white-space: pre-wrap;
    word-break: break-all;
}

.log-entry.INFO {
    border-left: 3px solid var(--success);
}

.log-entry.WARNING {
    border-left: 3px solid var(--warning);
}

.log-entry.ERROR {
    border-left: 3px solid var(--danger);
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    padding: max(20px, var(--safe-top)) max(20px, env(safe-area-inset-right)) max(20px, var(--safe-bottom)) max(20px, env(safe-area-inset-left));
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.2rem;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.setting-item textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* LOADING */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(59, 130, 246, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

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

#loadingText {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    animation: fade-in-out 2s infinite;
}

@keyframes fade-in-out {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* TOAST */
.toast-container {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    animation: toastIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--accent);
}

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

/* RESPONSIVE - MOBILE / PWA PRIORITAIRE */
@media (max-width: 768px) {
    :root {
        --header-height: 52px;
        --btn-size: 40px;
        --icon-size: 20px;
    }

    .input-zone {
        padding: 10px 12px;
        padding-bottom: calc(10px + var(--safe-bottom));
    }

    #userInput {
        font-size: 16px; /* Évite zoom iOS */
        padding: 10px 12px;
        min-height: 40px;
    }

    .send-btn, .voice-btn-mini {
        width: 40px;
        height: 40px;
    }

    .chat-messages {
        padding: 12px;
        padding-bottom: calc(16px + var(--safe-bottom));
    }

    .message {
        max-width: 92%;
    }

    .app-title {
        font-size: 1rem;
    }

    .pwa-install-banner {
        left: 8px;
        right: 8px;
        bottom: calc(72px + var(--safe-bottom));
    }

    .side-panels {
        max-height: 45vh;
    }

    .voice-btn-large {
        width: 56px;
        height: 56px;
    }
    .voice-mic-icon {
        width: 24px;
        height: 24px;
    }
}

/* Mode standalone PWA (écran plein) */
@media (display-mode: standalone), (display-mode: fullscreen) {
    .pwa-install-banner {
        display: none !important;
    }
}

/* RESPONSIVE - TABLET & DESKTOP */
@media (min-width: 768px) {
    .main-container {
        flex-direction: row;
        padding: 20px;
        gap: 20px;
    }
    
    .chat-container {
        flex: 1;
        border-radius: 20px;
        border: 1px solid var(--border);
        background: var(--glass);
        backdrop-filter: blur(20px);
        overflow: hidden;
    }
    
    .side-panels {
        width: 350px;
        max-height: none;
        overflow-y: auto;
    }
    
    .app-title {
        font-size: 1.4rem;
    }

    #userInput {
        font-size: 0.95rem;
    }
}

@media (min-width: 1024px) {
    .side-panels {
        width: 400px;
    }
}

/* HIDDEN UTILITY */
.hidden {
    display: none !important;
}

/* Amélioration panels mobile - scroll fluide */
@media (max-width: 768px) {
    .panel-header span {
        font-size: 0.85rem;
    }
    .role-tab {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}