﻿/* =========================================================
   Sysimple Studio – Administration (Standalone)
   - No BootstrapMade dependencies
   - Layout: Topbar + Left nav + Center grid + Right properties
   - Theme picker: dark / light / sysimple (persisted in localStorage)
========================================================= */

:root {
    /* VS Code Dark */
    --bg: #1e1e1e;
    --panel: #252526;
    --surface: #2d2d30;
    --card: #2d2d30;
    --stroke: #3c3c3c;
    --text: #d4d4d4;
    --muted: #9e9e9e;
    --brand: #0e639c;
    --good: #4ec9b0;
    --warn: #dcdcaa;
    --bad: #f44747;
    --shadow: none; /* VS n'a presque pas d'ombre */
    --radius: 6px;
    --h: 54px;
}

/* ===== Themes ===== */
html[data-theme="light"]{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --surface:#ffffff;
  --card:#ffffff;
  --stroke:rgba(0,0,0,.12);
  --text:#111827;
  --muted:rgba(17,24,39,.65);
  --brand:#2b8bd6;
  --shadow: 0 14px 34px rgba(0,0,0,.10);
}
html[data-theme="sysimple"]{
  --bg:#0b1224;
  --panel:#0b1224;
  --surface:#0f1a33;
  --card:#0f1a33;
  --stroke:rgba(255,255,255,.12);
  --text:#e5e7eb;
  --muted:rgba(229,231,235,.70);
  --brand:#2b8bd6;
  --shadow: 0 14px 34px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(43,139,214,.18), transparent 55%),
    radial-gradient(900px 600px at 80% 20%, rgba(99,102,241,.14), transparent 55%),
    var(--bg);
  color:var(--text);
  overflow:hidden;
}

/* ===== TOPBAR (Studio-like) ===== */
.topbar{
  height:var(--h);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
}
.topbar-left{
  display:flex; align-items:center; gap:12px;
  min-width: 320px;
}
.brand{
  display:flex; align-items:center; gap:10px;
  padding: 8px 10px;
  
  
}
.brand .logo{
  width:22px; height:22px; border-radius:6px;
  display:inline-flex; align-items:center; justify-content:center;
  background: rgba(43,139,214,.22);
  border:1px solid rgba(43,139,214,.35);
}
    .brand .logo-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        
        
        overflow: hidden;
        transition: .15s ease;
    }

        .brand .logo-link:hover {
            transform: scale(1.05);
            background: rgba(43,139,214,.22);
        }

    .brand .logo-img {
        max-width: 80%;
        max-height: 80%;
        object-fit: contain;
    }
.brand .title{
  font-weight: 800;
  letter-spacing: .3px;
  font-size: 14px;
  white-space: nowrap;
}
.topbar-center{
  display:flex; align-items:center; gap:10px;
  flex:1;
  justify-content:center;
}
.pill{
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border:1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  white-space:nowrap;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.topbar-right{
  display:flex; align-items:center; gap:8px;
  min-width: 320px;
  justify-content:flex-end;
}

.btn{
  height:36px;
  padding: 0 12px;
  border-radius: 10px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
  transition: .12s ease;
  font-weight: 600;
  font-size: 13px;
}
.btn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.06); }
.btn.primary{
  border-color: rgba(43,139,214,.55);
  background: rgba(43,139,214,.18);
}
.btn.danger{
  border-color: rgba(239,68,68,.55);
  background: rgba(239,68,68,.12);
}
.btn.icon{ width:36px; padding:0; justify-content:center; }

#themePicker{
  height:36px;
  border-radius:10px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  padding: 0 10px;
}
#themePicker option{
  background: #0b1224;
  color: #e5e7eb;
}

/* ===== APP LAYOUT ===== */
.app{
  height: calc(100vh - var(--h));
  display:grid;
  grid-template-columns: 310px 1fr 360px; /* left / center / right */
  gap: 12px;
  padding: 12px;
}

.panel{
  background: rgba(255,255,255,.03);
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-width:0;
}

