/*
 * Dev Geek — global modern theme layer.
 *
 * Loaded once, from resources/views/layouts/app.blade.php, so every
 * authenticated module (Tracking, PwaInstaller, MarketingHub, and all
 * others sharing this layout) picks it up automatically. This is a pure
 * CSS re-skin of the existing AdminLTE component classes already used
 * app-wide (.box, .btn, .table, .form-control, .label, .nav-tabs,
 * .pagination, .modal, .alert) — no HTML/Blade markup, no JS, no class
 * name is renamed or removed anywhere, so nothing that already works can
 * break. Do not duplicate these rules inline in individual module views;
 * extend this file instead so every module stays visually consistent.
 *
 * Sidebar/top navbar structural layout is intentionally left untouched
 * in this pass (high blast radius, needs visual QA in a real browser).
 */

:root {
    --dg-primary: #6366f1;
    --dg-primary-dark: #4f46e5;
    --dg-accent: #3b82f6;
    --dg-accent-dark: #2563eb;
    --dg-text: #1e1e1e;
    --dg-text-muted: #6b7280;
    --dg-border: #e5e7eb;
    --dg-bg-soft: #f8f9fb;
    --dg-radius: .75rem;
    --dg-radius-sm: .5rem;
    --dg-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --dg-shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
}

/* ---- page header ---- */
.content-header {
    padding: 18px 15px 8px;
}

.content-header > h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dg-text);
    margin: 0 0 4px;
}

.content-header > h1 > small {
    font-size: 13px;
    color: var(--dg-text-muted);
    font-weight: 400;
}

/* ---- box / panel (the app's main "card" component) ---- */
.box {
    border-radius: var(--dg-radius);
    border: 1px solid var(--dg-border);
    box-shadow: var(--dg-shadow);
}

.box.box-solid {
    border: 1px solid var(--dg-border);
}

.box-header {
    padding: 16px 18px;
}

.box-header.with-border {
    border-bottom: 1px solid var(--dg-border);
}

.box.box-solid > .box-header {
    border-radius: var(--dg-radius) var(--dg-radius) 0 0;
}

.box-title {
    font-weight: 600;
    color: var(--dg-text);
}

.box-body {
    padding: 18px;
}

.box-footer {
    border-top: 1px solid var(--dg-border);
    background: var(--dg-bg-soft);
    border-radius: 0 0 var(--dg-radius) var(--dg-radius);
}

