/* =========================================================================
   THEME GML Vente — Design pro & moderne
   ========================================================================= */

:root {
    /* Palette */
    --gml-primary: #4f46e5;
    --gml-primary-dark: #3730a3;
    --gml-primary-light: #818cf8;
    --gml-secondary: #0ea5e9;
    --gml-success: #10b981;
    --gml-warning: #f59e0b;
    --gml-danger: #ef4444;
    --gml-info: #06b6d4;
    --gml-dark: #0f172a;
    --gml-darker: #020617;
    --gml-light: #f8fafc;
    --gml-muted: #64748b;

    /* Surfaces */
    --gml-bg: #f1f5f9;
    --gml-surface: #ffffff;
    --gml-surface-2: #f8fafc;
    --gml-border: #e2e8f0;

    /* Effects */
    --gml-radius: 14px;
    --gml-radius-sm: 10px;
    --gml-radius-lg: 22px;
    --gml-shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
    --gml-shadow: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
    --gml-shadow-lg: 0 18px 40px rgba(15,23,42,.12), 0 6px 12px rgba(15,23,42,.06);
    --gml-shadow-glow: 0 0 0 4px rgba(79,70,229,.15);

    /* Gradients */
    --gml-gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #ec4899 100%);
    --gml-gradient-cool: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --gml-gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gml-gradient-warning: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gml-gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #334155 100%);
    --gml-gradient-bg: radial-gradient(1200px 600px at -10% -10%, rgba(99,102,241,.08), transparent 60%),
                       radial-gradient(900px 500px at 110% 20%, rgba(14,165,233,.08), transparent 60%),
                       linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);

    /* Typo */
    --gml-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Layout */
    --gml-sidebar-w: 250px;
    --gml-topbar-h: 64px;
}

/* ----------------- Base ----------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: var(--gml-font);
    background: var(--gml-gradient-bg);
    color: #0f172a;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------- Topbar ----------------- */