.panel-h{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  border-bottom:1px solid var(--stroke);
  background: rgba(0,0,0,.14);
}
.panel-h .h-title{
  font-weight: 800;
  font-size: 13px;
  letter-spacing:.2px;
  display:flex;
  align-items:center;
  gap:10px;
}
.panel-h .h-title i{ color: rgba(229,231,235,.85); }
.panel-body{ padding: 10px 12px; overflow:auto; flex:1; }
.panel-footer{ padding:10px 12px; border-top:1px solid var(--stroke); }

/* ===== Sidebar nav ===== */
.nav{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.nav .group{
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px;
  border-radius: 12px;
  border:1px solid transparent;
  color: var(--text);
  text-decoration:none;
  background: rgba(255,255,255,.02);
  transition:.12s ease;
  font-weight: 650;
  font-size: 13px;
}
.nav a:hover{ background: rgba(255,255,255,.05); border-color: var(--stroke); }
.nav a.active{
  background: rgba(43,139,214,.20);
  border-color: rgba(43,139,214,.55);
}
.nav a i{ width:18px; text-align:center; opacity:.95; }

/* ===== Center list toolbar ===== */
.toolbar{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap:wrap;
}
.search{
  flex:1;
  min-width: 180px;
  display:flex;
  align-items:center;
  gap:8px;
  padding: 0 10px;
  height:36px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
}
.search input{
  width:100%;
  border:none;
  outline:none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.chip{
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border:1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  white-space:nowrap;
  display:inline-flex;
  align-items:center;
  gap:8px;
}

/* ===== Table ===== */
table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.02);
}
th,td{
  padding: 10px 10px;
  border-bottom:1px solid rgba(255,255,255,.06);
  font-size: 13px;
  vertical-align: middle;
}
th{
  text-align:left;
  color: rgba(229,231,235,.85);
  font-weight: 800;
  background: rgba(0,0,0,.18);
}
tr:hover td{ background: rgba(255,255,255,.03); }
.badge{
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color: rgba(229,231,235,.9);
  display:inline-flex; gap:6px; align-items:center;
}
.badge.good{ border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.12); }
.badge.warn{ border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.12); }
.badge.bad{ border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.12); }

/* ===== Right properties form ===== */
.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom: 10px;
}
.field label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.field input, .field select, .field textarea{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 10px;
  font-size: 13px;
  outline:none;
}
.field textarea{ min-height: 90px; resize: vertical; }

.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px){
  .app{ grid-template-columns: 290px 1fr; }
  .app .right{ display:none; }
}
@media (max-width: 900px){
  body{ overflow:auto; }
  .app{ grid-template-columns: 1fr; height:auto; }
  .app .left{ display:none; }
}
/* =========================
   FIX LIGHT THEME: contrast + dropdown options
   ========================= */

