/* ============================================================
   style.css -- Styles globaux CRM Multimodule
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --clr-primary:   #1a3a5c;
    --clr-primary-h: #122b47;
    --clr-accent:    #2d7dd2;
    --clr-bg:        #f0f2f5;
    --clr-surface:   #ffffff;
    --clr-border:    #d8dde3;
    --clr-text:      #1c2536;
    --clr-muted:     #6b7a90;
    --clr-danger:    #c0392b;
    --clr-success:   #1a7a4a;
    --radius:        8px;
    --shadow:        0 4px 24px rgba(0,0,0,.08);
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Page login ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--clr-surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-card__header {
    background: var(--clr-primary);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}

.login-card__logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.6rem;
}

.login-card__title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.login-card__subtitle {
    color: rgba(255,255,255,.6);
    font-size: .8rem;
}

.login-card__body { padding: 1.75rem 2rem 2rem; }

/* Alertes */
.alert {
    border-radius: var(--radius);
    padding: .65rem 1rem;
    font-size: .85rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.alert--danger  { background: #fdf0ef; color: var(--clr-danger); border: 1px solid #f5c6c3; }
.alert--info    { background: #eef4fc; color: #1a5fa8; border: 1px solid #bcd4f0; }
.alert--success { background: #edfaf4; color: var(--clr-success); border: 1px solid #a3dfbf; }

/* Formulaire */
.field { margin-bottom: 1rem; }

.field__label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--clr-muted);
    margin-bottom: .35rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.field__wrap { position: relative; }

.field__icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--clr-muted);
    pointer-events: none;
    font-size: 1rem;
}

.field__input {
    width: 100%;
    padding: .65rem .75rem .65rem 2.4rem;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    font-size: .95rem;
    color: var(--clr-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.field__input:focus {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 3px rgba(45,125,210,.15);
}

.field__input.is-invalid { border-color: var(--clr-danger); }

.field__toggle-pw {
    position: absolute;
    right: .65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--clr-muted);
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}
.field__toggle-pw:hover { color: var(--clr-text); }

/* Lien "oublié" */
.link-forgot {
    display: inline-block;
    font-size: .8rem;
    color: var(--clr-accent);
    text-decoration: none;
    margin-top: -.2rem;
    margin-bottom: 1.1rem;
    float: right;
}
.link-forgot:hover { text-decoration: underline; }

/* Bouton principal */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .75rem;
    background: var(--clr-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    clear: both;
}
.btn-primary:hover   { background: var(--clr-primary-h); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* Pied de carte */
.login-card__footer {
    border-top: 1px solid var(--clr-border);
    padding: .7rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .75rem;
    color: var(--clr-muted);
}

/* ---- Dashboard ---- */
.dashboard-page { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--clr-primary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar__brand {
    padding: 1.5rem 1.25rem 1rem;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar__nav { flex: 1; padding: 1rem 0; }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
    border-radius: 0;
}
.sidebar__link:hover,
.sidebar__link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.sidebar__footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.1);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.topbar__title { font-weight: 600; font-size: 1rem; }

.topbar__user {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .85rem;
    color: var(--clr-muted);
}

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--clr-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.content { flex: 1; padding: 2rem; overflow-y: auto; }

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.module-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--clr-text);
    transition: box-shadow .15s, transform .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}
.module-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.module-card__icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #eef4fc;
    color: var(--clr-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}

.module-card__label { font-weight: 600; font-size: .95rem; }

/* Animation chargement */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin .8s linear infinite; }

/* Responsive */
@media (max-width: 640px) {
    .login-card__body { padding: 1.25rem; }
    .sidebar { width: 60px; }
    .sidebar__brand, .sidebar__link span, .sidebar__footer { display: none; }
}
