/* Variables CSS style Notion */
:root {
    /* Couleurs principales */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    
    /* Couleurs Notion-like */
    --notion-bg: #ffffff;
    --notion-bg-secondary: #f7f6f3;
    --notion-bg-tertiary: #f1f1ef;
    --notion-text: #37352f;
    --notion-text-light: #787774;
    --notion-text-lighter: #9b9a97;
    --notion-border: #e9e9e7;
    --notion-hover: #f7f6f3;
    
    /* Status colors */
    --success-color: #0f7b0f;
    --warning-color: #b45309;
    --error-color: #e5484d;
    --info-color: #0ea5e9;
    
    /* Ombres subtiles */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    /* Bordures */
    --radius-xs: 3px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Transitions fluides */
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol';
    background: var(--notion-bg);
    color: var(--notion-text);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header style Notion */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--notion-border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all var(--transition);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo adapté pour format large */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--notion-text);
    transition: all var(--transition);
    padding: 6px 0;
}

.logo:hover {
    color: var(--primary-color);
}

.logo-image {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    transition: all var(--transition);
}

.logo:hover .logo-image {
    transform: scale(1.02);
}

/* Navigation */
.nav-actions .btn {
    width: max-content;
    flex: 1;
}

.nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    width: fit-content;    /* Le conteneur s'adapte */
}

/* Boutons style Notion */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
    background: transparent;
    box-sizing: border-box;
    min-width: fit-content;   
}

.btn:hover {
    background: var(--notion-hover);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--notion-bg);
    color: var(--notion-text-light);
    border-color: var(--notion-border);
}

.btn-secondary:hover {
    background: var(--notion-hover);
    color: var(--notion-text);
}

.btn-danger {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 13px;
}

/* Main content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
}

/* Cards style Notion */
.card {
    background: var(--notion-bg);
    border: 1px solid var(--notion-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-slow);
    box-shadow: var(--shadow-xs);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--notion-border);
    background: var(--notion-bg-secondary);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--notion-text-light);
}

.card-content {
    padding: 24px;
}

/* Recherche et filtres style Notion */
.search-section {
    margin-bottom: 32px;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
}

.search-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: var(--notion-bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--notion-border);
    min-width: 80px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--notion-text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.search-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    padding: 10px 14px;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--notion-bg);
    color: var(--notion-text);
    transition: all var(--transition);
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input::placeholder {
    color: var(--notion-text-lighter);
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius-md);
    background: var(--notion-bg);
    color: var(--notion-text);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    font-size: 14px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Filtres avancés */
.advanced-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--notion-bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--notion-border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--notion-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tags style Notion */
.tags-section {
    margin-top: 16px;
    padding: 16px;
    background: var(--notion-bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--notion-border);
}

.tags-header {
    font-size: 12px;
    font-weight: 500;
    color: var(--notion-text-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tags-filter {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    user-select: none;
}

.tag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.tag-inactive {
    background: var(--notion-bg);
    color: var(--notion-text-light);
    border: 1px solid var(--notion-border);
}

.tag-inactive:hover {
    background: var(--notion-hover);
    color: var(--notion-text);
    border-color: var(--primary-color);
}

/* Files grid style Notion */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.file-card {
    background: var(--notion-bg);
    border: 1px solid var(--notion-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all var(--transition-slow);
    cursor: pointer;
    position: relative;
}

.file-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.file-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
}

.file-icon.pdf { background: #ff6b6b; }
.file-icon.doc { background: #4dabf7; }
.file-icon.xls { background: #51cf66; }
.file-icon.img { background: #ffd43b; }
.file-icon.default { background: #868e96; }

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 4px;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.3;
}

.file-meta {
    color: var(--notion-text-lighter);
    font-size: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.file-description {
    color: var(--notion-text-light);
    font-size: 13px;
    margin: 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.file-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.file-tag {
    padding: 2px 6px;
    background: var(--notion-bg-secondary);
    border: 1px solid var(--notion-border);
    border-radius: var(--radius-xs);
    font-size: 11px;
    color: var(--notion-text-light);
    font-weight: 500;
}

.file-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    opacity: 0;
    transform: translateY(4px);
    transition: all var(--transition-slow);
}

.file-card:hover .file-actions {
    opacity: 1;
    transform: translateY(0);
}

/* Formulaires style Notion */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--notion-text);
    font-size: 14px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--notion-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--notion-bg);
    color: var(--notion-text);
    transition: all var(--transition);
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

/* Upload zone style Notion */
.upload-zone {
    border: 2px dashed var(--notion-border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    background: var(--notion-bg-secondary);
    transition: all var(--transition-slow);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.upload-zone.dragover {
    border-color: var(--accent-color);
    background: var(--primary-light);
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 8px;
}

.upload-subtext {
    color: var(--notion-text-light);
    font-size: 14px;
    line-height: 1.4;
}

/* Messages style Notion */
.message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border-left: 3px solid;
    font-size: 14px;
}

.message-success {
    background: #f0f9f0;
    border-left-color: var(--success-color);
    color: #0f5132;
}

.message-error {
    background: #fef2f2;
    border-left-color: var(--error-color);
    color: #991b1b;
}

.message-warning {
    background: #fefbf2;
    border-left-color: var(--warning-color);
    color: #92400e;
}

/* Loading */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--notion-border);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* Modal style Notion */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--notion-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-body {
    padding: 24px;
    overflow: auto;
    flex: 1;
}

/* Footer style Notion */
.footer {
    background: var(--notion-bg-secondary);
    border-top: 1px solid var(--notion-border);
    padding: 24px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-text {
    color: var(--notion-text-light);
    font-size: 13px;
}

.footer-contact {
    color: var(--notion-text-light);
    font-size: 13px;
}

.footer-contact a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-contact a:hover {
    text-decoration: underline;
}

/* Page de connexion */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--notion-bg-secondary);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--notion-text-light);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {
    .search-filters {
        grid-template-columns: 1fr;
    }
    
    .advanced-filters {
        grid-template-columns: 1fr;
    }
    
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .search-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .nav-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .files-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header,
    .card-content {
        padding: 16px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-scale {
    animation: fadeInScale 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--notion-text-light); }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.hidden { display: none; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }