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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ===== AUTHENTIFICATION ===== */
.auth-container {
    width: 100%;
    max-width: 450px;
    animation: fadeIn 0.5s ease-in;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: #f5f5f5;
    padding: 5px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-form {
    animation: slideIn 0.3s ease-out;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

.auth-note {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 0.85rem;
}

.auth-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.auth-message.success {
    background: #d4edda;
    color: #155724;
}

.auth-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* ===== APPLICATION PRINCIPALE ===== */
.app-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.btn-icon-header {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-header:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.welcome-message p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.message {
    margin: 15px 0;
    display: flex;
    align-items: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
}

.message.bot .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-area textarea {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
}

.input-area textarea:focus {
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 8px;
}

/* ===== BOUTONS ===== */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-icon {
    background: #f0f0f0;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.btn-icon.recording {
    background: #ff4757;
    animation: pulse 1.5s infinite;
}

.actions-container {
    padding: 15px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.modal-large {
    max-width: 800px;
}

.modal-xlarge {
    max-width: 1000px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #667eea;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 10px;
}

.setting-item p {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* ===== SÉLECTION DE MODÈLE IA ===== */
.modal-description {
    margin-bottom: 20px;
    color: #666;
    text-align: center;
}

.provider-selection {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.provider-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.provider-btn:hover {
    background: #ebebeb;
}

.provider-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.provider-icon {
    font-size: 1.3rem;
}

.models-list {
    margin-bottom: 20px;
}

.model-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border: 2px solid transparent;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.model-item:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.model-info {
    flex: 1;
}

.model-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.model-description {
    font-size: 0.85rem;
    color: #666;
}

.model-selected {
    font-size: 1.5rem;
    color: #667eea;
    font-weight: bold;
}

.selected-model-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* ===== AFFICHAGE DU RÉSUMÉ ===== */
.summary-content {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 20px;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
}

.summary-content h1 {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.summary-content h2 {
    font-size: 1.2rem;
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.summary-content h3 {
    font-size: 1rem;
    color: #555;
    margin-top: 15px;
    margin-bottom: 8px;
}

.summary-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.summary-content li {
    margin-bottom: 5px;
}

.summary-content strong {
    color: #333;
}

.summary-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ===== HISTORIQUE ===== */
.history-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 12px;
}

.history-filter-bar label {
    font-weight: 600;
    color: #333;
}

.history-filter-bar select {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.history-content {
    max-height: 60vh;
    overflow-y: auto;
}

.history-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.history-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.history-date-main {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.history-time {
    font-size: 0.9rem;
    color: #666;
    margin-top: 4px;
}

.summary-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-icon {
    font-size: 1rem;
}

.history-preview {
    margin-bottom: 15px;
}

.preview-item {
    margin-bottom: 10px;
}

.preview-item strong {
    display: block;
    color: #667eea;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.preview-item p {
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.history-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-history {
    flex: 1;
    min-width: 150px;
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-history:hover {
    border-color: #667eea;
    background: #f9f9f9;
}

.btn-history.delete-entry {
    border-color: #ff4757;
    color: #ff4757;
}

.btn-history.delete-entry:hover {
    background: #ff4757;
    color: white;
}

.loading, .empty-state, .error-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.empty-state p:first-child,
.error-state p:first-child {
    font-size: 3rem;
    margin-bottom: 10px;
}

.transcript-content {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 20px;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
}

/* ===== PARAMÈTRES API KEYS ===== */
.section-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.form-group a {
    color: #667eea;
    text-decoration: none;
}

.form-group a:hover {
    text-decoration: underline;
}

/* ===== UTILITAIRES ===== */
.hidden {
    display: none !important;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ===== SCROLLBAR ===== */
.chat-container::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-container::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .auth-container {
        max-width: 100%;
    }
    
    .auth-card {
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .app-container {
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .header-actions {
        gap: 5px;
    }
    
    .btn-secondary {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
    }
}
