/**
 * PrepAI Workspace — polish premium (vague 1)
 * S’appuie sur tokens.css
 */

/* --- Fond application --- */
body.dashboard-page .dashboard-main {
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(99, 102, 241, 0.07), transparent 55%),
        radial-gradient(ellipse 60% 40% at 0% 100%, rgba(37, 99, 235, 0.06), transparent 50%),
        linear-gradient(165deg, var(--prep-bg-app) 0%, var(--prep-bg-app-end) 100%);
}

/* --- En-têtes modules --- */
.dashboard-main .module-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: clamp(24px, 4vw, 36px);
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.dashboard-main .module-header h1 {
    margin: 0 0 10px;
    font-size: clamp(1.5rem, 3.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--prep-text);
    line-height: 1.2;
}

.dashboard-main .module-header .track-pills {
    margin-bottom: 12px;
}

.module-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 14px;
    max-width: 52ch;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--prep-text-secondary);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--prep-border);
    border-radius: var(--prep-radius-md);
    box-shadow: var(--prep-shadow-xs);
}

.module-hint::before {
    content: '✦';
    color: var(--prep-brand-600);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* --- Dashboard accueil --- */
.dash-header {
    margin-bottom: clamp(28px, 5vw, 40px);
    padding: clamp(20px, 4vw, 28px);
    background: var(--prep-bg-surface);
    border: 1px solid var(--prep-border);
    border-radius: var(--prep-radius-xl);
    box-shadow: var(--prep-shadow-sm);
}

.dash-header h1 {
    margin: 0 0 6px;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--prep-text);
}

.dash-header .muted {
    font-size: 0.95rem;
    color: var(--prep-text-muted);
}

.dash-quota-widget {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 18px;
    min-width: 180px;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--prep-radius-lg);
    transition: transform var(--prep-duration) var(--prep-ease), box-shadow var(--prep-duration) var(--prep-ease);
}

.dash-quota-widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--prep-shadow-md);
}

.dash-quota-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--prep-brand-700);
}

.dash-section {
    margin-bottom: clamp(28px, 5vw, 40px);
}

.dash-section h2 {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--prep-text-muted);
    margin: 0 0 14px;
    padding-left: 2px;
}

.dash-grid {
    gap: 16px;
}

/* --- Cartes dashboard --- */
.dash-card {
    position: relative;
    padding: 18px;
    border-radius: var(--prep-radius-lg);
    border: 1px solid var(--prep-border);
    background: var(--prep-bg-surface);
    box-shadow: var(--prep-shadow-xs);
    transition:
        transform var(--prep-duration) var(--prep-ease),
        box-shadow var(--prep-duration) var(--prep-ease),
        border-color var(--prep-duration) var(--prep-ease);
    overflow: hidden;
}

.dash-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--prep-brand-600), var(--prep-accent-600));
    opacity: 0;
    transition: opacity var(--prep-duration) var(--prep-ease);
}

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--prep-shadow-card-hover);
    border-color: #bfdbfe;
}

.dash-card:hover::before {
    opacity: 1;
}

.dash-card-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--prep-radius-md);
    background: linear-gradient(145deg, #f8fafc, #eef2ff);
    border: 1px solid var(--prep-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dash-card-body h3 {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--prep-text);
}

.dash-card-body p {
    color: var(--prep-text-muted);
    line-height: 1.45;
    font-size: 0.84rem;
}

.dash-card-body a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 6px 12px;
    width: fit-content;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--prep-brand-700);
    text-decoration: none;
    background: #eff6ff;
    border-radius: var(--prep-radius-pill);
    transition: background var(--prep-duration) var(--prep-ease), color var(--prep-duration) var(--prep-ease);
}

.dash-card-body a:hover {
    background: var(--prep-brand-600);
    color: #fff;
}

