:root {
    /* Couleurs principales */
    --color-bg: #000;
    --color-surface: #111;
    --color-surface-2: #161616;
    --color-surface-3: rgba(255, 255, 255, 0.04);
    --color-surface-hover: rgba(255, 255, 255, 0.08);

    /* Couleurs de texte */
    --color-text: #f5f5f7;
    --color-text-secondary: rgba(255, 255, 255, 0.65);
    --color-text-tertiary: rgba(255, 255, 255, 0.45);
    --color-text-muted: rgba(255, 255, 255, 0.25);

    /* Couleurs d'accent */
    --color-blue: #2997ff;
    --color-blue-hover: #0077ed;
    --color-blue-bg: rgba(41, 151, 255, 0.14);
    --color-blue-bg-hover: rgba(41, 151, 255, 0.24);
    --color-blue-border: rgba(41, 151, 255, 0.22);
    --color-blue-text: #8ccfff;

    --color-red: #ff5e7a;
    --color-red-bg: rgba(255, 94, 122, 0.14);
    --color-red-bg-hover: rgba(255, 94, 122, 0.24);
    --color-red-border: rgba(255, 94, 122, 0.22);
    --color-red-text: #ffb3c5;

    /* Bordures */
    --color-border: rgba(255, 255, 255, 0.10);
    --color-border-strong: rgba(255, 255, 255, 0.14);
    --color-border-light: rgba(255, 255, 255, 0.06);

    /* Typographie */
    --font-family: -apple-system, "SF Pro Display", "Helvetica Neue", sans-serif;

    /* Espacements */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 22px;
    --space-2xl: 30px;
    --space-3xl: 36px;

    /* Rayons */
    --radius-sm: 12px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 28px;
    --radius-full: 999px;

    /* Navbar */
    --nav-height: 48px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Overlay */
    --overlay-bg: rgba(0, 0, 0, 0.72);
}

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

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-border-light);
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 28px;
}

nav ul li a {
    text-decoration: none;
    font-size: 13px;
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

nav ul li a:hover {
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-user-hidden {
    display: none !important;
}

.nav-pfp {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

#nav-email {
    font-size: 13px;
    color: var(--color-text-secondary);
}


button, .btn, input[type="submit"], input[type="button"] {
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 22px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: var(--color-surface-hover);
    color: white;
    font-size: 15px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}


.btn-like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-blue-border);
    background: var(--color-blue-bg);
    color: var(--color-blue-text);
    font-size: 14px;
}

.btn-like:hover {
    background: var(--color-blue-bg-hover);
    transform: translateY(-1px);
}

.btn-dislike {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-red-border);
    background: var(--color-red-bg);
    color: var(--color-red-text);
    font-size: 14px;
}

.btn-dislike:hover {
    background: var(--color-red-bg-hover);
    transform: translateY(-1px);
}

.btn-comment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-hover);
    color: white;
    font-size: 14px;
}

.btn-comment:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-light);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text-tertiary);
    font-size: 14px;
}

.btn-delete:hover {
    background: var(--color-surface-hover);
    color: white;
}

.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-surface-hover);
    color: white;
    font-size: 13px;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.reaction-pill.reaction-like {
    background: var(--color-blue-bg);
    border-color: var(--color-blue-border);
}

.reaction-pill.reaction-dislike {
    background: var(--color-red-bg);
    border-color: var(--color-red-border);
}

.reaction-pill span {
    font-weight: 700;
    color: white;
}


.hero {
    position: relative;
    overflow: hidden;
    padding: 130px 20px 90px;
    text-align: center;
    background: radial-gradient(ellipse at top, #1a1a2e 0%, #000 60%);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 40% at top, rgba(99, 99, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero-eyebrow {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-blue);
    margin-bottom: var(--space-sm);
}

.hero h1 {
    font-size: clamp(48px, 8vw, 88px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.05em;
    margin-bottom: 20px;
    background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0.65) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.section {
    width: 100%;
    padding: 90px 20px 120px;
}

.section-title {
    text-align: center;
    font-size: clamp(32px, 5vw, 54px);
    letter-spacing: -0.05em;
    margin-bottom: 10px;
}

.section-sub {
    text-align: center;
    font-size: 18px;
    color: var(--color-text-tertiary);
    margin-bottom: 70px;
}

.filter-bar {
    width: min(900px, 95%);
    padding: 20px 24px;
    margin-bottom: 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
}

.filter-bar h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text-tertiary);
}

.filter-bar label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.filter-bar select {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 15px;
    font-family: var(--font-family);
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-normal);
}

.filter-bar select:focus {
    border-color: rgba(41, 151, 255, 0.55);
}

.filter-bar select option {
    background: var(--color-surface-2);
    color: white;
}

#postContainer,
#post {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.show-post {
    width: min(900px, 95%);
    padding: var(--space-2xl);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transition: all var(--transition-slow);
}

.show-post:hover {
    transform: translateY(-4px);
    border-color: var(--color-border-strong);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.show-post h2 {
    font-size: 30px;
    letter-spacing: -0.04em;
    margin-bottom: var(--space-md);
}

.show-post > p {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text-tertiary);
    white-space: pre-wrap;
}

.show-post img {
    width: calc(100% + 60px);
    max-height: 500px;
    object-fit: cover;
    display: block;
    margin: -30px -30px 24px;
    background: #1a1a1a;
}

.post-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.reaction-bar {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin: 18px 0 var(--space-md);
}

.comments {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--color-border);
}

