/*!
 * PleniSofts — Theme partagé (login + cards + responsive helpers)
 * Inclus depuis : <link rel="stylesheet" href="https://plenisofts.org/css/plenisofts-theme.css">
 *
 * Variables CSS principales :
 *   --pleni-primary       #571132   (bordeaux marine)
 *   --pleni-primary-light #7a095b   (magenta)
 *   --pleni-secondary     #024745   (vert sapin)
 *   --pleni-accent        #ffd166   (or chaud)
 */
:root {
    --pleni-primary:       #571132;
    --pleni-primary-light: #7a095b;
    --pleni-secondary:     #024745;
    --pleni-dark:          #0a0a0a;
    --pleni-light:         #f6f6f6;
    --pleni-accent:        #ffd166;
    --pleni-text:          #2b2b2b;
    --pleni-muted:         #6b7280;
    --pleni-border:        rgba(255,255,255,.12);
}

/* ── Reset minimal sur le body de login ─────────────────────────────── */
.pleni-theme, .pleni-theme * { box-sizing: border-box; }
body.pleni-login,
.pleni-theme body {
    margin: 0; padding: 0;
    font-family: 'Noto Sans', sans-serif;
    min-height: 100vh;
    color: #fff;
    background:
        radial-gradient(ellipse at top left, rgba(122,9,91,.45) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(2,71,69,.4) 0%, transparent 55%),
        linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, var(--pleni-primary) 100%);
    background-attachment: fixed;
}

/* ── Hardcoded styles for our login template (no body class needed) ── */
html, body {
    margin: 0; padding: 0;
    font-family: 'Noto Sans', sans-serif;
    min-height: 100vh;
    color: #fff;
    background:
        radial-gradient(ellipse at top left, rgba(122,9,91,.45) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(2,71,69,.4) 0%, transparent 55%),
        linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, var(--pleni-primary) 100%);
    background-attachment: fixed;
}
* { box-sizing: border-box; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
}
.login-wrap::before,
.login-wrap::after {
    content: "";
    position: absolute;
    width: 320px; height: 320px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .35;
    pointer-events: none;
}
.login-wrap::before { top: 10%; left: 8%; background: var(--pleni-primary-light); }
.login-wrap::after  { bottom: 10%; right: 8%; background: var(--pleni-secondary); }

.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 30px 90px rgba(0, 0, 0, .55),
        0 0 0 1px rgba(255, 255, 255, .02) inset;
}

/* ── Branding side ───────────────────────────────────────────────────── */
.brand-side {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    background: linear-gradient(135deg, rgba(87, 17, 50, .8) 0%, rgba(2, 71, 69, .6) 100%);
    overflow: hidden;
}
.brand-side::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(255,209,102,.08) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(122,9,91,.22) 0%, transparent 45%);
    pointer-events: none;
}
.brand-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .8rem;
}
.brand-top .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--pleni-accent);
    box-shadow: 0 0 10px var(--pleni-accent);
}
.brand-top .label {
    font-size: .72rem; font-weight: 700;
    letter-spacing: .15em; text-transform: uppercase;
    color: rgba(255,209,102,.9);
}
.brand-title { position: relative; z-index: 1; margin: auto 0; }
.brand-title h1 {
    font-family: 'Alata', sans-serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.05;
    margin-bottom: 1rem;
}
.brand-title h1 span { color: var(--pleni-accent); }
.brand-title p {
    font-size: .95rem;
    line-height: 1.55;
    color: rgba(255,255,255,.75);
    max-width: 34ch;
}
.brand-bottom {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    font-size: .78rem;
    color: rgba(255,255,255,.55);
}
.brand-bottom .feat { display: flex; align-items: center; gap: .6rem; }
.brand-bottom .feat i {
    width: 24px; height: 24px; border-radius: 6px;
    background: rgba(255,209,102,.12);
    color: var(--pleni-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem;
    flex-shrink: 0;
}

/* ── Form side ───────────────────────────────────────────────────────── */
.form-side {
    padding: 3rem 2.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    color: var(--pleni-text);
}
.form-logo { text-align: center; margin-bottom: 1.2rem; }
.form-logo img {
    width: 64px; height: 64px;
    border-radius: 14px;
    object-fit: contain;
    background: var(--pleni-primary);
    padding: 8px;
    box-shadow: 0 8px 22px rgba(87,17,50,.35);
}
.form-title {
    text-align: center;
    font-family: 'Alata', sans-serif;
    font-size: 1.6rem;
    color: var(--pleni-primary);
    margin: 0 0 .3rem 0;
}
.form-subtitle {
    text-align: center;
    font-size: .82rem;
    color: var(--pleni-muted);
    margin: 0 0 1.8rem 0;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pleni-muted);
    margin-bottom: .3rem;
}
.form-group .input-wrap { position: relative; }
.form-group .input-wrap i.lead {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--pleni-muted);
    font-size: .9rem;
}
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: .85rem 1rem .85rem 2.6rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    color: var(--pleni-text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--pleni-primary-light);
    box-shadow: 0 0 0 4px rgba(122,9,91,.12);
}
.password-toggle {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--pleni-muted);
    font-size: .9rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}
