/* =========================================
   PAGE ACCOUNT — DESKTOP
   ========================================= */

.account-page {
    padding: 20px;
}

.account-header {
    margin-bottom: 24px;
}

.account-header h1 {
    margin: 0 0 10px;
    font-size: 24px;
    font-weight: 800;
    color: #111827;
}

.account-header p {
    margin: 0;
    font-size: 16px;
    color: #374151;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
    margin-top: 16px;
    align-items: stretch;
}

.account-card {
    min-width: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .04);
    display: flex;
    flex-direction: column;
}

.account-card h1,
.account-card h2 {
    margin: 0 0 10px;
}

.account-card>h2,
.account-section-title {
    margin-bottom: 14px;
}

.account-card--credits {
    grid-column: span 2;
}

.account-card--next {
    grid-column: span 3;
}

.account-card--upcoming {
    grid-column: span 4;
}

.account-card--history {
    grid-column: span 3;
}

.account-card--goal {
    grid-column: span 4;
}

.account-card--messages {
    grid-column: span 3;
}

.account-card--inbox {
    grid-column: span 3;
}

.account-card--cgv {
    grid-column: span 2;
}

.account-card--notifications {
    grid-column: span 12;
}

.account-card--credits,
.account-card--next,
.account-card--goal,
.account-card--history {
    min-height: 220px;
}

.account-line {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.account-line:last-child {
    border-bottom: none;
}

.account-message-read-btn {
    white-space: nowrap;
}

.account-card--inbox,
.account-card--messages {
    min-height: 0;
}

#accountInboxNotifications,
#accountPushMessages {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0px;
}

/* =========================================
   CREDITS
   ========================================= */

.account-credits-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 24px;
    margin-bottom: 18px;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.account-credits-value {
    font-size: 56px;
    line-height: 1;
    font-weight: 800;
    color: #111827;
    margin-bottom: 10px;
}

.account-credits-label {
    font-size: 16px;
    font-weight: 600;
    color: #4b5563;
}

#accountValidity {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.account-validity-label {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 6px;
}

.account-validity-value {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

/* =========================================
   NEXT SESSION
   ========================================= */

.account-card--next {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#accountNextSession {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.account-next-title {
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 14px;
}

.account-next-name {
    max-width: 220px;
    font-size: 20px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 18px;
    line-height: 1.15;
}

.account-next-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f0ff;
    color: #1d4ed8;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 14px;
    min-width: 170px;
}

.account-next-hour {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 24px;
}

.account-next-btn,
.account-session-btn,
.account-history-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    min-height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    color: #111827;
    cursor: pointer;
}

.account-next-btn:hover,
.account-session-btn:hover,
.account-history-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.account-next-btn,
.account-session-btn {
    text-decoration: none;
    text-align: center;
}

/* =========================================
   UPCOMING SESSIONS
   ========================================= */

.account-card--upcoming {
    display: flex;
    flex-direction: column;
}

#accountUpcoming {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.account-session-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
    margin-bottom: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    cursor: pointer;
}

.account-session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.account-session-left {
    width: 72px;
    min-width: 72px;
    text-align: center;
}

.account-session-hour {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
}

.account-session-date {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.68);
    text-transform: lowercase;
}

.account-session-divider {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, 0.10);
}

.account-session-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.account-session-main {
    min-width: 0;
}

.account-session-title {
    letter-spacing: 0.3px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
}

.account-session-cancel-btn {
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-session-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.account-session-footer {
    margin-top: auto;
}

/* =========================================
   HISTORY
   ========================================= */

.account-card--history {
    position: relative;
    display: flex;
    flex-direction: column;
}

#accountHistory {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.account-card--history::before {
    content: '';
    position: absolute;
    top: 86px;
    bottom: 80px;
    left: 42px;
    width: 2px;
    background: rgba(37, 99, 235, 0.18);
}

.account-history-item {
    position: relative;
    padding: 10px 0 18px 44px;
}

.account-history-dot {
    position: absolute;
    left: 18px;
    top: 12px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #2563eb;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
    z-index: 2;
}

.account-history-content {
    flex: 1;
}

.account-history-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1.25;
}

.account-history-meta {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
}

.account-history-footer {
    margin-top: auto;
}

/* =========================================
   GOAL
   ========================================= */

