/* ========================================
   STEP 7 - ASSETS CONFIGURATION + VALIDATION
   Reproduction fidele du design system _step8-config.css + _step8-validate.css
   ======================================== */

/* ==========================================================================
   Asset Cards Modern (config page)
   ========================================================================== */
.asset-card-modern {
    position: relative;
    /* --theme-card-bg pour fond thematique (bordeaux/marine en dark, blanc en
       light), eviter le blanc dur via --bg-card qui reste fige a #ffffff. */
    background: var(--theme-card-bg, #ffffff);
    border: 2px solid transparent;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 100%;
}

.asset-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 48, 128, 0.15);
    border-color: var(--color-primary);
}

.asset-card-modern.active {
    background: linear-gradient(135deg, rgba(0, 48, 128, 0.03), rgba(57, 191, 239, 0.03));
    border-color: var(--color-primary);
    border-width: 2px;
}

.asset-card-badge {
    font-size: 0.65rem;
}

.asset-card-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   Asset Icon Wrappers (per channel type)
   ========================================================================== */
.asset-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-bottom: 1rem;
}

.asset-icon-linkedin { background: linear-gradient(135deg, #0077B5, #00A0DC); }
.asset-icon-google { background: linear-gradient(135deg, #4285F4, #34A853); }
.asset-icon-bing { background: linear-gradient(135deg, #008373, #00A884); }
.asset-icon-facebook { background: linear-gradient(135deg, #1877F2, #4267B2); }
.asset-icon-instagram { background: linear-gradient(135deg, #E1306C, #FD1D1D, #F77737); }
.asset-icon-iab { background: linear-gradient(135deg, #6C63FF, #4A90E2); }
.asset-icon-mail { background: linear-gradient(135deg, #EA4335, #FBBC04); }
.asset-icon-sms { background: linear-gradient(135deg, #25D366, #128C7E); }
.asset-icon-article { background: linear-gradient(135deg, #FF6B6B, #FFE66D); }
.asset-icon-courrier { background: linear-gradient(135deg, #8E44AD, #9B59B6); }

/* ==========================================================================
   Toggle Switch
   ========================================================================== */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    transition: background 0.3s;
    cursor: pointer;
}

.toggle-switch.active {
    background: var(--color-primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* ==========================================================================
   Variation Stepper Control (+ / - buttons)
   ========================================================================== */
.variation-stepper-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.variation-stepper-control-inactive {
    opacity: 0.3;
}

.variation-stepper-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.variation-stepper-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.variation-stepper-value {
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    color: var(--color-primary);
}

/* ==========================================================================
   Estimation Card (CTA banner)
   ========================================================================== */
.estimation-icon-circle {
    width: 64px;
    height: 64px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.estimation-badge {
    font-size: 0.75rem;
}

/* ==========================================================================
   Asset Validate - Table
   ========================================================================== */
.asset-table {
    table-layout: fixed;
    width: 100%;
}

.asset-table-col-type { width: 130px; }
.asset-table-col-variation { width: 80px; }
.asset-table-col-preview { width: auto; }
.asset-table-col-score { width: 90px; text-align: center; }
.asset-table-col-approval { width: 100px; text-align: center; }

.asset-badge-small {
    font-size: 0.65rem;
    padding: 3px 7px;
    border-radius: 6px;
}

.asset-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.asset-row:hover {
    background: linear-gradient(135deg, rgba(0, 48, 128, 0.02), rgba(57, 191, 239, 0.02));
    transform: translateX(4px);
}

.asset-row td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.asset-content-italic {
    font-style: italic;
}

.asset-badge-small {
    font-size: 0.65rem;
}

/* ==========================================================================
   Asset Type Badges
   ========================================================================== */
.asset-type-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
}

.asset-type-linkedin { background: #0077B5; color: white; }
.asset-type-google { background: #4285F4; color: white; }
.asset-type-facebook { background: #1877F2; color: white; }
.asset-type-mail, .asset-type-email { background: #EA4335; color: white; }
.asset-type-sms { background: #9C27B0; color: white; }
.asset-type-instagram { background: linear-gradient(135deg, #E1306C, #FD1D1D, #F77737); color: white; }
.asset-type-article { background: #34A853; color: white; }
.asset-type-bing { background: #008373; color: white; }
.asset-type-iab { background: #6C63FF; color: white; }
.asset-type-courrier { background: #8E44AD; color: white; }

/* ==========================================================================
   Asset Detail Modal
   ========================================================================== */
.modal-fullscreen-custom {
    max-width: 95%;
    height: 95vh;
    margin: 2.5vh auto;
}

.modal-fullscreen-custom .modal-content {
    height: 100%;
    border-radius: var(--border-radius-lg);
}

.modal-body-asset {
    height: calc(95vh - 140px);
    overflow: hidden;
}

.modal-col-left {
    /* --theme-card-bg pour suivre le theme (bordeaux/marine en dark, blanc
       en light), eviter le blanc dur via --bg-card. */
    background: var(--theme-card-bg, #ffffff);
    border-right: 2px solid var(--border);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modal-col-left-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-xl) var(--spacing-2xl) var(--spacing-2xl) var(--spacing-2xl);
}

.modal-col-right {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Panneau droit /assets/validate : flex: 1 1 0px force le scroll sans débordement.
   Fond thematique (gris pale en light, bordeaux/marine semi-transparent en
   dark) au lieu du bg-light Bootstrap hardcode. */
.modal-preview-scroll {
    flex: 1 1 0px !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    background: var(--theme-bg-secondary, #f8f9fa);
}

.modal-col-right-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing-2xl);
    background: var(--bg-hover);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* ==========================================================================
   KPI Cards
   ========================================================================== */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    transition: all 0.2s ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 48, 128, 0.1);
    transform: translateY(-2px);
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==========================================================================
   Reasoning Section
   ========================================================================== */
.reasoning-section {
    background: linear-gradient(135deg, rgba(0, 48, 128, 0.03), rgba(57, 191, 239, 0.03));
    border-left: 4px solid var(--color-primary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-lg);
}

.reasoning-title {
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.reasoning-content {
    /* --theme-text-secondary pour suivre le theme. */
    color: var(--theme-text-secondary, #6b6f80);
    margin-bottom: 0;
    line-height: 1.6;
    font-size: 0.875rem;
}

/* ========================================
   ASSET MODAL - PREVIEW SHARED
   ======================================== */
.preview-card {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.preview-body {
    padding: 16px;
}

.preview-body p {
    font-size: 14px;
    line-height: 1.6;
    color: #000;
}

.preview-action-bar {
    border-top: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    justify-content: space-around;
}

.preview-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: default;
    padding: 8px 16px;
}

/* ========================================
   ASSET MODAL - PREVIEW PER TYPE
   ======================================== */

/* Facebook */
.preview-facebook {
    zoom: 0.85;
}

.preview-facebook .preview-avatar {
    background: linear-gradient(135deg, #1877F2, #0C5DC7);
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.preview-facebook .preview-header {
    border-bottom: none;
    padding: 12px 16px;
}

.preview-facebook .preview-body {
    padding: 0 16px 16px;
}

.preview-facebook .preview-hashtags {
    color: #1877F2;
    font-weight: 600;
}

.preview-menu-dots {
    color: #65676b;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: default;
    line-height: 1;
}

.preview-engagement-bar {
    padding: 8px 16px;
    border-top: 1px solid #e4e6eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #65676b;
    font-size: 13px;
}

.reaction-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    border: 2px solid white;
    margin-left: -4px;
}

.reaction-icon:first-child {
    margin-left: 0;
}

.reaction-like { background: #1877F2; }
.reaction-love { background: #f33e58; }
.reaction-smile { background: #f7b125; }

/* LinkedIn */
.preview-linkedin .preview-avatar {
    background: linear-gradient(135deg, #0A66C2, #004182);
}

.preview-linkedin .preview-header {
    border-bottom: 1px solid #e0e0e0;
}

.preview-linkedin .preview-hashtags {
    color: #0A66C2;
    font-weight: 600;
}

/* Google Ads */
.preview-google-ads .ad-badge {
    display: inline-block;
    background: #000;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 6px;
}

.preview-google-ads .ad-url {
    color: #202124;
    font-size: 14px;
}

.preview-google-ads .ad-headline {
    color: #1a0dab;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
    cursor: pointer;
}

.preview-google-ads .ad-description {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.58;
}

/* Instagram */
.preview-instagram .preview-avatar {
    background: linear-gradient(135deg, #E1306C, #F77737);
}

.preview-instagram .preview-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 3rem;
}

/* Bing Ads */
.preview-bing-ads .ad-badge {
    display: inline-block;
    background: #008373;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 6px;
}

.preview-bing-ads .ad-headline {
    color: #001ba0;
    font-size: 20px;
}

/* Email */
.preview-email .email-subject {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.preview-email .email-preheader {
    font-size: 13px;
    color: var(--text-secondary);
}

.preview-email .email-body {
    font-size: 14px;
    line-height: 1.6;
}

/* SMS */
.preview-sms .sms-bubble {
    background: #e5e5ea;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    max-width: 80%;
    font-size: 15px;
    line-height: 1.4;
    color: #000;
}

.preview-sms .sms-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Article */
.preview-article .article-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.preview-article .article-body {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* IAB Banner */
.preview-iab .banner-frame {
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* Postal Mail */
.preview-postal .postal-frame {
    border: 1px solid var(--border);
    padding: 32px;
    background: #fff;
    min-height: 200px;
    font-family: 'Georgia', serif;
}

.preview-postal .postal-accroche {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ========================================
   ASSET MODAL - EDIT MODE
   ======================================== */
.edit-mode .editable {
    outline: 2px dashed var(--color-primary);
    outline-offset: 2px;
    padding: 4px;
    border-radius: 4px;
    min-height: 1.5em;
}

.editable:focus {
    outline: 2px solid var(--color-primary);
    background: rgba(0, 48, 128, 0.05);
}

/* BUG-028 (OPS-009) : la bulle iMessage SMS a un fond sombre (#2c2c2e)
   sur lequel l'outline de .editable est peu visible. On force un
   indicateur d'édition spécifique : bordure pointillée plus claire +
   léger éclaircissement du fond pour que l'utilisateur voie immédiatement
   que la bulle est éditable. Cursor text pour signaler le focus possible. */
.edit-mode .pv-sms-bubble.editable {
    outline: 2px dashed #4dabf7;
    cursor: text;
    background: #3a3a3c;
}

.pv-sms-bubble.editable:focus {
    outline: 2px solid #4dabf7;
    background: #44444a;
}

/* ========================================
   ASSET TABLE - REGENERATING STATE
   ======================================== */
.asset-row-regenerating {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================
   MODAL LAYOUT - HEADER SECTIONS
   ======================================== */
.modal-col-left-header,
.modal-col-right-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   BUG-026 (OPS-009) : alertModal au-dessus de la modale d'aperçu asset
   ----------------------------------------
   Quand la modale d'aperçu asset (.modal Bootstrap) est ouverte et que
   l'utilisateur clique « Envoyer un SMS de test » / « Envoyer un Email
   de test », la modale de confirmation #alertModal apparaissait derrière
   l'aperçu parent (z-index Bootstrap par défaut 1055 partagé).
   On force #alertModal et son backdrop à un z-index supérieur via JS
   au moment du show (campaign_step7_controller.js _showAlertModal),
   et on garde ici une règle CSS de secours pour les pages qui afficheraient
   #alertModal sans la modale d'aperçu déjà ouverte (z-index résiduel inchangé).
   ======================================== */
.modal-backdrop.alert-backdrop-on-top {
    z-index: 1070;
}
#alertModal.alert-modal-on-top {
    z-index: 1075;
}
