/*
|--------------------------------------------------------------------------
| HMI SOFTWARE REFONTE UI GLOBALE
| Objectif : donner à toutes les pages internes un rendu logiciel professionnel
| Portée : layout connecté, formulaires, cartes, tableaux, boutons, alertes
|--------------------------------------------------------------------------
*/

:root {
    --hmi-bg: #eef4fb;
    --hmi-panel: #ffffff;
    --hmi-panel-soft: #f8fafc;
    --hmi-border: #dbe4f0;
    --hmi-border-soft: #edf2f7;
    --hmi-text: #0f172a;
    --hmi-muted: #64748b;
    --hmi-primary: #1d4ed8;
    --hmi-primary-dark: #1e3a8a;
    --hmi-primary-soft: #eff6ff;
    --hmi-success: #047857;
    --hmi-success-soft: #ecfdf5;
    --hmi-danger: #be123c;
    --hmi-danger-soft: #fff1f2;
    --hmi-warning: #c2410c;
    --hmi-warning-soft: #fff7ed;
    --hmi-shadow: 0 16px 40px rgba(15, 23, 42, .07);
    --hmi-shadow-lg: 0 24px 70px rgba(15, 23, 42, .11);
    --hmi-radius: 22px;
    --hmi-radius-lg: 28px;
}

/* =========================
   BASE LOGICIEL
========================= */

html {
    background: var(--hmi-bg);
}

body {
    background:
        radial-gradient(circle at 8% 12%, rgba(37, 99, 235, .10), transparent 28%),
        radial-gradient(circle at 92% 86%, rgba(245, 158, 11, .08), transparent 26%),
        var(--hmi-bg) !important;
    color: var(--hmi-text);
    font-family: Inter, Arial, sans-serif;
}

body .sq-shell {
    min-height: 100vh;
    background: transparent !important;
}

body .sq-content-wrapper {
    background: transparent !important;
}

