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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f9fafb;
    color: #111827;
    line-height: 1.6;
}

/* Layout principal */
.app-container {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 256px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Boutons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Sidebar */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
}

.nav-item i {
    width: 1.25rem;
    margin-right: 0.75rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* Modales */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Page de connexion */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    padding: 1rem;
    position: relative;
}

.login-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    border: 1px solid #e5e7eb;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: #2563eb;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.login-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.75rem;
}

.login-header p {
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Amélioration des champs de formulaire */
.login-form {
    space-y: 1.5rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.login-form .form-input {
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.login-form .form-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.login-form .btn-primary {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 0.75rem;
    background: #2563eb;
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-form .btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
}

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


/* Drag & Drop */
.dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.dropzone i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

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

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: 1rem;
}

.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour les étapes de téléversement */
.upload-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
}

.step-indicator {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.step.active .step-number {
    background: #2563eb;
    color: white;
}

.step-label {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
}

.step.active .step-label {
    color: #2563eb;
    font-weight: 600;
}

.step-line {
    height: 2px;
    background: #e5e7eb;
    flex: 1;
    margin: 0 1rem;
    margin-bottom: 2rem;
}

.step-content {
    min-height: 400px;
}

/* Styles pour la sélection manuelle de dossiers */
.manual-folder-item:hover {
    background: #f9fafb !important;
}

.manual-folder-item.leaf-folder:hover {
    background: #f0fdf4 !important;
}

.loading-tree {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Styles pour l'explorateur de fichiers */
.explorer-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
}

.breadcrumb-bar {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.breadcrumb {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.breadcrumb-item {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-item:hover {
    background: #dbeafe;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #6b7280;
}

.upload-zone {
    margin: 1rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
}

.upload-content i {
    font-size: 2rem;
    color: #9ca3af;
}

.folder-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    align-content: start;
}

.explorer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border: 2px solid transparent;
}

.explorer-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.explorer-item.selected {
    background: #dbeafe;
    border: 2px solid #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

.folder-item .item-icon i {
    font-size: 3rem;
    color: #f59e0b;
}

.document-item .item-icon i {
    font-size: 3rem;
    color: #6b7280;
}

.document-item .item-icon .fa-file-pdf {
    color: #dc2626;
}

.document-item .item-icon .fa-file-image {
    color: #059669;
}

.document-item .item-icon .fa-file-word {
    color: #2563eb;
}

.document-item .item-icon .fa-file-excel {
    color: #059669;
}

.document-item .item-icon .fa-file-powerpoint {
    color: #dc2626;
}

.item-name {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    word-break: break-word;
    line-height: 1.2;
}

.item-size {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.empty-folder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: #9ca3af;
}

.empty-folder i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Menu contextuel */
.context-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
    padding: 0.5rem 0;
}

.context-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background: #f3f4f6;
}

.context-menu-item i {
    width: 1rem;
    color: #6b7280;
}

.context-menu-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

/* Boîte de sélection par glisser-déposer */
.selection-box {
    position: fixed;
    border: 2px solid #2563eb;
    background: rgba(37, 99, 235, 0.1);
    pointer-events: none;
    z-index: 1000;
}

/* Amélioration de la sélection */
.explorer-item.selected {
    background: #dbeafe !important;
    border: 2px solid #2563eb !important;
    box-shadow: 0 0 0 1px #2563eb !important;
}

.explorer-item {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Bouton de téléchargement flottant */
.floating-download-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.3s ease-out;
}

.floating-download-btn:hover {
    background: #1d4ed8;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.floating-download-btn:active {
    transform: translateX(-50%) translateY(0);
}

/* Assurer que le bouton est visible par-dessus tout */
.floating-download-btn {
    z-index: 9999 !important;
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
/* Styles pour le chat IA */
.ai-message {
    font-size: 0.875rem;
    line-height: 1.4;
}

.ai-message strong {
    color: #374151;
}

.ai-message .fas {
    margin-right: 0.25rem;
}

/* Animation pour l'indicateur de frappe */
.typing {
    opacity: 0.7;
}

/* Styles pour les suggestions */
#folderSuggestion h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

#folderSuggestion button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    transition: all 0.2s;
}