/* ==========================================================================
   DISCORD CLIENT SIMULATOR (DARK THEME) - ELITE PRO EDITION
   Reproduction pixel-perfect du client Discord (Desktop & Mobile)
   ========================================================================== */

:root {
    --discord-bg-primary: #313338;
    --discord-bg-secondary: #2b2d31;
    --discord-bg-tertiary: #1e1f22;
    --discord-channel-top-bar-bg: #313338;
    --discord-text-normal: #dbdee1;
    --discord-text-muted: #949ba4;
    --discord-header-primary: #f2f3f5;
    --discord-blurple: #5865f2;
    --discord-blurple-hover: #4752c4;
    --discord-online-green: #23a55a;
    --discord-row-hover: #2e3035;
    --discord-border-subtle: #1f2023;
    --discord-quote-bar: #4e5058;
}

/* ==========================================================================
   EN-TÊTE / BARRE DE CONTRÔLE DE L'APERÇU (VUE BUREAU VS VUE MOBILE)
   ========================================================================== */

.discord-preview-container-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
}

.discord-preview-top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.discord-view-toggle-pills {
    display: inline-flex;
    align-items: center;
    background: #1e1f22;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.view-mode-btn {
    background: transparent;
    border: none;
    color: #949ba4;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.view-mode-btn:hover {
    color: #f2f3f5;
    background: rgba(255, 255, 255, 0.04);
}

.view-mode-btn.active {
    background: #35373c;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   PANNEAU PRINCIPAL DU CLIENT DISCORD
   ========================================================================== */

.discord-preview-panel {
    background: var(--discord-bg-primary);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    min-height: 520px;
    color: var(--discord-text-normal);
    font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.375rem;
    border: 1px solid var(--discord-border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-radius 0.25s ease;
}

/* ==========================================================================
   VUE MOBILE DISCORD (SMARTPHONE CLIENT SIMULATOR)
   ========================================================================== */

.discord-preview-panel.view-mobile {
    max-width: 395px;
    margin: 0 auto;
    border-radius: 28px;
    border: 9px solid #1a1b1e;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Encoche / Haut-parleur du simulateur mobile */
.discord-preview-panel.view-mobile::before {
    content: "";
    display: block;
    width: 90px;
    height: 5px;
    background: #2b2d31;
    border-radius: 4px;
    margin: 6px auto 4px auto;
    flex-shrink: 0;
}

/* ==========================================================================
   BARRE SUPÉRIEURE DE SALON DISCORD (CHANNEL TOP BAR)
   ========================================================================== */

.discord-channel-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
    background: var(--discord-channel-top-bar-bg);
    border-bottom: 1px solid var(--discord-border-subtle);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
    flex-shrink: 0;
    user-select: none;
    gap: 12px;
}

.discord-channel-info {
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    gap: 6px;
    min-width: 0;
}

.discord-channel-hash {
    font-size: 1.35rem;
    font-weight: 500;
    color: #80848e;
    line-height: 1;
}

.discord-channel-icon {
    font-size: 1rem;
    color: #f2f3f5;
}

.discord-channel-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--discord-header-primary);
    letter-spacing: -0.2px;
}

.discord-channel-sep {
    width: 1px;
    height: 16px;
    background: #3f4147;
    margin: 0 8px;
    flex-shrink: 0;
}

.discord-channel-topic {
    font-size: 0.82rem;
    color: var(--discord-text-muted);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.discord-channel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.discord-top-action-btn {
    background: transparent;
    border: none;
    color: #b5bac1;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    padding: 0;
}

.discord-top-action-btn:hover {
    color: var(--discord-header-primary);
    background: #35373c;
}

.discord-top-action-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.discord-search-box {
    display: flex;
    align-items: center;
    background: var(--discord-bg-tertiary);
    border-radius: 4px;
    height: 24px;
    padding: 0 6px 0 8px;
    width: 140px;
    color: var(--discord-text-muted);
    transition: width 0.2s ease, background 0.2s ease;
}

.discord-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--discord-text-normal);
    font-size: 0.78rem;
    width: 100%;
    cursor: default;
}

.discord-search-box input::placeholder {
    color: var(--discord-text-muted);
}

.discord-search-icon {
    width: 14px;
    height: 14px;
    fill: #949ba4;
    flex-shrink: 0;
}

