:root {
    --bg-main: #f4f7f9;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #d1dce3;
    --text-primary: #1c2b36;
    --text-secondary: #5a6b78;
    --primary-color: #0077c2; /* A nice blue */
    --primary-color-hover: #005a9e;
    --accent-color: #e53935; /* Red for urgent items */
    --highlight-bg: rgba(255, 229, 100, 0.5);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --shadow: 0 4px 12px rgba(0, 77, 128, 0.08);
}

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

html, body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    max-width: 960px; /* Or 1100px if you prefer wider */
    margin: 0 auto;
    padding: 1rem;
}

/* --- Loading Screen --- */
.loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-main);
    display: flex; justify-content: center; align-items: center; z-index: 999;
}
.loading-content { text-align: center; color: var(--text-secondary); }
.loading-content p { margin-top: 1rem; font-size: 1rem; }
.logo-spinner { fill: var(--primary-color); }
progress {
    -webkit-appearance: none; appearance: none;
    width: 150px; height: 6px; border: none; background-color: #e0e0e0;
    border-radius: 3px; overflow: hidden; margin-top: 1rem;
}
progress::-webkit-progress-bar { background-color: #e0e0e0; }
progress::-webkit-progress-value { background-color: var(--primary-color); }
progress::-moz-progress-bar { background-color: var(--primary-color); }

/* --- Home View --- */
.home-header { text-align: center; margin-bottom: 2rem; }
.home-header .logo { width: auto; height: 60px; margin-bottom: 1rem; }
.home-header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.home-header p { color: var(--text-secondary); }

.search-container { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.search-container input[type="search"] {
    flex-grow: 1; border: 1px solid var(--border-color);
    background-color: var(--bg-input); color: var(--text-primary);
    padding: 0.8rem; border-radius: 8px; font-size: 1rem;
    outline: none; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.search-container input[type="search"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}
.search-container button {
    background-color: var(--primary-color); color: white;
    border: none; border-radius: 8px;
    font-weight: bold; cursor: pointer; transition: background-color 0.2s;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}
.search-container button:hover { background-color: var(--primary-color-hover); }

.navigation-grid h2 {
    color: var(--text-secondary); font-size: 1rem; margin-bottom: 1rem;
    text-transform: uppercase; letter-spacing: 1px;
}
.nav-card {
    display: block; background-color: var(--bg-card);
    padding: 1.5rem; border-radius: 12px; margin-bottom: 1rem;
    text-decoration: none; color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.nav-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0, 77, 128, 0.12); }
.nav-card h3 { margin-bottom: 0.5rem; font-size: 1.2rem; }
.nav-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* --- Search / Section View --- */
.view-header { display: flex; align-items: center; margin-bottom: 1.5rem; position: relative; }
.view-header h2 { flex-grow: 1; text-align: center; font-size: 1.2rem; padding: 0 4rem; margin-top: 2rem }
.back-button {
    background: none; border: none; color: var(--primary-color);
    font-size: 1rem; font-weight: bold; cursor: pointer; padding: 0.5rem;
    position: absolute; left: -0.5rem;
    top: -0.5rem;
}
.sticky-search {
    position: sticky; top: 0; background-color: var(--bg-main);
    padding: 1rem 0; z-index: 10;
}
.info-message { text-align: center; color: var(--text-secondary); padding: 2rem; }

.result-item {
    display: flex; align-items: center; justify-content: space-between;
    background-color: var(--bg-card); padding: 1rem; border-radius: 8px;
    margin-bottom: 0.75rem; text-decoration: none; color: var(--text-primary);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border-color); transition: border-color 0.2s;
}
.result-item:hover { border-left-color: var(--primary-color); }

.result-header { font-weight: bold; color: var(--primary-color); }
.result-snippet { color: var(--text-primary); line-height: 1.5; flex-grow: 1; }
.result-snippet b {
    color: #000; background-color: var(--highlight-bg);
    font-weight: bold; padding: 0 2px; border-radius: 2px;
}
.result-snippet .toc-item { font-size: 1rem; }
.test-tag {
    font-size: 0.75rem; font-weight: bold;
    padding: 0.2rem 0.6rem; border-radius: 12px;
    margin-left: 1rem; white-space: nowrap;
}
.tag-urgent { background-color: #ffebee; color: var(--accent-color); }
.tag-subcontracted { background-color: #f3e5f5; color: #8e24aa; }

/* --- Viewer --- */
.viewer-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    overflow: hidden;
}

.viewer-back-button {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 120;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-color);
    padding: 0.6rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#zoom-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: #e9eef1;
    transform-origin: 0 0;
}


#pages-container {
    margin: 0 auto;
    max-width: 800px;
}

