/*
Theme Name: Minimal Flipbook
Theme URI: https://example.com
Author: Site Personnalisé
Description: Thème minimal WordPress pour affichage de flipbooks PDF avec musique.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: minimal-flipbook
*/

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

html, body {
    height: 100%;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 16px;
    color: #222;
    background: #f4f4f0;
}

a { color: #444; text-decoration: none; }
a:hover { color: #000; text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ========================
   HEADER
   ======================== */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 2rem;
}

.site-header-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-title {
    font-size: 1.1rem;
    font-weight: normal;
    letter-spacing: 0.08em;
    white-space: nowrap;
    margin-right: 2rem;
}

.site-title a { color: #222; }

/* ========================
   NAVIGATION
   ======================== */
.nav-primary { position: relative; }

.nav-primary ul {
    list-style: none;
    display: flex;
    gap: 0;
}

.nav-primary > ul > li {
    position: relative;
}

.nav-primary > ul > li > a {
    display: block;
    padding: 0 1.1rem;
    height: 56px;
    line-height: 56px;
    color: #333;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background 0.15s;
}

.nav-primary > ul > li:hover > a,
.nav-primary > ul > li > a:focus {
    background: #f8f8f6;
    color: #000;
    text-decoration: none;
}

/* Dropdown L1 */
.nav-primary ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: 2px solid #444;
    min-width: 200px;
    z-index: 500;
    box-shadow: 2px 4px 16px rgba(0,0,0,0.12);
}

.nav-primary ul li:hover > ul,
.nav-primary ul li:focus-within > ul {
    display: block;
}

.nav-primary ul ul li { position: relative; }

.nav-primary ul ul a {
    display: block;
    padding: 0.55rem 1.2rem;
    color: #444;
    font-size: 0.85rem;
    white-space: nowrap;
    border-bottom: 1px solid #f2f2f0;
    transition: background 0.12s;
}

.nav-primary ul ul a:hover {
    background: #f5f5f0;
    color: #000;
    text-decoration: none;
}

/* Dropdown L2 */
.nav-primary ul ul ul {
    top: 0;
    left: 100%;
    border-top: 1px solid #ddd;
}

/* ========================
   FOOTER
   ======================== */
.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.78rem;
    color: #999;
    border-top: 1px solid #e8e8e8;
    background: #fff;
}

/* ========================
   CONTENT GLOBAL
   ======================== */
.site-content { min-height: calc(100vh - 120px); }

/* ========================
   HOMEPAGE
   ======================== */
.home-gallery {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    padding: 3rem 2rem;
    min-height: calc(100vh - 120px);
    flex-wrap: wrap;
}

.home-gallery-item {
    flex: 0 1 auto;
    max-width: calc((100vw - 120px) / 3);
}

.home-gallery-image {
    display: block;
    max-height: calc(100vh - 180px);
    max-width: 100%;
    width: auto;
    height: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.home-gallery-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 36px rgba(0,0,0,0.24);
}

/* ========================
   INDEX PAGES (parent pages)
   ======================== */
.page-index-wrap {
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.page-index-title {
    font-size: 2rem;
    font-weight: normal;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.8rem;
    margin-bottom: 2rem;
    color: #333;
}

.page-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
}

.page-index-card {
    display: block;
    padding: 1.2rem 1.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #333;
    font-size: 0.95rem;
    text-align: center;
    border-radius: 2px;
    transition: background 0.2s, box-shadow 0.2s;
}

.page-index-card:hover {
    background: #f5f5f0;
    color: #000;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* ========================
   FLIPBOOK LAYOUT
   ======================== */
.flipbook-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    background: #2a2a2a;
    overflow: hidden;
}

.flipbook-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: #1a1a1a;
    color: #bbb;
    min-height: 42px;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.flipbook-doc-title {
    font-style: italic;
    color: #ddd;
    font-size: 0.92rem;
}

.flipbook-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 12px 70px;
}

.flipbook-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
}

#flipbook-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    background: #fff;
    box-shadow: 0 0 50px rgba(0,0,0,0.6);
    transition: opacity 0.25s ease;
}

#flipbook-canvas.fading { opacity: 0; }

/* Nav arrows */
.flipbook-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    width: 54px;
    height: 90px;
    cursor: pointer;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
    border-radius: 2px;
    user-select: none;
}

.flipbook-arrow:hover:not(:disabled) { background: rgba(255,255,255,0.25); }
.flipbook-arrow:disabled { opacity: 0.25; cursor: default; }
.flipbook-arrow.prev { left: 8px; }
.flipbook-arrow.next { right: 8px; }

/* Bottom bar */
.flipbook-bottombar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    background: #161616;
    color: #888;
    min-height: 42px;
    font-size: 0.82rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.flipbook-page-info { color: #bbb; }

.flipbook-batch-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-btn {
    background: #2e2e2e;
    border: 1px solid #444;
    color: #aaa;
    padding: 0.2rem 0.7rem;
    cursor: pointer;
    font-size: 0.78rem;
    border-radius: 2px;
    transition: background 0.15s;
}

.batch-btn:hover:not(:disabled) { background: #444; color: #fff; }
.batch-btn:disabled { opacity: 0.35; cursor: default; }
.batch-info { color: #666; font-size: 0.78rem; }

/* Audio bar */
.flipbook-audiobar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.3rem 1.5rem;
    background: #0f0f0f;
    flex-shrink: 0;
}

.flipbook-audiobar audio {
    width: 100%;
    height: 28px;
    accent-color: #888;
}

.audio-label {
    color: #666;
    font-size: 0.75rem;
    white-space: nowrap;
    font-style: italic;
    min-width: 80px;
}

/* Loading overlay */
.flipbook-loading {
    position: absolute;
    inset: 0;
    background: rgba(42,42,42,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 0.9rem;
    z-index: 50;
}

.loading-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid #444;
    border-top-color: #aaa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 900px) {
    .site-header-inner { flex-wrap: wrap; height: auto; padding: 0.5rem 0; }
    .site-title { margin-right: 0; padding: 0.3rem 0; }
    .nav-primary > ul { flex-wrap: wrap; }
    .nav-primary > ul > li > a { height: auto; line-height: 2.2; padding: 0 0.8rem; }

    .home-gallery-item { max-width: 85vw; }
    .home-gallery { flex-direction: column; padding: 2rem 1rem; }

    .flipbook-wrapper { height: calc(100vh - 90px); }
    .flipbook-main { padding: 8px 50px; }
    .flipbook-arrow { width: 40px; height: 70px; font-size: 1.2rem; }
}

@media (max-width: 600px) {
    .flipbook-main { padding: 6px 40px; }
    .flipbook-arrow { width: 32px; height: 56px; font-size: 1rem; }
}