/* Adaptations Mobile pour la Top Bar */
.discord-preview-panel.view-mobile .discord-channel-top-bar {
    height: 44px;
    padding: 0 10px;
}

.discord-preview-panel.view-mobile .discord-channel-topic,
.discord-preview-panel.view-mobile .discord-channel-sep,
.discord-preview-panel.view-mobile .discord-hide-mobile {
    display: none !important;
}

/* ==========================================================================
   ZONE DE DÉFILEMENT DES MESSAGES
   ========================================================================== */

.discord-messages-scroll-area {
    flex-grow: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Badge de fil / post forum */
.discord-thread-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--discord-bg-secondary);
    border: 1px solid var(--discord-border-subtle);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--discord-header-primary);
    margin: 0 16px 12px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    align-self: flex-start;
}

.discord-thread-badge strong {
    color: #5865f2;
    font-weight: 700;
}

/* ==========================================================================
   LIGNE DE MESSAGE DISCORD (MESSAGE ROW)
   ========================================================================== */

.discord-msg-row {
    display: flex;
    gap: 16px;
    padding: 4px 16px 6px 16px;
    border-radius: 2px;
    transition: background 0.1s ease;
    position: relative;
}

.discord-msg-row:hover {
    background: var(--discord-row-hover);
}

/* Avatar avec masque circulaire et statut en ligne */
.discord-avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    cursor: pointer;
}

.discord-avatar-mask {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #5865f2;
}

.discord-avatar-mask img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Pastille verte de statut en ligne avec découpe de bordure */
.discord-online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--discord-online-green);
    border: 3px solid var(--discord-bg-primary);
    transition: border-color 0.1s ease;
    box-sizing: border-box;
}

.discord-msg-row:hover .discord-online-dot {
    border-color: var(--discord-row-hover);
}

/* Corps du message */
.discord-msg-body {
    flex-grow: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

/* En-tête auteur & horodatage */
.discord-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.discord-author-name {
    font-weight: 600;
    font-size: 1rem;
    color: #f2f3f5;
    cursor: pointer;
    line-height: 1.375rem;
    transition: text-decoration 0.1s ease;
}

.discord-author-name:hover {
    text-decoration: underline;
}

/* Badge Officiel APP / BOT */
.discord-bot-badge {
    background: #5865f2;
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 1px 4px 1px 3px;
    border-radius: 3px;
    line-height: 0.95rem;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    user-select: none;
    vertical-align: middle;
}

.discord-bot-badge svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

/* Horodatage avec infobulle Discord simulée au survol */
.discord-timestamp {
    font-size: 0.75rem;
    color: var(--discord-text-muted);
    cursor: default;
    position: relative;
    user-select: none;
    margin-left: 2px;
}

.discord-timestamp:hover {
    color: var(--discord-text-normal);
}

.discord-timestamp::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #111214;
    color: #f2f3f5;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 5px 9px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    z-index: 1000;
}

.discord-timestamp::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #111214;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1000;
}

.discord-timestamp:hover::after,
.discord-timestamp:hover::before {
    opacity: 1;
}

/* ==========================================================================
   CONTENEUR D'EMBED DISCORD (WEBHOOK CARDS)
   ========================================================================== */

.discord-embed {
    display: flex;
    flex-direction: column;
    max-width: 520px;
    background: var(--discord-bg-secondary);
    border-left: 4px solid var(--discord-blurple);
    border-radius: 4px;
    padding: 12px 16px;
    margin-top: 6px;
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.discord-embed-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.discord-embed-main-col {
    flex-grow: 1;
    min-width: 0;
}

.discord-embed-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.discord-embed-desc {
    font-size: 0.875rem;
    color: var(--discord-text-normal);
    line-height: 1.325rem;
    margin-bottom: 10px;
}

/* Miniature flottante (Thumbnail) */
.discord-embed-thumb {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.discord-embed-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Grille de champs Discord (Embed Fields) */
.discord-embed-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px 14px;
    margin-top: 6px;
}

.discord-embed-field.full {
    grid-column: 1 / -1;
}

.discord-field-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #b5bac1;
    margin-bottom: 3px;
    line-height: 1.15;
}

.discord-field-value {
    font-size: 0.875rem;
    color: var(--discord-text-normal);
    line-height: 1.25rem;
    word-break: break-word;
}

/* Pied d'Embed */
.discord-embed-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 0.75rem;
    color: var(--discord-text-muted);
}

