:root {
    --bg: #160d16;
    --card: rgba(255, 255, 255, .08);
    --text: #f8edf4;
    --muted: #c9aebb;
    --border: rgba(255, 255, 255, .14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Segoe UI Emoji",
        "Apple Color Emoji",
        "Noto Color Emoji",
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(circle at top left, rgba(255, 90, 150, .28), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(130, 70, 255, .20), transparent 32rem),
        var(--bg);
}

a {
    color: #ffd1df;
    text-decoration: none;
}

html {
    scroll-behavior: smooth;
}

.container {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.header>div:last-child {
    gap: 10px !important;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 4px;

    white-space: nowrap;
    color: #d2c6d5;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 4px;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

#my-pages-content {
    padding: 14px 22px;
}

#my-pages-content .muted {
    margin-top: 2px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

input,
textarea,
select,
button {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
}

input,
textarea,
select {
    background: rgba(0, 0, 0, .22);
    color: var(--text);
}

textarea {
    min-height: 180px;
    resize: vertical;
}

button,
.btn {
    display: inline-block;
    width: auto;
    background: #ffd1df;
    color: #30141d;
    font-weight: 800;
    cursor: pointer;
    border: 0;
}

.btn.secondary {
    background: rgba(255, 255, 255, .12);
    color: var(--text);
    border: 1px solid var(--border);
}

.form-row {
    margin-bottom: 14px;
}

.muted {
    color: var(--muted);
}

.entry {
    margin-bottom: 14px;
}

.entry h2 {
    margin: 0 0 6px;
}


.entry-preview {
    max-height: 120px;
    overflow: hidden;
    margin-bottom: 12px;
}

.read-link {
    display: inline-block;
    margin-top: 8px 0 12px;
}

.read-link {
    display: inline-block;
    margin-top: auto;
    padding-top: 10px;
    align-self: flex-start;
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: var(--muted);
    font-size: .85rem;
}

.password-field {
    display: flex;
    gap: 8px;
    align-items: center;
}

.password-field input {
    flex: 1;
}

.password-toggle {
    white-space: nowrap;
    padding: 12px 16px;
}

/* PWA Install Prompt Styles */
.pwa-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    max-width: 360px;
    margin: 10px 0 18px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
}

.pwa-status.installed {
    opacity: 0.75;
}

.pwa-link {
    border: 0;
    background: transparent;
    color: #ff9ac7;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.pwa-link:hover {
    text-decoration: underline;
}

/* Link Styles in Entries and Cards */
.entry a,
.card p a {
    color: #ff9ac7;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 154, 199, 0.65);
}

.entry a:hover,
.card p a:hover {
    color: #ffc3dd;
    border-bottom-style: solid;
}

/* Book Tabs Styles */
.book-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.book-tab {
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, filter .18s ease;
}

.book-tab:hover {
    transform: translateY(-2px);
    filter: brightness(1.12);
    box-shadow: 0 0 14px rgba(255, 255, 255, .18);
}

.book-tab[href*="view=shared"]:hover {
    box-shadow: 0 0 18px rgba(77, 163, 255, .65);
}

.book-tab.active {
    color: #fff !important;
    font-weight: 900;
    transform: none;
    filter: brightness(1.08);
}

.book-page-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 7px 14px;
    border: 1px solid;
    border-radius: 999px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
}

.book-badge {
    opacity: .95;
    font-size: .9rem;
    background: color-mix(in srgb, currentColor 15%, transparent);
    border: 1px solid currentColor;
}

.shared-tab-hint {
    margin-left: 4px;
    font-size: 0.75rem;
    opacity: .78;
    font-weight: 600;
}

/* Entry Photos Styles */
.entry-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.entry-photo-thumb {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .15);
    cursor: pointer;
}

.entry-photo-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Photo Actions Styles */
.photo-delete-btn {
    font-size: 0.85rem;
    padding: 8px 10px;
}

.photo-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Inline Entry Photo Styles */
.inline-entry-photo-link {
    display: inline-block;
    margin: 6px 0;
}