html[data-theme="light"] {
    /* augmente le contraste global */
    --bg: #f3f4f6;
    --panel: #ffffff;
    --surface: #ffffff;
    --card: #ffffff;
    --stroke: rgba(0,0,0,.14);
    --text: #111827;
    --muted: #374151; /* <-- plus foncé, sinon les labels disparaissent */
    --brand: #0e639c;
    --shadow: 0 14px 34px rgba(0,0,0,.10);
}

    /* Les pills/labels doivent rester lisibles en Light */
    html[data-theme="light"] .pill,
    html[data-theme="light"] .chip,
    html[data-theme="light"] .nav .group,
    html[data-theme="light"] .field label {
        color: var(--muted) !important;
    }

    /* Inputs / selects / textarea lisibles */
    html[data-theme="light"] .field input,
    html[data-theme="light"] .field select,
    html[data-theme="light"] .field textarea,
    html[data-theme="light"] .search {
        background: #ffffff;
        color: var(--text);
        border-color: var(--stroke);
    }

        /* Placeholder */
        html[data-theme="light"] .search input::placeholder {
            color: rgba(17,24,39,.45);
        }

    /* Table header + cellules */
    html[data-theme="light"] table {
        background: #ffffff;
    }

    html[data-theme="light"] th {
        background: rgba(0,0,0,.05);
        color: rgba(17,24,39,.75);
    }

    html[data-theme="light"] td {
        color: var(--text);
    }

    /* Badges lisibles */
    html[data-theme="light"] .badge {
        color: var(--text);
        background: rgba(0,0,0,.03);
    }

    /* ✅ THEME PICKER: options en Light (sinon texte "perdu") */
    html[data-theme="light"] #themePicker {
        background: #ffffff;
        color: var(--text);
        border-color: var(--stroke);
    }

        /* IMPORTANT: options doivent suivre le thème */
        html[data-theme="light"] #themePicker option {
            background: #ffffff;
            color: var(--text);
        }

    /* (Optionnel) Topbar/panels un peu plus “clean” en Light */
    html[data-theme="light"] .topbar {
        background: rgba(255,255,255,.92);
    }

    html[data-theme="light"] .panel {
        background: rgba(255,255,255,.85);
    }
    /* =========================
   LIGHT: headers + table headers nicer
   ========================= */
    html[data-theme="light"] .panel-h {
        background: linear-gradient(to bottom, rgba(255,255,255,.95), rgba(255,255,255,.75));
        border-bottom: 1px solid rgba(0,0,0,.10);
        padding: 12px 14px;
    }

        html[data-theme="light"] .panel-h .h-title {
            font-size: 13px;
            font-weight: 800;
            letter-spacing: .2px;
            color: #111827;
        }

            html[data-theme="light"] .panel-h .h-title i {
                color: rgba(17,24,39,.55);
            }

    /* Un petit “highlight” discret sur le panel */
    html[data-theme="light"] .panel {
        box-shadow: 0 10px 26px rgba(0,0,0,.08);
    }

    /* Barre sous-titre (chip) plus clean */
    html[data-theme="light"] .chip,
    html[data-theme="light"] .pill {
        background: rgba(255,255,255,.85);
        border-color: rgba(0,0,0,.10);
        color: rgba(17,24,39,.70) !important;
    }

    /* ===== Table header: plus premium ===== */
    html[data-theme="light"] table {
        border-color: rgba(0,0,0,.10);
    }

    html[data-theme="light"] th {
        background: linear-gradient(to bottom, rgba(0,0,0,.04), rgba(0,0,0,.02));
        color: rgba(17,24,39,.75);
        font-weight: 800;
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: .7px;
        border-bottom: 1px solid rgba(0,0,0,.10);
    }

    html[data-theme="light"] td {
        border-bottom: 1px solid rgba(0,0,0,.06);
    }

    /* Hover ligne plus doux */
    html[data-theme="light"] tr:hover td {
        background: rgba(14,99,156,.06);
    }

    /* ===== Section titles dans la sidebar (CATALOGUE, etc.) ===== */
    html[data-theme="light"] .nav .group {
        color: rgba(17,24,39,.45) !important;
        font-weight: 800;
        font-size: 11px;
        letter-spacing: .9px;
    }
.grid-message{
  padding: 14px;
  text-align:center;
  color: var(--muted);
}
.grid-message.error{
  color: #f87171;
}
.grid-row{
  cursor:pointer;
}
.grid-row.selected td{
  background: rgba(43,139,214,.12);
}
.empty-state{
  min-height: 140px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color: var(--muted);
  border:1px dashed var(--stroke);
  border-radius: 12px;
  padding: 18px;
}
.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:12px;
}
.field label{
  font-size:12px;
  font-weight:700;
  color: var(--muted);
}
.field input,
.field textarea,
.field select{
  width:100%;
  border:1px solid var(--stroke);
  border-radius:10px;
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding:10px 12px;
  font-size:13px;
  outline:none;
}
.field textarea{
  min-height:90px;
  resize:vertical;
}
.split{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}