.account-goal-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.account-goal-top {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-goal-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.account-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.account-goal-value {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #0f172a;
}

.account-goal-delta {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    margin-top: 2px;
}

.account-goal-delta.is-up {
    color: #16a34a;
}

.account-goal-delta.is-down {
    color: #dc2626;
}

.account-goal-delta.is-neutral {
    color: #64748b;
}

.account-goal-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.account-goal-btn {
    appearance: none;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-goal-btn:hover {
    border-color: rgba(59, 130, 246, 0.35);
    color: #0f172a;
    transform: translateY(-1px);
}

.account-goal-btn:active {
    transform: scale(0.95);
}

.account-goal-btn.is-active {
    background: #111;
    color: #fff;
    border-color: #111;
    transform: scale(1.05);
}

.account-goal-box {
    background: #eef4ff;
    border: 1px solid #d7e5ff;
    border-radius: 16px;
    padding: 18px 18px 16px;
    margin-top: 10px;
}

.account-goal-progress {
    width: 100%;
    height: 12px;
    background: #e5ebf3;
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0 8px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.account-goal-progress-bar {
    height: 100%;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08), 0 2px 8px rgba(37, 99, 235, 0.18);
}

.account-goal-average {
    font-size: 14px;
    color: #334155;
    line-height: 1.4;
}

.account-goal-message {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
}

.account-goal-sub {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

.account-goal-meta {
    margin-top: 10px;
    font-size: 13px;
    color: #444;
}

.account-average-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.account-average-main {
    font-size: 13px;
    color: #444;
}

.account-average-delta {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.account-average-delta.is-up {
    color: #16a34a;
}

.account-average-delta.is-down {
    color: #dc2626;
}

.account-average-delta.is-neutral {
    color: #6b7280;
}

/* =========================================
   ACCOUNT MESSAGE MODAL
   ========================================= */

#accountMessageModal[hidden] {
    display: none !important;
}

#accountMessageModal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2147483647;
}

#accountMessageModal .modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, .55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity .18s ease;
}

#accountMessageModal .modal__box {
    position: relative;
    z-index: 1;
    width: min(620px, 92vw);
    padding: 22px 22px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(22, 27, 39, .96), rgba(16, 20, 30, .96));
    color: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .45);
    transform: translateY(10px) scale(.985);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
}

#accountMessageModal:not([hidden]) .modal__backdrop {
    opacity: 1;
}

#accountMessageModal:not([hidden]) .modal__box {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#accountMessageTitle {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .2px;
    color: #fff;
}

#accountMessageDate {
    margin: 0 0 14px !important;
    font-size: 13px !important;
    line-height: 1.4;
    color: rgba(255, 255, 255, .58) !important;
}

#accountMessageBody {
    white-space: pre-line;
    line-height: 1.7 !important;
    font-size: 15px;
    color: rgba(255, 255, 255, .88);
}

#accountMessageModal .modal__actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

#accountMessageClose {
    appearance: none;
    min-width: 110px;
    height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .90);
    transition: transform .12s ease, filter .15s ease, border-color .15s ease, box-shadow .15s ease;
}

#accountMessageClose:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

#accountMessageClose:focus {
    outline: none !important;
}

#accountMessageClose:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .35);
    border-color: rgba(59, 130, 246, .55);
}

/* =========================================
   ACCOUNT UNJOIN MODAL
   ========================================= */

.page-account #unjoinModal[hidden] {
    display: none !important;
}

.page-account #unjoinModal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2147483647;
}

.page-account #unjoinModal .modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, .55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.page-account #unjoinModal .modal__box {
    position: relative;
    z-index: 1;
    width: min(520px, 92vw);
    padding: 22px 22px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(22, 27, 39, .96), rgba(16, 20, 30, .96));
    color: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .45);
}

.page-account #unjoinModal .modal__box h3 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.page-account #unjoinModal .modal__actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.page-account #unjoinModal #unjoinCancel {
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .90);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 800;
}

.page-account #unjoinModal #unjoinConfirm {
    background: #dc2626;
    color: #fff;
    border: 1px solid #dc2626;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 800;
}