.comment {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "author  action"
        "content action"
        "reactions action";
    align-items: start;
    column-gap: 14px;
    row-gap: var(--space-xs);
    padding: var(--space-lg) var(--space-lg);
    border-radius: var(--radius-lg);
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    transition: all var(--transition-normal);
}

.comment:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
}

.comment strong {
    grid-area: author;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.comment > p {
    grid-area: content;
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-text-secondary);
    margin: 2px 0 6px;
}

.comment .comment-reactions {
    grid-area: reactions;
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin: 0;
}

.comment form {
    grid-area: action;
    margin: 0;
    display: flex;
    align-items: center;
}

.comment button {
    padding: 8px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-surface-hover);
    color: var(--color-text-tertiary);
    font-size: 13px;
    white-space: nowrap;
    transition: all var(--transition-normal);
}

.comment button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.comment .reaction-pill {
    padding: 6px 12px;
    font-size: 13px;
}

#postForm,
#commenteForm,
#editCommenteForm,
#editPostForm {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#postForm label,
#commenteForm label,
#editCommenteForm label,
#editPostForm label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

#postForm input[type="text"],
#postForm textarea,
#postForm select,
#editPostForm input[type="text"],
#editPostForm textarea,
#editPostForm select,
#commenteForm textarea,
#editCommenteForm textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 15px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color var(--transition-normal), background var(--transition-normal);
}

#postForm textarea,
#commenteForm textarea,
#editCommenteForm textarea,
#editPostForm textarea {
    resize: vertical;
}

#postForm input[type="file"],
#editPostForm input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-tertiary);
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    outline: none;
}

#postForm select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#postForm select option {
    background: var(--color-surface-2);
    color: white;
}

#postForm input:focus,
#postForm textarea:focus,
#postForm select:focus,
#editPostForm input:focus,
#editPostForm textarea:focus,
#editPostForm select:focus,
#commenteForm textarea:focus,
#editCommenteForm textarea:focus {
    border-color: rgba(41, 151, 255, 0.55);
    background: rgba(255, 255, 255, 0.07);
}

#postForm input::placeholder,
#postForm textarea::placeholder,
#editPostForm input::placeholder,
#editPostForm textarea::placeholder,
#commenteForm textarea::placeholder,
#editCommenteForm textarea::placeholder {
    color: rgba(255, 255, 255, 0.24);
}

.posts,
.create-commente-pop,
#edit-post-pop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.posts.visible,
.create-commente-pop.visible,
#edit-post-pop.visible {
    display: flex;
}

.popup-content,
#commente-pop-up {
    width: min(520px, 92%);
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    padding: var(--space-3xl);
    border-radius: var(--radius-2xl);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    animation: modalFade 0.2s ease;
}

@keyframes modalFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-content h2,
#commente-pop-up h2 {
    font-size: 28px;
    letter-spacing: -0.04em;
    margin-bottom: 28px;
}

.popup-content > button,
#commente-pop-up > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 205px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: var(--color-surface-hover);
    color: white;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.popup-content button:hover,
#commente-pop-up button:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

/* Bouton Publish dans les popups (bleu) */
.popup-content button[type="submit"],
#commente-pop-up button[type="submit"] {
    background: var(--color-blue);
    border: none;
    padding: 12px 22px;
    margin : 5px;
    color: white;
    border-radius: var(--radius-full);
}

.popup-content button[type="submit"]:hover,
#commente-pop-up button[type="submit"]:hover {
    background: var(--color-blue-hover);
}

.empty-posts {
    padding: 80px 20px;
    text-align: center;
    font-size: 18px;
    color: var(--color-text-muted);
}

@media (max-width: 768px) {
    .hero {
        padding-top: 100px;
    }

    .show-post {
        padding: var(--space-xl);
    }

    .show-post h2 {
        font-size: 24px;
    }

    .popup-content,
    #commente-pop-up {
        padding: var(--space-xl);
    }

    .popup-content h2,
    #commente-pop-up h2 {
        font-size: 22px;
    }
}

.comments {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.comment {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "author  action"
        "content action"
        "reactions action";
    align-items: start;
    column-gap: 14px;
    row-gap: 4px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.comment:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
}

.comment strong {
    grid-area: author;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.comment p {
    grid-area: content;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.72);
    margin: 2px 0 6px;
}

.comment .comment-reactions {
    grid-area: reactions;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
}

.comment form {
    grid-area: action;
    margin: 0;
    display: flex;
    align-items: center;
}

.comment button {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.55);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.comment button:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    transform: none;
}

.comment .reaction-pill {
    padding: 6px 12px;
    font-size: 13px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-family);
    color: white;
    min-width: 280px;
    max-width: 420px;
    animation: toastSlide 0.3s ease, toastFade 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast:hover {
    opacity: 0.85;
    transform: translateX(-4px);
}

.toast-success {
    background: rgba(52, 199, 89, 0.9);
    border: 1px solid rgba(52, 199, 89, 0.5);
}

.toast-error {
    background: rgba(255, 94, 122, 0.9);
    border: 1px solid rgba(255, 94, 122, 0.5);
}

.toast-info {
    background: rgba(41, 151, 255, 0.9);
    border: 1px solid rgba(41, 151, 255, 0.5);
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* error page specific */
.error-hero {
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.error-hero h1 {
    font-size: clamp(80px, 15vw, 150px);
    margin-bottom: 0;
}

.reaction-pill.reaction-like.active {
    background: rgba(34, 94, 197, 0.36);
    border-color: rgba(59, 106, 190, 0.65);
    color: rgb(71, 140, 252);
}

.reaction-pill.reaction-dislike.active {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #ef4444;
}