.selected-row td{ background: rgba(43,139,214,.12) !important; }
.grid-message{ text-align:center; color: var(--muted); padding: 24px 12px; }
.grid-error{ color: #fca5a5; }
.row-actions{ display:flex; gap:8px; justify-content:flex-start; }
.detail-actions{ display:flex; gap:10px; margin-top:16px; flex-wrap:wrap; }
td .btn.icon{ width:34px; height:34px; }


/*Messages*/
/* =========================
   TOAST NOTIFICATIONS
   ========================= */
.toast-container {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(560px, calc(100% - 32px));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    animation: toastSlideDown 0.25s ease;
    opacity: 1;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.toast-error {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.toast-info {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-10px);
}

.toast-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.85;
}

    .toast-close:hover {
        opacity: 1;
    }

@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   CONFIRM MODAL
   ========================= */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .confirm-modal.hidden {
        display: none;
    }

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.confirm-dialog {
    position: relative;
    width: min(460px, calc(100% - 24px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    animation: modalPop 0.18s ease;
}

.confirm-header {
    padding: 18px 22px 8px;
    border-bottom: 1px solid #eef2f7;
}

    .confirm-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: #1f2937;
    }

.confirm-body {
    padding: 18px 22px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px 20px;
}

.btn.btn-light {
    background: #f3f4f6;
    color: #111827;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.btn.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.btn.btn-light:hover {
    background: #e5e7eb;
}

.btn.btn-danger:hover {
    background: #b91c1c;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}


.hidden { display: none !important; }

.toast-content {
  display:flex;
  align-items:center;
  gap:10px;
}

.toast-content i {
  font-size:16px;
}

.btn.btn-warning {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border: none;
}

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

.btn.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
}

.status-toggle-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.status-toggle-btn .badge {
  transition: transform .15s ease, filter .15s ease;
}

.status-toggle-btn:hover .badge {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.status-toggle-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 999px;
}


#grid th:nth-child(5),
#grid td:nth-child(5) {
    width: 130px;
    max-width: 130px;
    white-space: nowrap;
}

.execution-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    width: 100%;
}

    .execution-cell .badge {
        padding: 4px 10px !important;
        font-size: 11px !important;
        line-height: 1 !important;
        border-radius: 999px;
        min-height: auto !important;
    }

    .execution-cell .error {
        font-size: 11px;
        color: #ff6b6b;
        flex: 0 0 auto;
    }

.badge.neutral {
    padding: 4px 10px !important;
    font-size: 11px !important;
    line-height: 1 !important;
}
#grid {
    table-layout: fixed;
}

    #grid th:nth-child(4),
    #grid td:nth-child(4) {
        width: 110px;
        max-width: 110px;
    }

    #grid th:nth-child(5),
    #grid td:nth-child(5) {
        width: 110px;
        max-width: 110px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
    }

.execution-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

    .execution-cell .badge,
    #grid td:nth-child(5) .badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 3px 8px !important;
        font-size: 11px !important;
        line-height: 1 !important;
        max-width: 82px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .execution-cell .error {
        flex: 0 0 auto;
        font-size: 10px;
        color: #ff6b6b;
    }

#grid td:nth-child(5) i.fa-minus,
#grid td:nth-child(5) i.fa-check,
#grid td:nth-child(5) i.fa-rotate,
#grid td:nth-child(5) i.fa-triangle-exclamation {
    font-size: 10px;
}
/* ===== WORKFLOW EXECUTION COMPACT ===== */

#workflowExecutionHost {
    padding-top: 4px !important;
}

    #workflowExecutionHost .card {
        margin-top: 8px !important;
        padding: 10px 12px !important;
        border-radius: 10px;
    }

    /* Titres plus petits */
    #workflowExecutionHost h2 {
        font-size: 14px !important;
        margin: 0 0 4px 0 !important;
        font-weight: 600;
    }

    /* Sous-texte */
    #workflowExecutionHost .small {
        font-size: 11px !important;
        opacity: 0.7;
        margin-bottom: 6px;
    }

    /* Divider plus compact */
    #workflowExecutionHost .divider {
        margin: 6px 0 !important;
        opacity: 0.2;
    }
.right-panel-body {
    display: flex;
    flex-direction: column;
}

#workflowExecutionHost {
    flex: 0 0 auto;
    max-height: 40vh;
    overflow-y: auto;
}
/* Grilles scrollables (IMPORTANT) */
#runsGrid {
    max-height: 140px;
    overflow-y: auto;
    font-size: 11px;
}

#runDetail {
    max-height: 160px;
    overflow-y: auto;
    font-size: 11px;
}

    /* Scroll style clean */
    #runsGrid::-webkit-scrollbar,
    #runDetail::-webkit-scrollbar {
        width: 6px;
    }

    #runsGrid::-webkit-scrollbar-thumb,
    #runDetail::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.15);
        border-radius: 4px;
    }

.btn.success{background:linear-gradient(180deg,#0f7b49,#0b5f39);border-color:rgba(98,220,156,.35);color:#fff}.btn.success:hover{filter:brightness(1.06)}