/* --- Cartes contenu (profil, abonnement…) --- */
.recap-block {
    background: var(--prep-bg-surface);
    border: 1px solid var(--prep-border);
    border-radius: var(--prep-radius-lg);
    padding: clamp(20px, 4vw, 28px);
    margin-bottom: 20px;
    box-shadow: var(--prep-shadow-xs);
}

.recap-block h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--prep-text);
    margin-bottom: 16px;
}

/* --- Bannières & notices --- */
.upgrade-banner-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--prep-radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
    color: #1e3a8a;
}

.profile-free-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--prep-warning-bg);
    border: 1px solid #fde68a;
    border-radius: var(--prep-radius-lg);
    font-size: 0.9rem;
    color: #92400e;
    line-height: 1.5;
}

.profile-free-banner a {
    color: var(--prep-brand-700);
    font-weight: 700;
    text-decoration: none;
}

.profile-free-banner a:hover {
    text-decoration: underline;
}

.dashboard-notice {
    border-radius: var(--prep-radius-md);
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.dashboard-notice--warn {
    background: var(--prep-warning-bg);
    border: 1px solid #fde68a;
    color: #92400e;
}

.dashboard-notice a {
    font-weight: 700;
    color: var(--prep-brand-700);
}

/* --- Boutons (alias & focus) --- */
.ec-btn--sm,
.ec-btn-sm {
    padding: 8px 18px;
    font-size: 0.82rem;
    border-radius: var(--prep-radius-pill);
}

.ec-btn:focus-visible,
.ec-btn-sm:focus-visible,
.ec-btn-outline-dark:focus-visible {
    outline: none;
    box-shadow: var(--prep-ring);
}

/* --- Sidebar footer quotas --- */
.sidebar-quota-link {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--prep-radius-md) !important;
    backdrop-filter: blur(8px);
    transition: background var(--prep-duration) var(--prep-ease);
}

.sidebar-quota-link:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.sidebar-quota-value {
    color: #86efac !important;
}

/* --- Track pills --- */
.track-pill {
    border: 1px solid transparent;
    transition: all var(--prep-duration) var(--prep-ease);
}

.track-pill.active {
    background: linear-gradient(135deg, var(--prep-brand-800), var(--prep-accent-600));
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Gap banner — styles finaux dans workspace-gates.css */

/* --- Gate screen --- */
.profile-gate-screen__card {
    border-radius: var(--prep-radius-xl);
    box-shadow: var(--prep-shadow-lg);
}

/* --- Mobile : barre contexte --- */
@media (max-width: 1024px) {
    .dashboard-main {
        padding-top: 64px;
    }
}

@media (max-width: 640px) {
    .dash-header {
        padding: 16px;
    }

    .dash-quota-widget {
        width: 100%;
        min-width: 0;
    }

    .module-hint {
        max-width: none;
    }
}

/* =============================================================================
   Vague 2 — Typo, boutons unifiés, barre mobile, empty states
   ============================================================================= */

body.dashboard-page {
    font-family: var(--prep-font);
}

/* --- Barre contexte mobile --- */
.workspace-mobile-topbar {
    display: none;
}

@media (max-width: 1024px) {
    .workspace-mobile-topbar {
        display: flex;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 190;
        height: 56px;
        padding: 0 16px 0 68px;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--prep-border);
        box-shadow: var(--prep-shadow-xs);
    }

    .workspace-mobile-topbar__title {
        font-size: 0.95rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: var(--prep-text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar-toggle {
        top: 10px;
        z-index: 210;
        box-shadow: var(--prep-shadow-sm);
    }
}

/* --- Boutons workspace unifiés --- */
.ec-btn--outline {
    background: transparent;
    border: 2px solid var(--prep-brand-600);
    color: var(--prep-brand-700);
}

.ec-btn--outline:hover {
    background: var(--prep-info-bg);
}

.ec-btn-outline-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.88rem;
    transition: background var(--prep-duration) var(--prep-ease), color var(--prep-duration) var(--prep-ease);
}

.ec-btn-outline-dark:hover {
    background: var(--prep-info-bg);
}

.ec-btn--warn {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: #fff;
}

.ec-btn--warn:hover {
    filter: brightness(1.05);
}

/* Alias questionnaire CB → style PrepAI */
.btn-prep-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: var(--prep-radius-pill);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--prep-duration) var(--prep-ease), box-shadow var(--prep-duration) var(--prep-ease), filter var(--prep-duration) var(--prep-ease);
}

