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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', Arial, sans-serif;
    background-image: url('/img/BANDEAU.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    overflow-x: hidden;
}

#logoFO {
    position: fixed;
    top: 14px;
    right: 14px;
    width: 12%;
    height: auto;
    z-index: 150;
}

.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 15.625%;
    height: 100vh;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    overflow: hidden;
    background-image: url('/img/MENU.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.sidebar.hidden { transform: translateX(-15.625vw); }

.sidebar-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

.sidebar-content {
    position: relative;
    z-index: 2;
    padding: 12px;
    color: white;
    margin-top: 35vh;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1a1a2e;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    padding: 12px 16px;
    transition: background 0.2s, box-shadow 0.2s;
    letter-spacing: 0.3px;
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-nav-link svg { flex-shrink: 0; width: 20px; height: 20px; }
.sidebar-nav-link:hover { background: rgba(255,255,255,0.92); box-shadow: 0 4px 14px rgba(0,0,0,0.2); }
.sidebar-nav-link.active { background: rgba(255,255,255,0.9); font-weight: 700; }

.sidebar-content nav a:first-child { border-radius: 8px 8px 0 0; }
.sidebar-content nav a:last-child  { border-radius: 0 0 8px 8px; }

.menu-toggle {
    position: fixed;
    top: 14px; left: 14px;
    z-index: 150;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255,255,255,0.35);
    width: 40px; height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px; line-height: 1;
    transition: left 0.3s cubic-bezier(.4,0,.2,1), background 0.2s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    display: flex; align-items: center; justify-content: center;
}
.menu-toggle:hover { background: rgba(255,255,255,0.28); }
.menu-toggle.menu-hidden  { left: 14px; }
.menu-toggle.menu-visible { left: calc(15.625% + 14px); }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}
.sidebar-backdrop.visible { display: block; }

.main-content {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: padding-left 0.3s cubic-bezier(.4,0,.2,1);
}

.pdf-viewer-card {
    width: 100%;
    max-width: 860px;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
    overflow: clip;
}

.pdf-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.07);
    flex-wrap: wrap;
    gap: 12px;
}

.pdf-meta { display: flex; align-items: center; gap: 14px; }

.pdf-badge {
    background: rgba(255,255,255,0.92);
    color: #1a1a2e;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 5px 10px;
    border-radius: 6px;
}

.pdf-title { color: #fff; font-size: 15px; font-weight: 600; }
.pdf-info  { color: rgba(255,255,255,0.45); font-size: 11.5px; margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.pdf-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
}

.btn-nav {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.22);
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.btn-nav:hover { background: rgba(255,255,255,0.22); }
.btn-nav:disabled { opacity: 0.3; cursor: default; }

.btn-download {
    display: flex; align-items: center; gap: 7px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
    font-family: inherit; font-size: 13px; font-weight: 600;
    padding: 9px 18px; border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    backdrop-filter: blur(6px);
}
.btn-download:hover { background: rgba(255,255,255,0.22); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }

.pdf-canvas-wrapper {
    flex: 1;
    min-height: 0;
    background: rgba(0,0,0,0.25);
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 16px 20px;
}

.pdf-page-container {
    display: block;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}
.pdf-page-container:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.6); }

canvas.pdf-page {
    display: block;
    width: 100%;
    height: auto;
}

#pageContainer { display: none; }

.pdf-loading {
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; color: rgba(255,255,255,0.6); padding: 60px 0;
}

.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.pdf-loading p { font-size: 13px; }

.pdf-error {
    display: none; flex-direction: column; align-items: center;
    gap: 16px; color: rgba(255,255,255,0.55);
    padding: 60px 40px; text-align: center;
}
.pdf-error p { font-size: 14px; line-height: 1.6; }
.pdf-error a {
    color: #fff; font-weight: 600;
    background: rgba(255,255,255,0.12);
    padding: 10px 24px; border-radius: 8px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.28);
    transition: background 0.2s; font-size: 14px;
}
.pdf-error a:hover { background: rgba(255,255,255,0.22); }

.pdf-footer {
    display: flex; align-items: center; justify-content: center;
    gap: 16px;
    padding: 14px 22px;
    border-top: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.6);
    font-size: 13px;
}

.pdf-page-count { min-width: 90px; text-align: center; }

@media (max-width: 900px) {
    .sidebar { width: 28%; }
    .sidebar.hidden { transform: translateX(-28vw); }
    .menu-toggle.menu-visible { left: calc(28% + 14px); }
}

@media (max-width: 600px) {
    body { background-attachment: scroll; }

    .sidebar { width: 85vw; max-width: 320px; }
    .sidebar.hidden { transform: translateX(-85vw); }
    .sidebar-content { margin-top: 52vh; padding: 1.5vw; }

    .menu-toggle { top: 12px; left: 3vw; width: 44px; height: 44px; font-size: 20px; }
    .menu-toggle.menu-hidden  { left: 3vw; }
    .menu-toggle.menu-visible { left: calc(85vw + 2vw); }

    .main-content { padding: 10px; }

    .pdf-viewer-card { height: calc(100vh - 20px); }

    .pdf-viewer-header { padding: 12px 14px; }
    .pdf-title { font-size: 13px; }
    .pdf-info { display: none; }
    .btn-download span { display: none; }
    .btn-download { padding: 9px 12px; }

    .pdf-canvas-wrapper { padding: 10px 8px; }

    .sidebar-nav-link { font-size: 17px; padding: 1.8vh 3vw; }
}

@media (max-width: 360px) {
    .sidebar-nav-link { font-size: 15px; padding: 1.5vh 2.5vw; }
}