.inline-entry-photo {
    display: block;
    width: 100%;
    max-width: 420px;
    max-height: 280px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .15);
    cursor: zoom-in;
}

.inline-camera-photo {
    display: block;
    width: 100%;
    max-width: 320px;
    max-height: 220px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .15);
    margin: 6px 0;
}

/* Badge Styles for Private and Shared Entries */
.badge.private {
    background: rgba(255, 255, 255, .08);
    color: #d0c7cf;
}

.badge.shared {
    background: rgba(65, 145, 255, .20);
    color: #8bc6ff;
    border: 1px solid rgba(65, 145, 255, .4);
    box-shadow: 0 0 10px rgba(65, 145, 255, .15);
}

/* Actions pages + notifications */
.entry-actions,
.notification-actions {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.entry-actions form,
.notification-actions form,
.notification-read-all {
    margin: 0;
    padding: 0;
}


/* Uniformise les liens et boutons */
.entry-actions .btn,
.entry-actions button.btn,
.notification-actions .btn,
.notification-actions button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: middle;
}

/* Notifications : boutons légèrement plus compacts */
.notification-actions {
    margin-top: 12px;
    gap: 10px;
}

.notification-actions .btn,
.notification-actions button.btn {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 0.9rem;
}

/* Bouton "Tout marquer comme lu" */
.notification-read-all {
    margin: 10px 0 14px;
}

.notification-read-all .btn,
.notification-read-all button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
}

.notification-read-all .btn {
    opacity: .85;
    font-size: .88rem;
}

/* Bouton principal des notifications */
.notification-actions .btn:first-child {
    border-color: rgba(255, 154, 199, .45);
    box-shadow: 0 0 12px rgba(255, 154, 199, .25);
    transition: all .2s ease;
}

.notification-actions .btn:first-child:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(255, 154, 199, .45);
}

.notification-item {
    background: rgba(255, 255, 255, .03);
    border-left: 4px solid #ff6fa8;
    box-shadow: inset 3px 0 12px rgba(255, 111, 168, .18);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    transition: all .2s ease;
}

.notification-item:hover {
    background: rgba(255, 255, 255, .05);
    border-left-color: #ff9ac7;
}

/* Mobile */
@media (max-width: 600px) {

    .entry-actions,
    .notification-actions {
        gap: 10px;
        align-items: center;
    }

    .entry-actions .btn,
    .entry-actions button.btn,
    .notification-actions .btn,
    .notification-actions button.btn,
    .notification-read-all .btn,
    .notification-read-all button.btn {
        width: auto;
        max-width: 100%;
    }
}

/* Bouton écrire une page */
.write-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
    margin-top: 8px;
}

.photo-status-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
    background: rgba(255, 255, 255, .10);
    color: var(--muted);
}

.photo-hidden img {
    opacity: .30;
    filter: grayscale(100%);
}

.photo-hidden .photo-status-badge {
    background: rgba(120, 120, 120, .15);
    color: rgba(255, 255, 255, .62);
}

.btn:disabled {
    opacity: 0.7;
    cursor: default;
}

/* Bouton / badge notifications push */
.push-status-btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: 12px;
    white-space: nowrap;
    opacity: 0.9;
}

.push-status-btn:disabled {
    opacity: 0.75;
    cursor: default;
}

@media (max-width: 600px) {
    .push-status-btn {
        min-height: 30px;
        padding: 5px 9px;
        font-size: 0.8rem;
    }
}

/* ==========================
   Selects (listes déroulantes)
   ========================== */

select option {
    background: #2d2030;
    color: #f8edf4;
}

/* Effet de focus */
select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: #ff9ac7;
    box-shadow: 0 0 10px rgba(255, 154, 199, .35);
}

/* ==========================
   Video Preview
   ========================== */

.video-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
}

.video-preview>div:last-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.video-icon {
    font-size: 32px;
}

.video-preview strong {
    display: block;
    margin-bottom: 4px;
}

.video-preview a {
    color: #ff9acb;
    text-decoration: none;
}