/* ---- buttons ---- */
.btn {
    border-radius: var(--dg-radius-sm);
    font-weight: 500;
    transition: filter .15s ease, transform .05s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary,
.bg-navy,
.bg-primary {
    background: linear-gradient(to right, var(--dg-primary), var(--dg-accent)) !important;
    border-color: transparent !important;
}

.btn-primary:hover,
.btn-primary:focus {
    filter: brightness(0.95);
    background: linear-gradient(to right, var(--dg-primary-dark), var(--dg-accent-dark)) !important;
}

.btn-flat {
    border-radius: var(--dg-radius-sm);
}

/* ---- forms ---- */
.form-control,
select.form-control,
textarea.form-control {
    border-radius: var(--dg-radius-sm);
    border: 1px solid #d1d5da;
    box-shadow: none;
}

.form-control:focus {
    border-color: var(--dg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

/* ---- tables ---- */
.table > thead > tr > th {
    border-bottom: 2px solid var(--dg-border);
    color: var(--dg-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .02em;
    font-weight: 600;
}

.table > tbody > tr > td {
    border-top: 1px solid var(--dg-border);
    vertical-align: middle;
}

.table-hover > tbody > tr:hover {
    background-color: var(--dg-bg-soft);
}

/* DataTables wrapper controls (search box, length select, pagination) */
div.dataTables_wrapper .dataTables_filter input,
div.dataTables_wrapper .dataTables_length select {
    border-radius: var(--dg-radius-sm);
    border: 1px solid #d1d5da;
}

/* ---- Phase 2.3 : defilement horizontal des tableaux trop larges ----
 * Correctif global volontairement minimal : ~60% des tableaux de
 * l'application ne sont pas enveloppes dans .table-responsive, ce qui les
 * fait deborder de la page sur petit ecran au lieu de defiler proprement
 * dans leur propre zone. Plutot que modifier individuellement 100+
 * fichiers Blade (gros chantier, aucune verification visuelle possible de
 * mon cote), on active le defilement horizontal sur les conteneurs qui
 * enveloppent la grande majorite des tableaux existants.
 *
 * Limite connue : un menu deroulant (.dropdown-menu, ex. actions d'une
 * ligne de tableau) positionne pres du bord droit d'un de ces conteneurs
 * peut se retrouver partiellement coupe si le tableau deborde reellement
 * a cet endroit precis. C'est un compromis assume pour eviter de toucher
 * a des centaines de fichiers sans pouvoir verifier le rendu ; a corriger
 * au cas par cas si un tel probleme est repere en usage reel.
 */
.box-body,
.content > .row {
    overflow-x: auto;
}

/* ---- badges / labels ---- */
.label {
    border-radius: 9999px;
    padding: .3em .8em;
    font-weight: 600;
}

.badge {
    border-radius: 9999px;
}

/* ---- tabs ---- */
.nav-tabs > li > a {
    border-radius: var(--dg-radius-sm) var(--dg-radius-sm) 0 0;
    color: var(--dg-text-muted);
    font-weight: 500;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: var(--dg-primary);
    border-top: 2px solid var(--dg-primary);
}

/* ---- pagination ---- */
.pagination > li > a,
.pagination > li > span {
    border-radius: var(--dg-radius-sm);
    margin: 0 2px;
    color: var(--dg-text);
    border-color: var(--dg-border);
}

.pagination > .active > a,
.pagination > .active > span {
    background: var(--dg-primary);
    border-color: var(--dg-primary);
}

/* ---- alerts ---- */
.alert {
    border-radius: var(--dg-radius-sm);
    border: 1px solid transparent;
}

/* ---- modals ---- */
.modal-content {
    border-radius: var(--dg-radius);
    border: none;
    box-shadow: var(--dg-shadow-md);
}

.modal-header {
    border-bottom: 1px solid var(--dg-border);
    border-radius: var(--dg-radius) var(--dg-radius) 0 0;
}

.modal-footer {
    border-top: 1px solid var(--dg-border);
}

/* ---- small-box / info-box (dashboard stat tiles) ---- */
.small-box,
.info-box {
    border-radius: var(--dg-radius);
    box-shadow: var(--dg-shadow);
}

/* ---- Phase 2.2 : sous-navigation de module commune ----
 * Markup fourni par resources/views/components/module_nav.blade.php et
 * module_nav_item.blade.php. Generalise a partir du composant deja
 * construit pour le module Repair (classes repair-module-nav__*), qui
 * reste inchange (il utilise toujours ses propres classes) — ce bloc ne
 * fait que rendre le meme habillage disponible a tous les autres modules
 * via les nouvelles classes dg-module-nav__*, sans jamais toucher a
 * repair-module-nav__* existant.
 */
.dg-module-shell {
    padding: 8px 0 16px;
}

.dg-module-nav {
    margin: 10px 15px 14px;
    padding: 12px 16px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
    box-shadow: var(--dg-shadow-md);
}

.dg-module-nav__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: nowrap;
}

.dg-module-nav__brand {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    flex: 0 0 auto;
}

.dg-module-nav__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--dg-primary), var(--dg-accent-dark));
    color: #fff;
    font-size: 16px;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
    flex: 0 0 auto;
    text-decoration: none !important;
}

.dg-module-nav__icon:hover,
.dg-module-nav__icon:focus,
.dg-module-nav__icon.is-active {
    color: #fff;
    transform: translateY(-1px);
}

.dg-module-nav__links {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.dg-module-nav__links::-webkit-scrollbar {
    height: 5px;
}

.dg-module-nav__links::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 999px;
}

.dg-module-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all .2s ease;
    white-space: nowrap;
    flex: 0 0 auto;
}

.dg-module-nav__link-label--icon-only {
    display: none;
}

.dg-module-nav__link:hover,
.dg-module-nav__link:focus {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.18);
}

.dg-module-nav__link.is-active {
    background: linear-gradient(135deg, var(--dg-primary), var(--dg-accent-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.14);
}

@media (max-width: 767px) {
    .dg-module-nav {
        margin-left: 10px;
        margin-right: 10px;
    }

    .dg-module-nav__row {
        flex-wrap: wrap;
    }

    .dg-module-nav__brand,
    .dg-module-nav__links {
        width: 100%;
    }

    .dg-module-nav__links {
        justify-content: flex-start;
    }
}
