/* ===================================
   Variables CSS
   =================================== */
:root {
    --color-primary: #1e40af;
    --color-primary-dark: #1e3a8a;
    --color-primary-light: #3b82f6;
    --color-dark: #222;
    --color-white: #ffffff;
    --color-gray: #f5f5f5;
    --color-text: #333;
    --color-text-light: #666;
    --font-primary: 'Poppins', sans-serif;
    --transition: all 0.3s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.15);
}

/* ===================================
   Base Styles
   =================================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    color: var(--color-text);
    line-height: 1.6;
    padding-top: 76px;
}

/* Override Bootstrap primary color */
:root {
    --bs-primary: #1e40af;
    --bs-primary-rgb: 30, 64, 175;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: #1e3a8a;
    border-color: #1e3a8a;
}

/* ===================================
   Navigation
   =================================== */
.navbar {
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.navbar-brand {
    font-weight: 700;
    color: var(--color-dark) !important;
}

.navbar-nav .nav-link {
    color: var(--color-text) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    position: relative;
    transition: var(--transition);
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: var(--transition);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 80%;
}

.navbar-nav .nav-link:hover {
    color: var(--color-primary) !important;
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    filter: grayscale(20%) brightness(0.7);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(34, 34, 34, 0.8) 0%, rgba(34, 34, 34, 0.6) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: 1rem;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 2rem;
    color: var(--color-white);
    margin-bottom: 1rem;
    font-weight: 400;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ===================================
   Section Styles
   =================================== */
section {
    padding: 80px 0;
}

.bg-light {
    background-color: var(--color-gray) !important;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-dark);
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: var(--color-primary);
}

/* ===================================
   About Section
   =================================== */
.about-image {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    padding: 20px;
    background: linear-gradient(135deg, var(--color-gray) 0%, var(--color-white) 100%);
}

.about-image img {
    border-radius: 10px;
    transition: var(--transition);
}

.about-image:hover img {
    transform: scale(1.03);
}

.about-text p {
    color: var(--color-text-light);
    line-height: 1.8;
}

/* ===================================
   Education Section (Formations)
   =================================== */
.education-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
}

.card {
    transition: var(--transition);
    border: none !important;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover) !important;
}

/* ===================================
   Experience Section (Expériences)
   =================================== */
.timeline-item {
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 60px;
    bottom: -20px;
    width: 2px;
    background: var(--color-primary);
    opacity: 0.3;
}

.timeline-item:last-child::before {
    display: none;
}

/* ===================================
   Skills Section
   =================================== */
.skill-card-simple {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    border: 2px solid transparent;
    height: 100%;
}

.skill-card-simple:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--color-primary);
}

.skill-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    margin-bottom: 1.5rem;
    min-height: 120px;
}

.skill-logo img {
    object-fit: contain;
    transition: var(--transition);
    max-height: 100px;
    width: auto;
    max-width: 100%;
}

.skill-logo-img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.skill-card-simple:hover .skill-logo img {
    transform: scale(1.1);
}

.skill-card-simple h4 {
    color: var(--color-dark);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.skill-card-simple p {
    color: var(--color-text-light);
    font-size: 1rem;
    margin-bottom: 0;
}

.skill-logo-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
}

/* ===================================
   Projects Section
   =================================== */
.project-card {
    transition: var(--transition);
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

.project-image {
    overflow: hidden;
    height: 250px;
    background-color: var(--color-gray);
    position: relative;
    border-radius: 12px 12px 0 0;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
    display: block;
    border-radius: 0;
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

.project-card a {
    text-decoration: none;
    color: inherit;
}

.project-card a:hover {
    text-decoration: none;
}

.project-detail-image {
    margin-bottom: 2rem;
}

.project-detail-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.project-details-content {
    line-height: 1.8;
}

.project-details-content ul {
    padding-left: 1.5rem;
}

.project-details-content li {
    margin-bottom: 0.5rem;
}

/* Image zoom dans la modal */
.project-image-container {
    position: relative;
}

.project-modal-image {
    transition: transform 0.3s ease;
}

.project-modal-image:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

#zoom-image-btn {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.project-image-container:hover #zoom-image-btn {
    opacity: 1;
}

#imageZoomModal .modal-body {
    background-color: rgba(0, 0, 0, 0.95);
}

#imageZoomModal .modal-content {
    background-color: transparent;
    border: none;
}

#zoomed-image {
    animation: fadeIn 0.3s ease-in;
    width: 100%;
    height: auto;
    max-width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Correction d'affichage pour les modals */
