/* ═══════════════════════════════════════════════════════════════════════════
   P5 — Style CSS — Fintech Dark Mode
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Color Palette derived from the provided Fintech design */
    --bg-sidebar: #1E222A;
    --bg-main: #252831;
    --bg-card: #2B2F3A;
    --bg-card-hover: #313642;
    --bg-input: #1C1F26;
    
    --text-primary: #FFFFFF;
    --text-secondary: #9EA5B4;
    --text-muted: #6E7585;
    
    --accent: #5D5FEF;
    --accent-hover: #7E80FF;
    --accent-gradient: linear-gradient(135deg, #7A5BFF 0%, #4D76FF 100%);
    
    --red: #FF4D4D;
    --green: #00E096;
    --yellow: #FFC42A;
    
    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 50px;
    
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-card: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 10px 30px rgba(0, 0, 0, 0.2);
    
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── App Layout ──────────────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 30px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
    border-right: 1px solid rgba(255, 255, 255, 0.02);
}

.sidebar-brand {
    padding: 0 30px 40px;
}

.sidebar-brand h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 15px;
    border-radius: 14px;
    transition: var(--transition);
    position: relative;
}

.nav-item svg {
    opacity: 0.7;
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--text-primary);
}
.nav-item:hover svg {
    opacity: 1;
}

.nav-item.active {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(93, 95, 239, 0.15) 0%, transparent 100%);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px; /* Touch the edge of sidebar nav container */
    top: 10%;
    height: 80%;
    width: 4px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent);
}

.nav-item.active svg {
    color: var(--accent);
    opacity: 1;
}

.sidebar-footer {
    padding: 0 16px;
}

/* ── Content Wrapper ─────────────────────────────────────────────────────── */

.wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 260px);
}

/* ── Header / Topbar ─────────────────────────────────────────────────────── */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px 40px;
    background: transparent;
}

.search-wrap {
    position: relative;
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 14px 14px 14px 48px;
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(93, 95, 239, 0.1);
}

.user-block {
    display: flex;
    align-items: center;
    gap: 24px;
}

.notification-icon {
    position: relative;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.notification-icon:hover { color: var(--text-primary); }

.badge-dot {
    position: absolute;
    top: 0;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #FF4D4D;
    border-radius: 50%;
    border: 2px solid var(--bg-main);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
}

.user-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-secondary);
}

/* ── Main Content Area ───────────────────────────────────────────────────── */

.main-content {
    padding: 0 40px 40px;
    flex: 1;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    margin-top: 10px;
    margin-bottom: 24px;
    background: linear-gradient(90deg, #FFFFFF, rgba(255, 255, 255, 0.4));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.editing-progress-panel {
    margin-bottom: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(93, 95, 239, 0.14), rgba(93, 95, 239, 0.05));
    border: 1px solid rgba(126, 128, 255, 0.18);
}

.editing-progress-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.editing-progress-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.editing-progress-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}

.editing-progress-percent {
    color: #a7b0ff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.editing-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}

.editing-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #5D5FEF, #7E80FF);
    box-shadow: 0 0 16px rgba(93, 95, 239, 0.45);
    transition: width 0.35s ease;
}

.editing-progress-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

/* ── Dashboard Stats ─────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.stat-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 30px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stat-panel-header h3 {
    font-size: 18px;
    font-weight: 700;
}

/* Visual Mockups inside Stat panels based on design */
.activity-chart {
    height: 160px;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

/* Large numbers styling */
.big-number-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.big-number {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.big-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.progress-pill {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
}

/* ── Lists / Extracts Area ───────────────────────────────────────────────── */

.list-header-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
}

.list-header-group h3 {
    font-size: 20px;
    font-weight: 700;
}

.btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    background: var(--bg-card-hover);
}

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

.btn-upload {
    background: rgba(255, 255, 255, 0.05);
}
.btn-upload:hover { background: rgba(255, 255, 255, 0.1); }


/* Transaction History Style List */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-row {
    display: grid;
    grid-template-columns: 20px auto 1fr auto auto auto;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.row-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.row-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.data-row:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.data-row[data-status="validated"] { border-left: 4px solid var(--green); }
.data-row[data-status="rejected"] { border-left: 4px solid var(--red); opacity: 0.7;}
.data-row[data-status="pending"] { border-left: 4px solid var(--yellow); }

.row-thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-input);
    position: relative;
}

.row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.row-play-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
}
.row-play-icon svg { width: 12px; height: 12px; margin-left: 2px; }

.row-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.row-title {
    font-size: 15px;
    font-weight: 700;
}

.row-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.row-duration {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.row-checks {
    display: flex;
    gap: 6px;
}

.check-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.check-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(0, 224, 150, 0.4); }
.check-dot.fail { background: var(--red); box-shadow: 0 0 8px rgba(255, 77, 77, 0.4); }

.row-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.action-validate:hover { background: rgba(0, 224, 150, 0.15); color: var(--green); }
.action-reject:hover { background: rgba(255, 77, 77, 0.15); color: var(--red); }


/* ── Preview Layout ──────────────────────────────────────────────────────── */

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

.player-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-wrapper {
    background: #111;
    border-radius: 20px; /* Plus arrondi pour simuler un bel écran de téléphone */
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    
    /* C'est ici qu'on force le format vertical 9:16 */
    width: 100%;
    max-width: 380px; 
    aspect-ratio: 9 / 16;
    margin: 0 auto; /* centrer dans le grand bloc */
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Sidebar Details in Preview */
.details-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.details-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.details-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.edit-title-group {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 6px;
    border: 1px solid rgba(255,255,255,0.05);
}

.edit-title-group input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
}
.edit-title-group input:focus { outline: none; }

.edit-btn {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border: none;
    padding: 0 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}
.edit-btn:hover { background: var(--accent); }

.info-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-box {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
}
.info-box-value { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.info-box-label { font-size: 12px; color: var(--text-muted); }

.status-valid { color: var(--green); }
.status-rejected { color: var(--red); }
.status-pending { color: var(--yellow); }

/* Check details */
.check-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
}
.check-name { color: var(--text-secondary); text-transform: capitalize; }
.check-res.ok { color: var(--green); }
.check-res.fail { color: var(--red); }

/* Actions Bar */
.action-massive {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn-massive {
    flex: 1;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 15px;
}

.btn-valid { background: rgba(0, 224, 150, 0.1); color: var(--green); border: 1px solid rgba(0, 224, 150, 0.3); }
.btn-valid:hover { background: rgba(0, 224, 150, 0.2); }

.btn-rej { background: rgba(255, 77, 77, 0.1); color: var(--red); border: 1px solid rgba(255, 77, 77, 0.3); }
.btn-rej:hover { background: rgba(255, 77, 77, 0.2); }


/* ── Utilities ───────────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: var(--bg-card);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    border-left: 4px solid var(--accent);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }


@keyframes spin { to { transform: rotate(360deg); } }
.loading { pointer-events: none; opacity: 0.7; }
.loading::after {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* ── Prompt Editor ─────────────────────────────────────────────────────────── */

.prompt-editor-wrap {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.prompt-textarea {
    width: 100%;
    min-height: 520px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.8;
    padding: 28px 32px;
    resize: vertical;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.prompt-textarea:focus {
    outline: none;
}

.prompt-textarea::selection {
    background: rgba(93, 95, 239, 0.35);
}

.prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.015);
}