.discord-footer-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ==========================================================================
   FORMATAGE DU TEXTE MARKDOWN DISCORD
   ========================================================================== */

.discord-text-content {
    font-size: 0.95rem;
    color: var(--discord-text-normal);
    line-height: 1.45rem;
    word-break: break-word;
}

/* Titres Discord */
.discord-h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--discord-header-primary);
    margin: 14px 0 6px 0;
    line-height: 1.25;
}

.discord-h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--discord-header-primary);
    margin: 12px 0 4px 0;
    line-height: 1.3;
}

.discord-h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--discord-header-primary);
    margin: 10px 0 4px 0;
    line-height: 1.3;
}

.discord-subtext {
    font-size: 0.78rem;
    color: var(--discord-text-muted);
    line-height: 1.15rem;
    margin: 2px 0;
}

/* Citations Discord (Blockquotes) */
.discord-quote {
    border-left: 4px solid var(--discord-quote-bar);
    padding-left: 12px;
    margin: 6px 0;
    color: var(--discord-text-muted);
    font-style: normal;
}

.discord-quote-single {
    border-left: 4px solid var(--discord-quote-bar);
    padding-left: 10px;
    margin: 2px 0;
    color: #b5bac1;
}

/* Puces de listes Discord */
.discord-list-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 2px 0;
}

.discord-bullet {
    color: #b5bac1;
    font-size: 0.9rem;
    line-height: 1;
    flex-shrink: 0;
}

.discord-list-content {
    flex-grow: 1;
}

/* Ligne de séparation (Divider) */
.discord-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 10px 0;
}

/* Code en ligne et blocs */
.discord-inline-code {
    background: var(--discord-bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "JetBrains Mono", Consolas, Monaco, monospace;
    font-size: 0.85em;
    color: #e0e1e5;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.discord-code-block {
    background: var(--discord-bg-tertiary);
    border: 1px solid var(--discord-border-subtle);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 6px 0;
    font-family: "JetBrains Mono", Consolas, Monaco, monospace;
    font-size: 0.82rem;
    color: #e2e8f0;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.4;
}

/* Mentions de rôles et @everyone */
.discord-mention-tag {
    background: rgba(88, 101, 242, 0.3);
    color: #c9cdfb;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}

.discord-mention-tag:hover {
    background: rgba(88, 101, 242, 0.55);
    color: #ffffff;
}

/* Spoilers Discord (Cliquables pour révélation interactive) */
.discord-spoiler {
    background: #232428;
    color: transparent !important;
    padding: 1px 5px;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
    display: inline;
    outline: none;
}

.discord-spoiler:hover {
    background: #2b2d31;
}

.discord-spoiler.revealed {
    background: rgba(255, 255, 255, 0.14) !important;
    color: var(--discord-text-normal) !important;
    user-select: text;
    cursor: text;
}

/* Horodatages dynamiques Discord (<t:...>) */
.discord-timestamp-chip {
    background: var(--discord-bg-secondary);
    color: var(--discord-text-normal);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.88em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: default;
    user-select: text;
    vertical-align: middle;
}

.discord-timestamp-chip .chip-clock {
    font-size: 0.85em;
    opacity: 0.75;
}

/* Liens masqués Discord */
.discord-link {
    color: #00a8fc;
    text-decoration: none;
}

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

/* ==========================================================================
   ADAPTATIONS RESPONSIVE VUE MOBILE
   ========================================================================== */

.discord-preview-panel.view-mobile .discord-msg-row {
    padding: 6px 12px;
    gap: 12px;
}

.discord-preview-panel.view-mobile .discord-avatar-container,
.discord-preview-panel.view-mobile .discord-avatar-mask {
    width: 36px;
    height: 36px;
}

.discord-preview-panel.view-mobile .discord-embed {
    max-width: 100%;
    padding: 10px 12px;
}

.discord-preview-panel.view-mobile .discord-embed-fields {
    grid-template-columns: 1fr; /* Passage en 1 colonne sur écran smartphone */
    gap: 8px;
}

.discord-preview-panel.view-mobile .discord-embed-thumb {
    width: 65px;
    height: 65px;
}

.discord-preview-panel.view-mobile .discord-h1 {
    font-size: 1.25rem;
}

.discord-preview-panel.view-mobile .discord-h2 {
    font-size: 1.1rem;
}