/* This is the only style the image needs now */
.lazy-image {
    display: block;
    width: 100%;
    /* height is now automatically handled by the browser via aspect-ratio */
    background-color: #e0e7ee; /* A slightly different placeholder color */
    margin-bottom: 10px;
}
.app-footer {
    text-align: center;
    padding: 2rem 1rem 1rem 1rem; /* More padding on top */
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
}
/* --- Login Screen --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    background-color: var(--bg-card);
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-box .logo {
    width: auto;
    height: 50px;
    margin-bottom: 1rem;
}

.login-box h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-box form input {
    width: 100%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main); /* Slightly different bg for input */
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-box form input.input-error {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2);
}

.login-box form button {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 1rem;
}

.login-box form button:hover {
    background-color: var(--primary-color-hover);
}

.error-message {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.share-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.qr-code-section,
.link-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.qr-code-section h3,
.link-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.qr-code-wrapper {
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.qr-code-image {
    max-width: 250px;
    width: 100%;
    height: auto;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.qr-description {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.link-copy-wrapper {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.link-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    background: var(--bg-main);
    color: var(--text-primary);
}

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

.copy-button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.copy-button:hover {
    background: var(--primary-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 194, 0.3);
}

.copy-button:active {
    transform: translateY(0);
}

.copy-button.copied {
    background: #28a745;
}

.success-message {
    margin-top: 1rem;
    color: #28a745;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ===== PWA Installation View Styles ===== */
.pwa-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.pwa-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.pwa-section.pwa-success {
    background: #f0f9f4;
    border: 2px solid #28a745;
}

.pwa-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.pwa-section h3 {
    margin: 1rem 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.pwa-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.install-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.install-button:hover {
    background: var(--primary-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 194, 0.3);
}

.install-button:active {
    transform: translateY(0);
}

.install-steps {
    text-align: left;
    margin: 1.5rem auto;
    max-width: 400px;
    padding-left: 1.5rem;
}

.install-steps li {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.install-steps strong {
    color: var(--primary-color);
}

.step-icon {
    display: inline-block;
    margin-left: 0.5rem;
    color: var(--primary-color);
    vertical-align: middle;
}

.inline-link {
    display: block;
    background: var(--bg-main);
    padding: 0.75rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 0.5rem 0 1rem 0;
    border: 1px solid var(--border-color);
}

.copy-button-secondary {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-button-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .link-copy-wrapper {
        flex-direction: column;
    }
    
    .link-input {
        min-width: 100%;
    }
    
    .copy-button {
        width: 100%;
    }
    
    .qr-code-image {
        max-width: 200px;
    }
}
/* Add to the end of your style.css */
.nav-card-success {
    background: linear-gradient(135deg, #f0f9f4 0%, #ffffff 100%);
    border-left: 4px solid #28a745;
}

.nav-card-success h3 {
    color: #28a745;
}
/* ===== Équipe Réalisatrice View Styles ===== */
.equipe-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.equipe-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.section-title {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

/* Coordinator and Developer Cards */
.person-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-main);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.person-card.coordinator {
    border-left-color: #8e24aa;
    background: linear-gradient(135deg, #f3e5f5 0%, #fafafa 100%);
}

.person-card.developer {
    border-left-color: #0077c2;
    background: linear-gradient(135deg, #e3f2fd 0%, #fafafa 100%);
}

.person-icon {
    font-size: 3rem;
    line-height: 1;
}

.person-info {
    flex: 1;
}

.person-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.person-role {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Authors Grid */
.authors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.author-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.author-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.author-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.author-card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* License Section */
.license-section {
    background: linear-gradient(135deg, #fff8e1 0%, #ffffff 100%);
    border: 2px solid #ffd54f;
}

.license-card p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.license-card strong {
    color: var(--primary-color);
}

.license-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #24292e;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.github-link:hover {
    background: #2c3338;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 41, 46, 0.3);
}

.github-link svg {
    flex-shrink: 0;
}

/* Copyright Section */
.copyright-section {
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border-top: 3px solid var(--primary-color);
}

.copyright-card {
    text-align: center;
}

.copyright-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.copyright-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .equipe-section {
        padding: 1.5rem 1rem;
    }
    
    .authors-grid {
        grid-template-columns: 1fr;
    }
    
    .person-card {
        flex-direction: column;
        text-align: center;
    }
    
    .person-icon {
        font-size: 2.5rem;
    }
    
    .github-link {
        width: 100%;
        justify-content: center;
    }
}