.password-toggle:hover { color: var(--pleni-primary-light); }

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .82rem;
    margin-bottom: 1.2rem;
}
.form-row .remember {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--pleni-muted);
    cursor: pointer;
    user-select: none;
}
.form-row .remember input { accent-color: var(--pleni-primary-light); cursor: pointer; }
.form-row a {
    color: var(--pleni-primary-light);
    text-decoration: none;
    font-weight: 600;
}
.form-row a:hover { text-decoration: underline; }

.btn-submit {
    width: 100%;
    padding: .95rem 1rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--pleni-primary) 0%, var(--pleni-primary-light) 100%);
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    box-shadow: 0 10px 25px rgba(87,17,50,.3);
    transition: transform .15s, box-shadow .15s;
    font-family: inherit;
}
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(87,17,50,.42);
}
.btn-submit:disabled { opacity: .6; cursor: wait; }

.form-footer {
    margin-top: 1.6rem;
    text-align: center;
    font-size: .75rem;
    color: var(--pleni-muted);
}
.form-footer .pleni-link {
    color: var(--pleni-primary);
    font-weight: 600;
    text-decoration: none;
}

.alert {
    margin-bottom: 1rem;
    padding: .8rem 1rem;
    border-radius: 10px;
    font-size: .82rem;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}
.alert i { flex-shrink: 0; margin-top: 2px; }
.alert-error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .login-card { grid-template-columns: 1fr; max-width: 460px; }
    .brand-side { padding: 2rem 2rem 1.4rem; min-height: 180px; }
    .brand-title { margin: 1rem 0 .8rem; }
    .brand-title h1 { font-size: 1.7rem; }
    .brand-title p { font-size: .85rem; }
    .brand-bottom { display: none; }
    .form-side { padding: 2rem 1.8rem; }
}
@media (max-width: 480px) {
    .login-wrap { padding: 1rem .6rem; }
    .form-side { padding: 1.8rem 1.4rem; }
}

/* ════════════════════════════════════════════════════════════════════
 * MOBILE OVERRIDES — applique aux dashboards/pages internes des apps
 * Inclus dans les layouts principaux pour rendre tout plus ergonomique
 * sur smartphones et tablettes.
 * ════════════════════════════════════════════════════════════════════ */
.pleni-mobile-tweaks { /* marker class */ }

@media (max-width: 768px) {
    /* Tableaux qui débordent : permettre le scroll horizontal */
    .table-responsive,
    .pleni-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.dataTable, table.table { font-size: .82rem; }
    table.dataTable td, table.dataTable th,
    table.table td, table.table th { padding: .55rem .6rem; }

    /* Cards full-width sans padding excessif */
    .card, .panel, .box {
        margin-left: -8px !important;
        margin-right: -8px !important;
        border-radius: 12px !important;
    }
    .card-body, .panel-body, .box-body { padding: .9rem 1rem !important; }

    /* Grilles Bootstrap : forcer 1 colonne sur mobile */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: .8rem;
    }

    /* Formulaires : labels au-dessus, inputs full-width */
    .form-group label, .form-floating > label { font-size: .82rem; }
    .form-control, .form-select, input[type="text"], input[type="email"],
    input[type="password"], input[type="number"], select, textarea {
        font-size: 16px !important;  /* évite le zoom auto iOS */
    }

    /* Boutons : tap targets ≥ 44px (Apple HIG) */
    .btn, button.btn { min-height: 44px; padding: .65rem 1rem; }
    .btn-sm { min-height: 36px; padding: .45rem .8rem; }

    /* Sidebar Bootstrap collapsée → bouton burger en haut */
    .sidebar, #sidebar, .main-sidebar {
        position: fixed !important;
        left: -260px;
        top: 0;
        width: 260px;
        height: 100vh;
        z-index: 9999;
        transition: left .25s ease;
        overflow-y: auto;
    }
    .sidebar.show, #sidebar.show, .main-sidebar.show { left: 0; }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 9998;
    }

    /* Container principal : padding réduit */
    .container, .container-fluid { padding-left: .8rem !important; padding-right: .8rem !important; }
    .main-content, .content-wrapper { padding: .8rem !important; }

    /* Headers H1/H2 plus discrets */
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.25rem !important; }
    h3 { font-size: 1.1rem !important; }

    /* Modales full-screen */
    .modal-dialog { margin: .4rem; max-width: calc(100% - .8rem) !important; }
    .modal-content { border-radius: 14px; }

    /* Datepickers, dropdowns : viewport-safe */
    .dropdown-menu { max-width: calc(100vw - 16px); }
}