.btn-prep-nav:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--prep-shadow-sm);
}

.btn-prep-nav:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-prep-nav.btn-primary {
    background: linear-gradient(135deg, var(--prep-brand-800), var(--prep-accent-600));
    color: #fff;
    border-color: transparent;
}

.btn-prep-nav.btn-secondary {
    background: var(--prep-bg-surface);
    border-color: var(--prep-border-strong);
    color: var(--prep-text-secondary);
}

.btn-prep-nav.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-prep-nav.btn-success {
    background: linear-gradient(135deg, #15803d, var(--prep-success));
    color: #fff;
}

/* Académie : boutons alignés PrepAI */
.academy-mark-btn,
.academy-load-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: var(--prep-radius-pill);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--prep-duration) var(--prep-ease), box-shadow var(--prep-duration) var(--prep-ease);
}

.academy-mark-btn {
    border: 2px solid var(--prep-indigo);
    background: #fff;
    color: #4338ca;
}

.academy-mark-btn:hover:not(:disabled) {
    background: #eef2ff;
    transform: translateY(-1px);
}

.academy-load-btn {
    border: none;
    background: linear-gradient(135deg, var(--prep-indigo), var(--prep-accent-600));
    color: #fff;
}

.academy-load-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.academy-player-card,
.academy-catalog {
    border-radius: var(--prep-radius-xl);
    box-shadow: var(--prep-shadow-sm);
}

/* --- Empty states --- */
.workspace-empty-state {
    text-align: center;
    padding: 28px 20px;
    margin: 12px 0;
    background: linear-gradient(160deg, #f8fafc, #eef2ff);
    border: 1px dashed #c7d2fe;
    border-radius: var(--prep-radius-lg);
}

.workspace-empty-state__icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 10px;
    opacity: 0.9;
}

.workspace-empty-state__title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--prep-text);
}

.workspace-empty-state__text {
    margin: 0;
    font-size: 0.84rem;
    color: var(--prep-text-muted);
    line-height: 1.45;
}

/* --- Messagerie --- */
.messages-thread-list {
    background: var(--prep-bg-surface);
    border: 1px solid var(--prep-border);
    border-radius: var(--prep-radius-lg);
    padding: 14px;
    box-shadow: var(--prep-shadow-xs);
}

.messages-new-btn {
    width: 100%;
    margin-bottom: 12px;
    min-height: 44px;
}

.messages-thread-item {
    border-radius: var(--prep-radius-md);
    transition: background var(--prep-duration) var(--prep-ease);
}

.messages-thread-item.is-unread {
    background: #eff6ff;
    border-left: 3px solid var(--prep-brand-600);
}

.messages-panel {
    background: var(--prep-bg-surface);
    border: 1px solid var(--prep-border);
    border-radius: var(--prep-radius-lg);
    padding: clamp(16px, 3vw, 24px);
    box-shadow: var(--prep-shadow-xs);
}

/* --- Abonnement --- */
.subscription-summary-card,
.subscription-campus-card,
.subscription-plan-offer,
.subscription-booster-card {
    border-radius: var(--prep-radius-lg);
    box-shadow: var(--prep-shadow-xs);
    transition: transform var(--prep-duration) var(--prep-ease), box-shadow var(--prep-duration) var(--prep-ease);
}

.subscription-campus-card.is-active,
.subscription-plan-offer--both {
    box-shadow: 0 0 0 1px #bfdbfe, var(--prep-shadow-sm);
}