.gml-topbar {
    height: var(--gml-topbar-h);
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--gml-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
    box-shadow: 0 1px 0 rgba(15,23,42,.03);
}
.gml-topbar .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    font-weight: 700;
    color: var(--gml-dark);
    font-size: 1.08rem;
    letter-spacing: .2px;
}
.gml-topbar .brand .brand-mark {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--gml-gradient-primary);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(79,70,229,.35);
    overflow: hidden;
}
.gml-topbar .brand .brand-mark.brand-mark-img { background: #fff; padding: 2px; }
.gml-topbar .brand .brand-mark.brand-mark-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.gml-topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* ----------------- POS PDV switcher (topbar) ----------------- */
.pos-pdv-switch { position: relative; margin-left: .35rem; }
.pos-pdv-switch__btn {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(99,102,241,.20);
    background: linear-gradient(135deg, rgba(99,102,241,.10), rgba(14,165,233,.10));
    color: #4f46e5;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.pos-pdv-switch__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -10px rgba(79,70,229,.55);
    border-color: rgba(99,102,241,.45);
}
.pos-pdv-switch__btn.is-active {
    background: var(--gml-gradient-primary, linear-gradient(135deg,#6366f1,#0ea5e9));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px -6px rgba(79,70,229,.55);
}
.pos-pdv-switch__btn::after { display: none !important; } /* kill bootstrap caret */
.pos-pdv-switch__dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff;
}

.pos-pdv-switch__menu {
    width: 420px;
    max-width: calc(100vw - 24px);
    padding: 0;
    border: 1px solid rgba(15,23,42,.08);
    border-radius: 18px;
    overflow: hidden;
    margin-top: .5rem !important;
    background: #fff;
    box-shadow: 0 24px 50px -18px rgba(15,23,42,.30), 0 8px 18px -10px rgba(15,23,42,.18) !important;
}
.pos-pdv-switch__head {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1.1rem;
    background: var(--gml-gradient-primary, linear-gradient(135deg,#6366f1,#0ea5e9));
    color: #fff;
}
.pos-pdv-switch__head > i {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: rgba(255,255,255,.20);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.pos-pdv-switch__title { font-weight: 700; font-size: 1rem; line-height: 1.15; }
.pos-pdv-switch__sub   { font-size: .75rem; opacity: .88; }

.pos-pdv-switch__search {
    position: relative;
    padding: .75rem .85rem;
    border-bottom: 1px solid rgba(15,23,42,.06);
    background: #f8fafc;
}
.pos-pdv-switch__search i {
    position: absolute; left: 1.4rem; top: 50%; transform: translateY(-50%);
    color: #94a3b8; font-size: .9rem;
    pointer-events: none;
}
.pos-pdv-switch__search input {
    width: 100%;
    border: 1px solid rgba(15,23,42,.10);
    background: #fff;
    border-radius: 999px;
    padding: .5rem .9rem .5rem 2.2rem;
    font-size: .9rem;
    outline: 0;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pos-pdv-switch__search input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}

.pos-pdv-switch__list {
    max-height: 380px;
    overflow-y: auto;
    padding: .5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}
.pos-pdv-switch__list::-webkit-scrollbar { width: 8px; }
.pos-pdv-switch__list::-webkit-scrollbar-thumb { background: rgba(15,23,42,.18); border-radius: 99px; }

.pos-pdv-switch .pos-pdv-switch__item,
.pos-pdv-switch .pos-pdv-switch__item:hover,
.pos-pdv-switch .pos-pdv-switch__item:focus,
.pos-pdv-switch .pos-pdv-switch__item:active {
    text-decoration: none !important;
    color: #0f172a !important;
}
.pos-pdv-switch__item {
    display: flex !important;
    align-items: center;
    gap: .65rem;
    padding: .65rem .7rem !important;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid rgba(15,23,42,.06);
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
    min-width: 0;
    cursor: pointer;
}
.pos-pdv-switch__item:hover {
    background: #fff;
    border-color: rgba(99,102,241,.35);
    box-shadow: 0 10px 22px -12px rgba(79,70,229,.45);
    transform: translateY(-1px);
}
.pos-pdv-switch__item.is-current {
    background: linear-gradient(135deg, rgba(34,197,94,.12), rgba(16,185,129,.10));
    border-color: rgba(34,197,94,.40);
}
.pos-pdv-switch__item-icon {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: var(--gml-gradient-primary, linear-gradient(135deg,#6366f1,#0ea5e9));
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1.05rem;
    box-shadow: 0 6px 14px -6px rgba(79,70,229,.50);
}
.pos-pdv-switch__item.is-current .pos-pdv-switch__item-icon {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 6px 14px -6px rgba(22,163,74,.55);
}
.pos-pdv-switch__item-body {
    display: flex; flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}
.pos-pdv-switch__item-name {
    font-weight: 600;
    font-size: .9rem;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-pdv-switch__item-meta {
    font-size: .72rem;
    color: var(--gml-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.pos-pdv-switch__item-check {
    color: #16a34a;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.pos-pdv-switch__empty {
    text-align: center;
    color: var(--gml-muted, #64748b);
    padding: 1.25rem;
    font-size: .88rem;
}

@media (max-width: 575.98px) {
    .pos-pdv-switch__list { grid-template-columns: 1fr; }
}

.gml-user {
    display: flex; align-items: center; gap: .65rem;
    padding: .35rem .65rem .35rem .35rem;
    border-radius: 999px;
    background: var(--gml-surface);
    border: 1px solid var(--gml-border);
    cursor: pointer;
    transition: all .2s ease;
}
.gml-user:hover { box-shadow: var(--gml-shadow); border-color: #cbd5e1; }
.gml-avatar {
    width: 32px; height: 32px;
    border-radius: 999px;
    background: var(--gml-gradient-cool);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .85rem;
}
.gml-user .name { font-size: .9rem; color: #0f172a; }
.gml-user .role { font-size: .72rem; color: var(--gml-muted); display: block; margin-top: -2px; }

/* ----------------- Page header ----------------- */
.gml-page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
    margin-bottom: 1.5rem;
}
.gml-page-header h1 {
    font-size: 1.55rem; font-weight: 700; margin: 0;
    background: var(--gml-gradient-primary);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.gml-page-header .subtitle { color: var(--gml-muted); margin: .25rem 0 0; font-size: .92rem; }

/* ----------------- Cards ----------------- */
.card {
    border: 1px solid var(--gml-border);
    border-radius: var(--gml-radius);
    background: var(--gml-surface);
    box-shadow: var(--gml-shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover { box-shadow: var(--gml-shadow); }

/* Module card (page d'accueil) */
.module-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--gml-radius-lg);
    padding: 1.5rem 1.25rem;
    background: var(--gml-surface);
    border: 1px solid var(--gml-border);
    box-shadow: var(--gml-shadow-sm);
    transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .25s;
    text-decoration: none; color: inherit;
    display: block;
    isolation: isolate;
}
.module-card::before {
    content: "";
    position: absolute; inset: 0;
    background: var(--module-gradient, var(--gml-gradient-primary));
    opacity: 0;
    transition: opacity .35s;
    z-index: -1;
}
.module-card::after {
    content: "";
    position: absolute;
    top: -60px; right: -60px;
    width: 180px; height: 180px;
    background: var(--module-gradient, var(--gml-gradient-primary));
    opacity: .12;
    border-radius: 50%;
    transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .35s;
    z-index: -1;
}
.module-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--gml-shadow-lg);
    border-color: transparent;
    color: #fff;
}
.module-card:hover::before { opacity: 1; }
.module-card:hover::after { transform: scale(2.2); opacity: .25; }
.module-card:hover .module-icon { background: rgba(255,255,255,.2); color: #fff; }
.module-card:hover .module-arrow { transform: translateX(4px); opacity: 1; }
.module-card:hover .module-desc { color: rgba(255,255,255,.9); }
.module-card:hover .module-title { color: #fff; }

.module-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.7rem;
    background: var(--module-tint, #eef2ff);
    color: var(--module-color, var(--gml-primary));
    margin-bottom: 1rem;
    transition: all .35s;
}
.module-title { font-weight: 700; font-size: 1.05rem; margin: 0 0 .25rem; color: var(--gml-dark); }
.module-desc { font-size: .85rem; color: var(--gml-muted); margin: 0; min-height: 2.4em; }
.module-arrow {
    position: absolute; right: 1.25rem; bottom: 1.25rem;
    opacity: .4; transition: all .25s;
    font-size: 1.1rem;
}

/* Stagger animation pour la grille */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.module-card { animation: fadeUp .5s cubic-bezier(.2,.8,.2,1) both; }
.module-card:nth-child(1) { animation-delay: .02s; }
.module-card:nth-child(2) { animation-delay: .07s; }
.module-card:nth-child(3) { animation-delay: .12s; }
.module-card:nth-child(4) { animation-delay: .17s; }
.module-card:nth-child(5) { animation-delay: .22s; }
.module-card:nth-child(6) { animation-delay: .27s; }
.module-card:nth-child(7) { animation-delay: .32s; }
.module-card:nth-child(8) { animation-delay: .37s; }

/* Couleurs de modules */
.module-card[data-color="primary"]   { --module-color: #4f46e5; --module-tint: #eef2ff; --module-gradient: linear-gradient(135deg,#4f46e5,#7c3aed); }
.module-card[data-color="success"]   { --module-color: #10b981; --module-tint: #ecfdf5; --module-gradient: linear-gradient(135deg,#10b981,#059669); }
.module-card[data-color="warning"]   { --module-color: #f59e0b; --module-tint: #fffbeb; --module-gradient: linear-gradient(135deg,#f59e0b,#ef4444); }
.module-card[data-color="info"]      { --module-color: #06b6d4; --module-tint: #ecfeff; --module-gradient: linear-gradient(135deg,#06b6d4,#3b82f6); }
.module-card[data-color="danger"]    { --module-color: #ef4444; --module-tint: #fef2f2; --module-gradient: linear-gradient(135deg,#ef4444,#db2777); }
.module-card[data-color="secondary"] { --module-color: #64748b; --module-tint: #f1f5f9; --module-gradient: linear-gradient(135deg,#475569,#0f172a); }
.module-card[data-color="dark"]      { --module-color: #0f172a; --module-tint: #e2e8f0; --module-gradient: linear-gradient(135deg,#0f172a,#334155); }

/* ----------------- Buttons ----------------- */
.btn { border-radius: 10px; font-weight: 500; transition: all .2s; }
.btn-primary {
    background: var(--gml-gradient-primary);
    border: 0;
    box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(79,70,229,.45); }
.btn-primary:active { transform: translateY(0); }

/* ----------------- Forms ----------------- */
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid var(--gml-border);
    padding: .65rem .9rem;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gml-primary);
    box-shadow: var(--gml-shadow-glow);
}
.input-group-text {
    background: var(--gml-surface-2);
    border: 1px solid var(--gml-border);
    border-radius: 10px 0 0 10px;
    color: var(--gml-muted);
}
.input-group > .form-control:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.form-label { font-weight: 500; font-size: .88rem; color: #334155; margin-bottom: .35rem; }

/* ----------------- Alerts ----------------- */
.alert { border-radius: 12px; border: 0; padding: .85rem 1rem; box-shadow: var(--gml-shadow-sm); }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info { background: #eff6ff; color: #1e40af; }

/* ----------------- Dropdown ----------------- */
.dropdown-menu {
    border: 1px solid var(--gml-border);
    border-radius: var(--gml-radius-sm);
    box-shadow: var(--gml-shadow-lg);
    padding: .35rem;
}
.dropdown-item { border-radius: 8px; padding: .55rem .75rem; font-size: .9rem; }
.dropdown-item:hover { background: var(--gml-surface-2); }

/* ----------------- Login page ----------------- */
.gml-login-bg {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(124,58,237,.4), transparent 40%),
        radial-gradient(circle at 80% 30%, rgba(14,165,233,.35), transparent 45%),
        radial-gradient(circle at 50% 90%, rgba(236,72,153,.3), transparent 50%),
        linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
    position: relative;
    overflow: hidden;
}
.gml-login-bg::before, .gml-login-bg::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .5;
    animation: floatY 12s ease-in-out infinite;
}
.gml-login-bg::before { width: 480px; height: 480px; top: -120px; left: -120px; background: #6366f1; }
.gml-login-bg::after  { width: 420px; height: 420px; bottom: -140px; right: -120px; background: #ec4899; animation-delay: -6s; }

.gml-login-card {
    max-width: 440px;
    width: 100%;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.4);
    box-shadow: 0 25px 70px rgba(0,0,0,.35);
    overflow: hidden;
    animation: cardIn .55s cubic-bezier(.2,.8,.2,1) both;
}
.gml-login-head {
    text-align: center;
    padding: 2rem 1.25rem 1.25rem;
    background: var(--gml-gradient-primary);
    color: #fff;
    position: relative;
}
.gml-login-head::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px; height: 24px;
    background: rgba(255,255,255,.92);
    clip-path: ellipse(70% 100% at 50% 100%);
}
.gml-login-logo {
    width: 70px; height: 70px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem;
    margin-bottom: .65rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    animation: pulseLogo 3s ease-in-out infinite;
}
.gml-login-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: .3px; }
.gml-login-head p { margin: .15rem 0 0; opacity: .9; font-size: .88rem; }
.gml-login-body { padding: 1.5rem 1.5rem 1.75rem; }
.gml-login-foot { text-align: center; padding: .9rem 1rem; color: var(--gml-muted); font-size: .8rem; background: var(--gml-surface-2); border-top: 1px solid var(--gml-border); }

/* ----------------- Animations ----------------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes floatY {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-30px); }
}
@keyframes pulseLogo {
    0%,100% { transform: scale(1); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
    50%     { transform: scale(1.05); box-shadow: 0 10px 30px rgba(0,0,0,.28); }
}
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

/* ----------------- Utility ----------------- */
.text-gradient {
    background: var(--gml-gradient-primary);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.glass {
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.4);
}
.gml-empty {
    text-align: center; padding: 3rem 1rem;
    color: var(--gml-muted);
}
.gml-empty i { font-size: 3rem; color: #cbd5e1; }

/* ----------------- Responsive ----------------- */
@media (max-width: 768px) {
    .gml-page-header h1 { font-size: 1.3rem; }
    .module-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .85rem; }
    .module-icon { width: 48px; height: 48px; font-size: 1.4rem; }
    .gml-user .name, .gml-user .role { display: none; }
}