.video-preview a:hover {
    text-decoration: underline;
}

/* Video Token Link Styles */
.video-token-link {
    font-weight: 600;
    text-decoration: none;
}

.video-token-link:hover {
    text-decoration: underline;
}

/* Vidéo et audio avec lien token*/
.compact-preview {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    width: 340px;
    max-width: 100%;
}

.compact-preview .video-icon {
    font-size: 24px;
    width: 32px;
}

.compact-preview strong {
    display: block;
    margin-bottom: 8px;
}

/* Menu du haut */
.btn.secondary {
    transition: all .2s ease;
}

.btn.secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(255, 154, 199, .25);
}

/* ==========================
   Notifications
   ========================== */
.notification-badge {
    background: #ff4f7d;
    color: #fff;

    min-width: 22px;
    height: 22px;
    padding: 0 6px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;

    box-shadow:
        0 0 0 2px rgba(255, 255, 255, .08),
        0 0 12px rgba(255, 79, 125, .45);

    animation: notificationPulse 3s infinite;
}

.notification-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px !important;
}

.notification-icon {
    font-size: 1.15rem;
}

.notification-link .notification-badge {
    position: absolute;
    top: 0;
    right: -4px;
}

@keyframes notificationPulse {

    0% {
        transform: scale(1);
        box-shadow:
            0 0 0 2px rgba(255, 255, 255, .08),
            0 0 10px rgba(255, 79, 125, .45);
    }

    10% {
        transform: scale(1.18);
    }

    20% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
        box-shadow:
            0 0 0 2px rgba(255, 255, 255, .08),
            0 0 10px rgba(255, 79, 125, .45);
    }
}

.entry-read-status {
    display: inline-block;
    margin: 8px 0 12px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .06);
}

.entry-read-status.none {
    color: #b8b8b8;
}

.entry-read-status.partial {
    color: #ffb347;
}

.entry-read-status.full {
    color: #7ee787;
}

.version-alert {
    margin-top: 8px;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 193, 7, .15);
    border: 1px solid rgba(255, 193, 7, .4);
    color: #ffd75e;
    font-size: .9rem;
    font-weight: 600;
}

.pwa-status.update {
    border: 2px solid #ffb300;
    background: rgba(255, 179, 0, .12);
    box-shadow: 0 0 15px rgba(255, 179, 0, .35);
    animation: pulseUpdate 2s infinite;
}

.pwa-status.update a {
    font-weight: bold;
    color: #ffd54f;
}

@keyframes pulseUpdate {
    0% {
        box-shadow: 0 0 8px rgba(255, 179, 0, .25);
    }

    50% {
        box-shadow: 0 0 18px rgba(255, 179, 0, .60);
    }

    100% {
        box-shadow: 0 0 8px rgba(255, 179, 0, .25);
    }
}

.hidden {
    display: none;
}

.orphan-photo-warning {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 60, 60, 0.15);
    border: 1px solid #ff5c5c;
    color: #ff8a8a;
}

.orphan-photo-warning ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.photo-id {
    margin-top: 4px;
    text-align: center;
    font-size: 12px;
    opacity: .8;
}


.lc-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin: 18px 0;
}

.lc-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
}

.lc-table th,
.lc-table td {
    border: 1px solid rgba(255, 255, 255, .12);
    padding: 6px 6px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}

.lc-table th {
    background: #6f4760;
    color: #fff;
    font-weight: 600;
}

.lc-table tr:nth-child(even) {
    background: rgba(255, 255, 255, .03);
}

@media (max-width: 600px) {

    .lc-table th,
    .lc-table td {
        padding: 5px 4px;
        font-size: 12px;
        line-height: 1.25;
    }
}

/* Filtres d'un carnet */
.book-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.book-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    font-size: .90rem;

    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .05);

    transition: .2s;
}

.book-filter:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, .35);
    color: #fff;
}

.book-filter.active {
    color: #fff;
    box-shadow: 0 0 14px rgba(255, 255, 255, .18);
}