body .sq-desktop-window {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body .sq-workspace {
    padding: 22px !important;
    background: transparent !important;
}

/* =========================
   TITRE DE PAGE
========================= */

body .sq-page-titlebar {
    background: rgba(255, 255, 255, .92) !important;
    border: 1px solid var(--hmi-border) !important;
    border-radius: var(--hmi-radius-lg) !important;
    padding: 20px 22px !important;
    margin: 0 22px 18px !important;
    box-shadow: var(--hmi-shadow) !important;
    backdrop-filter: blur(14px);
}

body .sq-page-titlebar h1,
body .sq-page-titlebar h2,
body .sq-page-titlebar h3 {
    margin: 0 !important;
    color: var(--hmi-text) !important;
    font-size: 24px !important;
    line-height: 1.15 !important;
    font-weight: 950 !important;
    letter-spacing: -.035em !important;
}

body .sq-page-titlebar p {
    margin: 6px 0 0 !important;
    color: var(--hmi-muted) !important;
    font-size: 14px !important;
    font-weight: 760 !important;
}

/* =========================
   CARTES / BLOCS
========================= */

body .sq-workspace .sq-card,
body .sq-workspace .card,
body .sq-workspace .bg-white,
body .sq-workspace section.bg-white,
body .sq-workspace div.bg-white {
    background: var(--hmi-panel) !important;
    border: 1px solid var(--hmi-border) !important;
    border-radius: var(--hmi-radius) !important;
    box-shadow: var(--hmi-shadow) !important;
}

body .sq-workspace .shadow,
body .sq-workspace .shadow-sm,
body .sq-workspace .shadow-md,
body .sq-workspace .shadow-lg,
body .sq-workspace .shadow-xl {
    box-shadow: var(--hmi-shadow) !important;
}

body .sq-workspace .rounded,
body .sq-workspace .rounded-lg,
body .sq-workspace .rounded-xl,
body .sq-workspace .rounded-2xl {
    border-radius: var(--hmi-radius) !important;
}

body .sq-workspace .p-4 {
    padding: 18px !important;
}

body .sq-workspace .p-6 {
    padding: 22px !important;
}

/* =========================
   GRILLES / KPI
========================= */

body .sq-workspace .sq-grid-2,
body .sq-workspace .sq-grid-3,
body .sq-workspace .sq-grid-4,
body .sq-workspace .grid {
    gap: 14px;
}

body .sq-workspace .sq-grid-4 > .sq-card,
body .sq-workspace .grid > .sq-card {
    min-height: 98px;
}

body .sq-workspace .sq-card small,
body .sq-workspace .card small {
    color: var(--hmi-muted) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    letter-spacing: .035em !important;
}

body .sq-workspace .sq-card h3,
body .sq-workspace .card h3 {
    color: var(--hmi-text) !important;
    font-weight: 950 !important;
}

/* =========================
   FORMULAIRES
========================= */

body .sq-workspace form {
    margin: 0;
}

body .sq-workspace label {
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

body .sq-workspace input[type="text"],
body .sq-workspace input[type="email"],
body .sq-workspace input[type="password"],
body .sq-workspace input[type="number"],
body .sq-workspace input[type="date"],
body .sq-workspace input[type="datetime-local"],
body .sq-workspace input[type="search"],
body .sq-workspace select,
body .sq-workspace textarea {
    min-height: 46px !important;
    width: 100%;
    background: #f8fafc !important;
    color: var(--hmi-text) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 16px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    font-weight: 760 !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

body .sq-workspace textarea {
    min-height: 110px !important;
    resize: vertical;
}

body .sq-workspace input:focus,
body .sq-workspace select:focus,
body .sq-workspace textarea:focus {
    border-color: var(--hmi-primary) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12) !important;
}

body .sq-workspace input::placeholder,
body .sq-workspace textarea::placeholder {
    color: #94a3b8 !important;
}

/* =========================
   BOUTONS
========================= */

body .sq-workspace button,
body .sq-workspace input[type="submit"],
body .sq-workspace .sq-btn,
body .sq-workspace .sq-btn-primary,
body .sq-workspace .sq-btn-secondary,
body .sq-workspace .sq-btn-danger,
body .sq-workspace a[class*="sq-btn"] {
    min-height: 42px !important;
    border-radius: 14px !important;
    padding: 10px 16px !important;
    border: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
}

body .sq-workspace button:hover,
body .sq-workspace input[type="submit"]:hover,
body .sq-workspace .sq-btn:hover,
body .sq-workspace .sq-btn-primary:hover,
body .sq-workspace .sq-btn-secondary:hover,
body .sq-workspace .sq-btn-danger:hover,
body .sq-workspace a[class*="sq-btn"]:hover {
    transform: translateY(-1px);
}

body .sq-workspace .sq-btn-primary,
body .sq-workspace button[type="submit"],
body .sq-workspace input[type="submit"],
body .sq-workspace .bg-blue-600,
body .sq-workspace .bg-blue-700,
body .sq-workspace .bg-gray-900 {
    background: linear-gradient(135deg, var(--hmi-primary), #4c1d95) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 30px rgba(37, 99, 235, .22) !important;
}

body .sq-workspace .sq-btn-secondary,
body .sq-workspace a.sq-btn-secondary {
    background: #ffffff !important;
    color: var(--hmi-text) !important;
    border: 1px solid var(--hmi-border) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06) !important;
}

body .sq-workspace .sq-btn-danger,
body .sq-workspace .bg-red-600,
body .sq-workspace .bg-rose-600 {
    background: linear-gradient(135deg, #be123c, #881337) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 30px rgba(190, 18, 60, .20) !important;
}

body .sq-workspace button:disabled,
body .sq-workspace .disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* =========================
   TABLEAUX
========================= */

body .sq-workspace .sq-table-card,
body .sq-workspace .table-card,
body .sq-workspace div:has(> table) {
    border-radius: var(--hmi-radius) !important;
}

body .sq-workspace table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: #ffffff !important;
}

body .sq-workspace table thead th {
    background: #eaf2fb !important;
    color: #334155 !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--hmi-border) !important;
    text-align: left !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    font-weight: 950 !important;
    letter-spacing: .04em !important;
    text-transform: uppercase !important;
}

body .sq-workspace table tbody td {
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--hmi-border-soft) !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 760 !important;
    vertical-align: middle !important;
}

body .sq-workspace table tbody tr:hover {
    background: #f8fafc !important;
}

body .sq-workspace table tbody tr:last-child td {
    border-bottom: 0 !important;
}

body .sq-workspace table strong,
body .sq-workspace table .font-semibold,
body .sq-workspace table .font-bold {
    color: var(--hmi-text) !important;
    font-weight: 950 !important;
}

body .sq-workspace table small,
body .sq-workspace table .text-xs {
    color: var(--hmi-muted) !important;
    font-weight: 760 !important;
}

/* =========================
   ALERTES / BADGES
========================= */

body .sq-workspace .sq-alert-success,
body .sq-workspace .alert-success,
body .sq-workspace .bg-green-50 {
    background: var(--hmi-success-soft) !important;
    color: var(--hmi-success) !important;
    border: 1px solid #bbf7d0 !important;
    border-radius: 18px !important;
    padding: 14px 16px !important;
    font-weight: 850 !important;
}

body .sq-workspace .sq-alert-error,
body .sq-workspace .alert-danger,
body .sq-workspace .alert-error,
body .sq-workspace .bg-red-50,
body .sq-workspace .bg-rose-50 {
    background: var(--hmi-danger-soft) !important;
    color: var(--hmi-danger) !important;
    border: 1px solid #fecdd3 !important;
    border-radius: 18px !important;
    padding: 14px 16px !important;
    font-weight: 850 !important;
}

body .sq-workspace .badge,
body .sq-workspace .status,
body .sq-workspace span[class*="status"],
body .sq-workspace span[class*="badge"] {
    border-radius: 999px !important;
    padding: 7px 11px !important;
    font-size: 12px !important;
    font-weight: 950 !important;
}

/* =========================
   PAGES VIDES
========================= */

body .sq-workspace .sq-empty,
body .sq-workspace .empty,
body .sq-workspace td[colspan] {
    color: var(--hmi-muted) !important;
    font-weight: 850 !important;
}

body .sq-workspace .sq-empty {
    background: #f8fafc !important;
    border: 1px dashed #cbd5e1 !important;
    border-radius: 18px !important;
    padding: 28px !important;
}

/* =========================
   FILTRES / BARRES D’ACTIONS
========================= */

body .sq-workspace .sq-actions-row,
body .sq-workspace .actions,
body .sq-workspace .filter,
body .sq-workspace .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px !important;
}