.subscription-booster-card.is-selected {
    border-color: var(--prep-brand-600);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2), var(--prep-shadow-sm);
}

.subscription-quota-detail {
    border-radius: var(--prep-radius-md);
}

/* --- Profil --- */
.gap-activity-block {
    border-radius: var(--prep-radius-lg);
    border: 1px solid #fed7aa;
    background: linear-gradient(160deg, #fffbeb, #fff);
}

.profile-photo-block .cv-photo {
    border-radius: var(--prep-radius-lg);
    box-shadow: var(--prep-shadow-sm);
}

.activity-pill {
    border-radius: var(--prep-radius-lg);
    transition: border-color var(--prep-duration) var(--prep-ease), box-shadow var(--prep-duration) var(--prep-ease), transform var(--prep-duration) var(--prep-ease);
}

.activity-pill.active {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.activity-panel {
    border-radius: var(--prep-radius-lg);
    box-shadow: var(--prep-shadow-xs);
}

.academic-timeline {
    border-radius: var(--prep-radius-md);
}

/* --- Generateurs CV : boutons secondaires --- */
.btn-generate,
.btn-generate-outline {
    border-radius: var(--prep-radius-pill);
    font-family: inherit;
    font-weight: 700;
}

.btn-add-item {
    border-radius: var(--prep-radius-pill);
}

/* =============================================================================
   Vague 3 — Entrées animées, empty states liens, découpage CSS
   ============================================================================= */

@keyframes prep-fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    body.dashboard-page .dashboard-main > header.module-header,
    body.dashboard-page .dashboard-main > .dash-header,
    body.dashboard-page .dashboard-main > .dash-section,
    body.dashboard-page .dashboard-main > section,
    body.dashboard-page .dashboard-main > .recap-block,
    body.dashboard-page .dashboard-main > .workspace-empty-state,
    body.dashboard-page .dashboard-main > .academy-player-card,
    body.dashboard-page .dashboard-main > .academy-catalog,
    body.dashboard-page .dashboard-main > .messages-layout,
    body.dashboard-page .dashboard-main > .prepai-cv-generator-container,
    body.dashboard-page .dashboard-main > .prepai-motivation-free-workspace,
    body.dashboard-page .dashboard-main > .letter-mode-tabs {
        animation: prep-fade-up 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    body.dashboard-page .dashboard-main > *:nth-child(2) { animation-delay: 0.04s; }
    body.dashboard-page .dashboard-main > *:nth-child(3) { animation-delay: 0.08s; }
    body.dashboard-page .dashboard-main > *:nth-child(4) { animation-delay: 0.12s; }
    body.dashboard-page .dashboard-main > *:nth-child(5) { animation-delay: 0.16s; }
    body.dashboard-page .dashboard-main > *:nth-child(n+6) { animation-delay: 0.2s; }

    .dash-grid .dash-card {
        animation: prep-fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .dash-grid .dash-card:nth-child(1) { animation-delay: 0.05s; }
    .dash-grid .dash-card:nth-child(2) { animation-delay: 0.1s; }
    .dash-grid .dash-card:nth-child(3) { animation-delay: 0.15s; }
    .dash-grid .dash-card:nth-child(4) { animation-delay: 0.2s; }
    .dash-grid .dash-card:nth-child(n+5) { animation-delay: 0.25s; }
}

.workspace-empty-state__text a {
    color: var(--prep-brand-700);
    font-weight: 700;
    text-decoration: none;
}

.workspace-empty-state__text a:hover {
    text-decoration: underline;
}

.workspace-empty-state.compact {
    padding: 18px 16px;
}

.letter-recent-empty.workspace-empty-state,
.letter-library-empty.workspace-empty-state {
    margin: 8px 0 0;
    text-align: left;
}

.cv-profile-empty {
    margin-bottom: 20px;
}