/* ──────────────────────────────────────────────────────────────────────
   Modales et popups — lisibilité forcée (fond blanc, texte sombre).
   Le body global est sombre + texte blanc pour le login ; les modales
   Bootstrap/SweetAlert/jQuery héritent du blanc et deviennent illisibles.
   Spécificité élevée via `body` + `!important` pour passer devant le
   body { color: #fff } global et tout HTML injecté dynamiquement.
   ────────────────────────────────────────────────────────────────────── */
body .modal-content,
body .modal-content * {
    color: var(--pleni-text, #2b2b2b) !important;
}
body .modal-content {
    background-color: #ffffff !important;
}
body .modal-content .badge,
body .modal-content .text-white,
body .modal-content .btn-primary,
body .modal-content .btn-success,
body .modal-content .btn-danger,
body .modal-content .btn-warning,
body .modal-content .btn-info,
body .modal-content .btn-secondary,
body .modal-content .btn-dark,
body .modal-content .alert-success,
body .modal-content .alert-danger,
body .modal-content .alert-warning,
body .modal-content .alert-info,
body .modal-content .alert-primary,
body .modal-content .bg-success,
body .modal-content .bg-danger,
body .modal-content .bg-warning,
body .modal-content .bg-info,
body .modal-content .bg-primary,
body .modal-content .bg-dark,
body .modal-content .badge *,
body .modal-content .btn-primary *,
body .modal-content .btn-success *,
body .modal-content .btn-danger *,
body .modal-content .btn-warning *,
body .modal-content .btn-info *,
body .modal-content .btn-dark * {
    color: #ffffff !important;
}
body .modal-content .text-muted { color: #6c757d !important; }
body .modal-content .text-danger { color: #dc3545 !important; }
body .modal-content .text-success { color: #198754 !important; }
body .modal-content .text-primary { color: #0d6efd !important; }
body .modal-content .text-warning { color: #fd7e14 !important; }
body .modal-content .text-info { color: #0dcaf0 !important; }
body .modal-content a { color: #0d6efd !important; }
.modal-content a { color: #0d6efd; }
.modal-content hr { border-color: rgba(0,0,0,.12); }
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid rgba(0,0,0,.08);
}
.modal-content input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]),
.modal-content select,
.modal-content textarea,
.modal-content .form-control,
.modal-content .form-select {
    background-color: #ffffff;
    color: var(--pleni-text, #2b2b2b);
    border-color: #ced4da;
}
.modal-content .form-label,
.modal-content .col-form-label,
.modal-content .form-text {
    color: var(--pleni-text, #2b2b2b);
}

/* SweetAlert2 popups — même traitement */
.swal2-popup {
    background-color: #ffffff !important;
    color: var(--pleni-text, #2b2b2b) !important;
}
.swal2-title,
.swal2-html-container,
.swal2-content,
.swal2-input,
.swal2-textarea,
.swal2-select,
.swal2-label,
.swal2-validation-message {
    color: var(--pleni-text, #2b2b2b) !important;
}

/* Tooltips / popovers Bootstrap — gardent leur style sombre par défaut,
   pas de surcharge nécessaire. */

/* Dropdowns (menu déroulant) — fond clair, texte sombre */
.dropdown-menu {
    background-color: #ffffff;
    color: var(--pleni-text, #2b2b2b);
}
.dropdown-menu .dropdown-item {
    color: var(--pleni-text, #2b2b2b);
}
.dropdown-menu .dropdown-item.text-danger { color: #dc3545; }
.dropdown-menu .dropdown-item.text-success { color: #198754; }

/* Modales custom .modal-content (pages legacy avec .modal { }) */
.modal:not(.fade):not(.show) > .modal-content,
div.modal > .modal-content {
    background-color: #ffffff;
    color: var(--pleni-text, #2b2b2b);
}

/* ------------------------------------------------------------------ *
 * Lisibilite des bandeaux d entete.
 * Bootstrap colore <code> en rose fonce (#d63384) : sur le degrade
 * violet des entetes, le nom de la table devenait illisible. On lui
 * donne une pastille sombre translucide et du texte blanc, lisible
 * aussi bien sur fond clair que sur fond fonce.
 * ------------------------------------------------------------------ */
.card-header code,
.modal-header code,
.page-header code {
    color: #ffffff !important;
    background: rgba(0, 0, 0, .38);
    padding: .1rem .45rem;
    border-radius: .25rem;
    font-weight: 600;
}

/* Titre et sous-titre des entetes : blanc plein, jamais de gris. */
.card-header h1, .card-header h2, .card-header h3,
.card-header h4, .card-header h5, .card-header h6 {
    color: inherit;
}