.modal-dialog {
    margin: 1.75rem auto;
}

.modal-fullscreen .modal-body {
    padding: 0;
}

/* Amélioration de l'affichage des projets */
.project-card {
    display: flex;
    flex-direction: column;
}

.project-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-card .card-body.pt-0 {
    padding-top: 0 !important;
}

/* Fix pour les images dans les modals */
.project-modal-image {
    width: 100%;
    height: auto;
    display: block;
}

.project-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-btn {
    transition: var(--transition);
}

.download-btn:hover {
    transform: translateY(-2px);
}

/* ===================================
   Contact Section
   =================================== */
.contact-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-radius: 50%;
    margin: 0 auto;
}

.contact-icon i {
    display: inline-block;
}

/* ===================================
   Footer
   =================================== */
.footer {
    background-color: var(--color-dark) !important;
    color: var(--color-white);
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 1s ease-out;
}

/* Delay animations for staggered effect */
.fade-in:nth-child(1) {
    animation-delay: 0.1s;
}

.fade-in:nth-child(2) {
    animation-delay: 0.3s;
}

.fade-in:nth-child(3) {
    animation-delay: 0.5s;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .about-image {
        margin-bottom: 2rem;
        padding: 15px;
    }

    .timeline-item::before {
        display: none;
    }

    .education-icon,
    .contact-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Skills responsive */
    .skill-logo {
        height: 100px;
        min-height: 100px;
    }

    .skill-logo img {
        max-height: 80px;
    }

    .skill-card-simple {
        margin-bottom: 1rem;
    }

    .skill-card-simple h4 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .hero-bg-image {
        opacity: 0.2;
    }
}

/* Smooth scroll behavior */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Corrections d'affichage générales */
.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* Fix pour l'affichage des images */
img {
    max-width: 100%;
    height: auto;
}

/* Amélioration de l'affichage sur tous les écrans */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Fix pour les cartes Bootstrap */
.card {
    overflow: hidden;
}

/* Correction pour les modals sur mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-fullscreen {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
}

/* ===================================
   Styles pour l'affichage des PDF
   =================================== */
.project-pdf-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#modal-project-pdf {
    width: 100%;
    min-height: 600px;
    border: none;
    background-color: #fff;
}

#pdf-loading {
    z-index: 10;
}

/* Amélioration de l'affichage du PDF sur mobile */
@media (max-width: 768px) {
    .project-pdf-container {
        min-height: 400px;
    }

    #modal-project-pdf {
        min-height: 400px;
    }

    .modal-xl {
        max-width: 95%;
    }
}

/* Style pour la modal de projet */
#projectModal .modal-dialog {
    max-width: 95%;
}

#projectModal .modal-body {
    padding: 1.5rem;
}

/* Animation pour le chargement */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner-border {
    animation: spin 0.75s linear infinite;
}

/* ===================================
   Styles pour PDF.js Viewer
   =================================== */
#pdf-viewer {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 30px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

#pdf-canvas {
    background-color: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.pdf-page-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.pdf-page-container canvas {
    background-color: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    max-width: 100%;
    height: auto;
}

#pdf-controls {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

#pdf-controls .btn-group {
    display: flex;
    align-items: center;
}

#pdf-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cacher les boutons de pagination */
#pdf-prev,
#pdf-next {
    display: none !important;
}

/* Responsive pour le PDF viewer */
@media (max-width: 768px) {
    #pdf-viewer {
        padding: 10px;
    }

    #pdf-canvas {
        margin: 10px 0;
    }

    #pdf-controls {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    #pdf-controls .btn-group {
        width: 100%;
        justify-content: center;
    }
}

/* Optimisation pour l'affichage plein écran */
.modal-fullscreen .project-pdf-container {
    height: 100%;
    min-height: 100%;
}

.modal-fullscreen #pdf-viewer {
    height: 100%;
    min-height: 100%;
    width: 100%;
}

.modal-fullscreen .pdf-page-container canvas {
    max-width: 95%;
    width: auto;
    min-width: 800px;
}

/* Amélioration de la visibilité des pages PDF */
.pdf-page-container canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Scrollbar personnalisée pour le PDF viewer */
#pdf-viewer::-webkit-scrollbar {
    width: 12px;
}

#pdf-viewer::-webkit-scrollbar-track {
    background: #4b5563;
}

#pdf-viewer::-webkit-scrollbar-thumb {
    background: #1e40af;
    border-radius: 6px;
}

#pdf-viewer::-webkit-scrollbar-thumb:hover {
    background: #1e3a8a;
}