/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
    --primary-color: #000000;
    --primary-dark: #1a1a1a;
    --secondary-color: #666666;
    --accent-color: #333333;
    --success-color: #4a4a4a;
    --danger-color: #8b0000;
    --warning-color: #8b6914;
    
    --bg-color: #fafafa;
    --bg-white: #ffffff;
    --bg-gray: #f5f5f5;
    --bg-dark: #000000;
    
    --text-primary: #000000;
    --text-secondary: #555555;
    --text-light: #888888;
    --text-white: #ffffff;
    
    --border-color: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-size-base: 16px;
    --line-height: 1.6;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height);
    color: var(--text-primary);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   LAYOUT
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: linear-gradient(135deg, #000000 0%, #333333 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.profile-photo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    background: #ffffff;
    flex-shrink: 0;
}

.header-text {
    flex: 1;
}

.author-name {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 0.1rem;
    text-transform: uppercase;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.tagline {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ========================================
   CATEGORY NAVIGATION
   ======================================== */
.category-nav {
    background: var(--bg-white);
    padding: 0.75rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.category-nav .container {
    display: flex;
    justify-content: center;
}

.category-dropdown {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.dropdown-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.dropdown-toggle:hover {
    border-color: #000000;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    list-style: none;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-item {
    width: 100%;
    padding: 0.625rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: left;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--bg-gray);
    color: #000000;
}

.dropdown-item.active {
    background: #000000;
    color: white;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
    padding: 1.5rem 0;
    min-height: calc(100vh - 200px);
}

.loading {
    text-align: center;
    padding: 4rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.no-publications {
    text-align: center;
    padding: 4rem 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ========================================
   PUBLICATIONS GRID
   ======================================== */
.publications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

/* Mode carrousel horizontal pour les proverbes en vue "Tout" */
.publications-grid.carousel-mode {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.carousel-section {
    margin-bottom: 3rem;
}

.carousel-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
    border-left: 4px solid #000000;
}

.carousel-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0.5rem 1.5rem 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.carousel-container::-webkit-scrollbar {
    height: 8px;
}

.carousel-container::-webkit-scrollbar-track {
    background: var(--bg-gray);
    border-radius: 4px;
}

.carousel-container::-webkit-scrollbar-thumb {
    background: #000000;
    border-radius: 4px;
}

.carousel-container .publication-card {
    flex: 0 0 400px;
    max-width: 400px;
    scroll-snap-align: start;
}

.publication-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.publication-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Style spécifique pour les citations & proverbes */
.publication-card.citations {
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    border: 1px solid #e0e0e0;
    position: relative;
}

.publication-card.citations::before {
    content: '"';
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    font-size: 4rem;
    color: #000000;
    opacity: 0.1;
    font-family: Georgia, serif;
    line-height: 1;
}

.publication-card.citations .publication-content {
    padding: 2rem;
}

.publication-card.citations .publication-text {
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.8;
    color: #000000;
    font-family: Georgia, serif;
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.publication-card.citations .publication-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.publication-card.citations .publication-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #000000;
}

.publication-card.citations .publication-author-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #000000;
    letter-spacing: 0.5px;
}

.publication-card.citations .publication-category {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

/* Signature pour les pensées */
.publication-card.pensees .publication-author-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.publication-card.pensees .publication-author-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #000000;
}

.publication-card.pensees .publication-author-name-small {
    font-size: 0.85rem;
    font-weight: 600;
    color: #000000;
    letter-spacing: 0.5px;
}

.publication-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-gray);
}

.publication-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.publication-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-gray);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    align-self: flex-start;
}

.publication-category.pensees { background: #f5f5f5; color: #000000; }
.publication-category.citations { background: #e8e8e8; color: #333333; }
.publication-category.livres { background: #dcdcdc; color: #1a1a1a; }
.publication-category.logiques { background: #f0f0f0; color: #444444; }
.publication-category.refutations { background: #e5e5e5; color: #222222; }

.publication-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.publication-date {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.publication-text {
    color: var(--text-secondary);
    line-height: 1.7;
    flex: 1;
    white-space: pre-wrap;
}

.publication-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #000000;
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #000000;
}

.publication-pdf-link:hover {
    background: #ffffff;
    color: #000000;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: #000000;
    color: #ffffff;
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #ffffff;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin: 0.5rem 0;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-section a:hover {
    color: #ffffff;
}

.footer-about-row {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.footer-profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.footer-about-text h4 {
    margin-bottom: 0.5rem;
}

.footer-about-text p {
    margin: 0;
    line-height: 1.5;
}

.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-nav li {
    margin-bottom: 0.75rem;
}

.footer-nav a {
    display: inline-block;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-about-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }
    
    .footer-profile-img {
        width: 60px;
        height: 60px;
        border-width: 2px;
    }
    
    .footer-section h4 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .footer-section p {
        font-size: 0.9rem;
    }
    
    .footer-bottom {
        padding-top: 1.5rem;
        margin-top: 1rem;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
    }
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: #000000;
    color: white;
    border: 1px solid #000000;
}

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

.btn-secondary {
    background: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

.btn-secondary:hover {
    background: #000000;
    color: #ffffff;
    transform: translateY(-2px);
}

.btn-danger {
    background: #8b0000;
    color: white;
    border: 1px solid #8b0000;
}

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

.btn-success {
    background: #333333;
    color: white;
    border: 1px solid #333333;
}

.btn-success:hover {
    background: #444444;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.textarea {
    resize: vertical;
    min-height: 150px;
}

.form-help {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.form-message.success {
    background: #dcfce7;
    color: #059669;
}

.form-message.error {
    background: #fee2e2;
    color: #dc2626;
}

.error-message {
    color: var(--danger-color);
    margin-top: 1rem;
    font-weight: 500;
}

/* ========================================
   LOGIN SECTION
   ======================================== */
.login-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    padding: 1.5rem;
}

.login-container {
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ========================================
   ADMIN SECTION
   ======================================== */
.admin-body {
    background: var(--bg-gray);
}

.admin-header {
    background: #000000;
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-nav {
    background: var(--bg-white);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.admin-nav .container {
    display: flex;
    gap: 1rem;
}

.admin-nav-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.admin-nav-btn:hover {
    border-color: #000000;
    color: #000000;
}

.admin-nav-btn.active {
    background: #000000;
    color: white;
    border-color: #000000;
}

.admin-main {
    padding: 2rem 0;
}

.admin-section-content {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.admin-section-content h2 {
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.publication-form {
    max-width: 700px;
}

.filter-bar {
    margin-bottom: 2rem;
}

.filter-bar .form-input {
    max-width: 300px;
}

.admin-publications-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-publication-item {
    background: var(--bg-gray);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.admin-publication-info {
    flex: 1;
}

.admin-publication-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.admin-publication-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

/* ========================================
   MODAL
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    padding: 1.5rem;
}

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

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 350px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #000000;
}

.modal-body {
    padding: 1.5rem;
}

.modal-description {
    color: #666666;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.modal .form-group {
    margin-bottom: 1rem;
}

.modal .form-group label {
    display: block;
    font-weight: 600;
    color: #000000;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.modal .form-group input {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.modal .form-group input:focus {
    outline: none;
    border-color: #000000;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #333333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .profile-photo {
        width: 100px;
        height: 100px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .publications-grid {
        grid-template-columns: 1fr;
    }
    
    .category-nav .container {
        gap: 0.5rem;
    }
    
    .category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .admin-publication-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-publication-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}