/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 900px) {
    .account-page {
        padding: 14px;
    }

    .account-header {
        margin-bottom: 16px;
    }

    .account-header h1 {
        font-size: 28px;
        line-height: 1.1;
    }

    .account-header p {
        font-size: 15px;
    }

    .account-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .account-card--credits,
    .account-card--next,
    .account-card--goal,
    .account-card--history,
    .account-card--upcoming,
    .account-card--messages,
    .account-card--notifications {
        grid-column: auto;
        min-height: auto;
    }

    .account-card {
        padding: 16px;
        border-radius: 18px;
    }

    .account-card--next {
        text-align: center;
        align-items: stretch;
        justify-content: flex-start;
    }

    #accountNextSession {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        width: 100%;
    }

    .account-next-title {
        width: 100%;
        text-align: left;
    }

    .account-next-name {
        width: 100%;
        max-width: 100%;
        text-align: center;
        font-size: 18px;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .account-next-date {
        width: auto;
        max-width: 100%;
        min-width: 0;
        padding: 6px 14px;
        margin-left: auto;
        margin-right: auto;
        justify-content: center;
    }

    .account-next-hour {
        width: 100%;
        text-align: center;
        margin-bottom: 16px;
    }

    .account-next-btn {
        width: 100%;
    }

    .account-goal-box {
        padding: 16px 14px;
    }

    .account-goal-header {
        align-items: flex-start;
        gap: 8px;
    }

    .account-goal-value {
        font-size: 17px;
        line-height: 1.25;
    }

    .account-goal-delta {
        font-size: 11px;
        white-space: nowrap;
    }

    .account-goal-meta {
        margin-top: 12px;
        font-size: 13px;
        line-height: 1.35;
    }

    .account-goal-picker {
        gap: 8px;
    }

    .account-goal-btn {
        flex: 1;
        min-width: 0;
        text-align: center;
    }

    .account-card--history::before {
        top: 78px;
        bottom: 68px;
        left: 34px;
    }

    .account-history-item {
        padding: 10px 0 16px 34px;
    }

    .account-history-dot {
        left: 10px;
        top: 11px;
    }

    .account-history-title {
        font-size: 14px;
    }

    .account-history-meta {
        font-size: 12px;
    }

    .account-history-btn {
        width: 100%;
    }

    .account-session-card {
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .account-session-left {
        width: 62px;
        min-width: 62px;
    }

    .account-session-hour {
        font-size: 17px;
    }

    .account-session-date {
        font-size: 10px;
    }

    .account-session-right {
        gap: 10px;
        align-items: center;
    }

    .account-session-title {
        font-size: 14px;
        line-height: 1.2;
    }

    .account-session-cancel-btn {
        padding: 8px 10px;
        font-size: 11px;
        white-space: nowrap;
    }

    .account-session-btn {
        width: 100%;
    }

    .account-credits-value {
        font-size: 52px;
    }

    .account-credits-label {
        font-size: 15px;
    }

    .account-validity-value {
        font-size: 16px;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .account-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .account-card--credits,
    .account-card--next,
    .account-card--goal,
    .account-card--upcoming,
    .account-card--history,
    .account-card--messages,
    .account-card--notifications {
        grid-column: auto;
    }

    .account-card--goal {
        grid-column: span 2;
    }

    .account-card--upcoming,
    .account-card--history {
        grid-column: span 1;
    }

    .account-card--next,
    .account-card--credits {
        min-height: auto;
    }

    .account-card--next {
        text-align: center;
    }

    #accountNextSession {
        align-items: center;
    }

    .account-next-name {
        text-align: center;
    }

    .account-next-date {
        width: auto;
        max-width: 100%;
        min-width: 0;
    }

    .account-session-card {
        padding: 12px;
    }

    .account-session-right {
        gap: 12px;
    }

    .account-session-title {
        font-size: 14px;
    }

    .account-session-cancel-btn {
        font-size: 11px;
        padding: 8px 10px;
    }
}

@media (max-width: 900px) and (orientation: portrait) {

    .page-account .account-page,
    .page-account-history .account-page {
        padding-top: 14px !important;
    }

    .page-account .account-grid,
    .page-account-history #historyFull {
        min-height: 0 !important;
    }
}

/* CONTENU PRINCIPAL SCROLLABLE */
body.page-account {
    overflow: hidden;
}

.account-page.page-account {
    height: 100%;
    overflow-y: auto;
}

.account-grid {
    min-height: 100%;
}

.account-card--notifications {
    margin-bottom: 32px;
}