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

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: #2c3e50;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
}

/* En-tête */
header {
    background: linear-gradient(135deg, #1a4f8c 0%, #2c3e50 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 60px;
    width: auto;
}

.school-info h1 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 5px;
}

.school-info p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: white;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
}

.nav-links a:hover, .nav-links a.active {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.auth-buttons {
    display: flex;
    gap: 15px;
}

/* Boutons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    margin: 0 4px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #7f8c8d;
    color: white;
}

.btn-secondary:hover {
    background-color: #6c7b7d;
}

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

.btn-success:hover {
    background-color: #219653;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

/* Sections principales */
main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    min-height: calc(100vh - 300px);
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Section d'accueil */
.welcome-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.welcome-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.welcome-card h2 {
    color: #1a4f8c;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.welcome-card p {
    margin-bottom: 25px;
    color: #555;
    font-size: 1.05rem;
}

.search-container {
    margin: 25px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.search-box input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    border-color: #3498db;
    outline: none;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    text-align: center;
}

.stat {
    flex: 1;
    padding: 20px;
    background-color: #f1f8ff;
    border-radius: 8px;
    margin: 0 10px;
}

.stat i {
    font-size: 2.5rem;
    color: #3498db;
    margin-bottom: 10px;
}

.stat h3 {
    font-size: 2rem;
    color: #1a4f8c;
    margin: 10px 0;
}

.quick-links {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    align-self: start;
}

.quick-links h3 {
    margin-bottom: 20px;
    color: #1a4f8c;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s;
}

.quick-link:hover {
    background-color: #e3f2fd;
    transform: translateX(5px);
}

.quick-link i {
    font-size: 1.5rem;
    color: #3498db;
}

/* Section bibliothèque */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #1a4f8c;
    color: white;
    text-align: left;
    padding: 18px 15px;
    font-weight: 600;
}

td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background-color: #f9f9f9;
}

.document-link {
    color: #3498db;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s;
}

.document-link:hover {
    color: #1a4f8c;
    text-decoration: underline;
}

/* Section administration */
.admin-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.admin-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.admin-action-btn {
    flex: 1;
    min-width: 200px;
    background-color: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.3s;
}

.admin-action-btn:hover {
    background-color: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-5px);
}

.admin-action-btn i {
    font-size: 2.5rem;
    color: #3498db;
}

.add-document-form, .users-list, .admin-stats {
    margin-top: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
}

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

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #3498db;
    outline: none;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.ai-result {
    margin-top: 20px;
    padding: 15px;
    background-color: #e8f4fc;
    border-radius: 8px;
    border-left: 5px solid #3498db;
}

/* Section à propos */
.about-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 25px;
}

.about-text p {
    margin-bottom: 20px;
    line-height: 1.8;
}

.contact-info, .school-details {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
}

.contact-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.contact-item i {
    font-size: 1.2rem;
    color: #3498db;
    margin-top: 5px;
}

.detail-item {
    padding: 12px 0;
    border-bottom: 1px solid #ddd;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1100;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.document-viewer {
    max-width: 800px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #e74c3c;
}

.admin-hint {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff8e1;
    border-radius: 8px;
    border-left: 5px solid #ffc107;
}

.admin-hint a {
    color: #3498db;
    font-weight: 600;
    cursor: pointer;
}

.admin-hint a:hover {
    text-decoration: underline;
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    padding: 10px;
    background-color: #fdeded;
    border-radius: 6px;
}

/* Visualisation de documents */
.document-view {
    margin: 20px 0;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background-color: #f8f9fa;
}

.pdf-placeholder i {
    font-size: 5rem;
    color: #e74c3c;
    margin-bottom: 20px;
}

.pdf-placeholder p.note {
    margin-top: 15px;
    color: #7f8c8d;
    font-style: italic;
}

.viewer-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.viewer-actions {
    margin-top: 25px;
    text-align: center;
}

/* Pied de page */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
}

.footer-section {
    flex: 1;
    min-width: 250px;
    margin-bottom: 30px;
    padding-right: 30px;
}

.footer-section h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a:hover {
    color: #3498db;
}

.footer-section p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 30px;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 992px) {
    .welcome-container, .about-content {
        grid-template-columns: 1fr;
    }
    
    .header-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .stat {
        margin: 0;
    }
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .admin-action-btn {
        min-width: 100%;
    }
    
    .footer-container {
        flex-direction: column;
    }
}

/* Styles pour l'analyse IA */
.ai-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
}

.ai-result .loading {
    color: #007bff;
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
}

.ai-result .success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ai-result .success h4 {
    margin-bottom: 10px;
    color: #155724;
}

.ai-result .error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    text-align: center;
}

/* Styles pour la gestion des documents */
.manage-docs-container {
    max-width: 1200px;
    margin: 0 auto;
}

.manage-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: flex-start;
}

.documents-management-table {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.documents-management-table h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 24px;
}

.documents-management-table table th {
    background: #1a4f8c;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.documents-management-table table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.documents-management-table table tr:hover {
    background: #f8f9fa;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

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

/* Styles pour les éléments d'authentification
   IMPORTANT: ne pas utiliser !important ici, sinon le JS ne peut pas afficher/masquer
*/

/* Modals affichables - masqués par défaut avec display:none en HTML */
#loginModal,
#forgotPasswordModal,
#editDocumentModal {
    /* display:none sera en HTML, pas en CSS */
}

/* Section Admin - cachée par défaut (gérée par style inline + JS) */
#admin-nav-item,
#admin-manage-item {
    display: none;
}

/* Styles des boutons d'action petits */
.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    margin: 0 2px;
    min-width: auto;
}

.btn-info {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

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