.active-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    background: rgba(255, 255, 255, .12);
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(255, 255, 255, .25);

    padding: 4px 12px;
    transition: .2s ease;
}

.active-counter:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 14px rgba(255, 255, 255, .35);
}

.read-summary {
    margin-top: 24px;
    margin-bottom: 8px;
}

.read-summary .muted {
    margin-bottom: 10px;
}

.reaction-comment {
    margin: 2px 0 12px;
    color: #d8c7d3;
    font-style: italic;
    line-height: 1.5;
}

.read-summary .btn {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #cdb7c5;
    font-size: .95rem;
    text-decoration: none;
}

.read-summary .btn:hover {
    text-decoration: underline;
}

/* Présentation*/
.btn-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes updatePulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 120, 220, 0);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 0 14px rgba(255, 120, 220, .6);
    }
}

.btn-update {
    animation: updatePulse 1.8s infinite;
}

/*auto-refresh-indicator*/
.auto-refresh-indicator {
    position: fixed;
    right: 12px;
    bottom: 12px;
    opacity: 0.35;
    font-size: 14px;
    color: #ffd6ec;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 4px 7px;
    z-index: 999;
    pointer-events: none;
}

.auto-refresh-indicator.refreshing {
    opacity: 1;
    color: #7dff9b;
    border-color: rgba(125, 255, 155, 0.7);
    box-shadow: 0 0 10px rgba(125, 255, 155, 0.45);
    animation: refreshBlink 0.35s alternate 3;
}

@keyframes refreshBlink {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.25);
    }
}

/* bade carnet accueil*/
.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
}


.tab-live-dot {
    display: none;
    width: 9px;
    height: 9px;
    margin-left: 6px;
    border-radius: 999px;
    background: #7dff9b;
    box-shadow: 0 0 10px rgba(125, 255, 155, .8);
}

.book-tab.has-live-update .tab-live-dot {
    display: inline-block;
    animation: tabLivePulse 1s infinite alternate;
}

@keyframes tabLivePulse {
    from {
        transform: scale(1);
        opacity: .6;
    }

    to {
        transform: scale(1.35);
        opacity: 1;
    }
}

.tab-live-dot-visible {
    display: inline-block;
    animation: tabLivePulse 1s infinite alternate;
}

.tab-live-dot-green {
    background: #7dff9b;
    box-shadow: 0 0 10px rgba(125, 255, 155, .8);
}

.tab-live-dot-orange {
    background: #ff9800;
    box-shadow: 0 0 10px rgba(255, 152, 0, .8);
}

.error {
    background: #5b1f27;
    border: 1px solid #d9534f;
    color: #ffdede;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
}

.success {
    background: #1f4d2b;
    border: 1px solid #38c172;
    color: #d9ffe6;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Modification Des commentaires Bodges*/
@keyframes read-dot-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 6px rgba(34, 197, 94, .7);
    }

    50% {
        opacity: .85;
        transform: scale(1.08);
        box-shadow: 0 0 10px rgba(34, 197, 94, .95);
    }
}

@keyframes read-dot-pulse {

    0%,
    100% {
        box-shadow:
            0 0 4px rgba(34, 197, 94, .5),
            0 0 8px rgba(34, 197, 94, .4);
    }

    50% {
        box-shadow:
            0 0 8px rgba(34, 197, 94, .9),
            0 0 16px rgba(34, 197, 94, .8);
    }
}
/* Dot indicator for read activity */
.read-activity-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 50%;
    background: #22c55e;
    vertical-align: middle;
    animation: read-dot-pulse 2.5s ease-in-out infinite;
}

.profile-photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin-top: 10px;
    cursor: pointer;
}
/* Header Avatar Styles */
.header-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 10px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.header-avatar:hover {
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(255, 255, 255, .22);
}

/* Avatar Modal Styles */
.avatar-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.avatar-modal.open {
    display: flex;
    cursor: pointer;
}

.avatar-modal img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
/* Header User Styles */
.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.card p a {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.rt-center img,
.entry-content img,
.card img {
    max-width: 100%;
    height: auto;
}