body .sq-workspace .sq-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

/* =========================
   PAGINATION
========================= */

body .sq-workspace nav[role="navigation"] {
    padding: 4px 0;
}

body .sq-workspace nav[role="navigation"] a,
body .sq-workspace nav[role="navigation"] span {
    border-radius: 12px !important;
    font-weight: 850 !important;
}

/* =========================
   SIDEBAR / NAVIGATION
========================= */

body .sq-shell aside,
body .sq-sidebar {
    box-shadow: 18px 0 42px rgba(15, 23, 42, .08) !important;
}

body .sq-shell a {
    text-decoration: none;
}

/* =========================
   RESPONSIVE LOGICIEL
========================= */

@media (max-width: 1100px) {
    body .sq-workspace {
        padding: 16px !important;
    }

    body .sq-page-titlebar {
        margin: 0 16px 16px !important;
    }

    body .sq-workspace .sq-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body .sq-workspace table {
        min-width: 860px;
    }

    body .sq-workspace .sq-table-card,
    body .sq-workspace div:has(> table) {
        overflow-x: auto !important;
    }
}

@media (max-width: 680px) {
    body .sq-workspace {
        padding: 12px !important;
        padding-bottom: 90px !important;
    }

    body .sq-page-titlebar {
        margin: 0 12px 14px !important;
        padding: 16px !important;
        border-radius: 22px !important;
    }

    body .sq-page-titlebar h1,
    body .sq-page-titlebar h2 {
        font-size: 20px !important;
    }

    body .sq-workspace .sq-grid-2,
    body .sq-workspace .sq-grid-3,
    body .sq-workspace .sq-grid-4,
    body .sq-workspace .grid {
        grid-template-columns: 1fr !important;
    }

    body .sq-workspace .sq-header-row {
        align-items: flex-start;
        flex-direction: column;
    }

    body .sq-workspace .sq-actions-row,
    body .sq-workspace .sq-actions-row form,
    body .sq-workspace .sq-actions-row a,
    body .sq-workspace .sq-actions-row button {
        width: 100%;
    }

    body .sq-workspace button,
    body .sq-workspace input[type="submit"],
    body .sq-workspace .sq-btn,
    body .sq-workspace a[class*="sq-btn"] {
        width: 100%;
    }
}
