/* ============================================================
   Social AI Manager — v0.2
   Thème A : bleu SaaS pro
   ============================================================ */
:root {
    --sam-primary: #1e40af;
    --sam-primary-light: #3b82f6;
    --sam-accent: #10b981;
    --sam-sidebar-bg: #0f172a;
    --sam-sidebar-text: #cbd5e1;
    --sam-sidebar-hover: #1e293b;
    --sam-sidebar-active: #1e40af;
    --sam-bg: #f8fafc;
    --sam-text: #0f172a;
    --sam-muted: #64748b;
    --sam-border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--sam-bg);
    color: var(--sam-text);
}

/* ---------- Layout ---------- */
.sam-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sam-sidebar {
    width: 260px;
    background: var(--sam-sidebar-bg);
    color: var(--sam-sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    flex-shrink: 0;
}

.sam-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid #1e293b;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    letter-spacing: -.02em;
}

.sam-brand-logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-accent));
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: #fff;
}

.sam-nav {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sam-nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.5rem;
    color: var(--sam-sidebar-text);
    text-decoration: none;
    font-size: .92rem;
    transition: background .15s, color .15s;
}

.sam-nav-item:hover {
    background: var(--sam-sidebar-hover);
    color: #fff;
}

.sam-nav-item.active {
    background: var(--sam-sidebar-active);
    color: #fff;
    border-left: 3px solid var(--sam-accent);
    padding-left: calc(1.5rem - 3px);
}

.sam-nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sam-nav-divider {
    height: 1px;
    background: #1e293b;
    margin: 1rem 1.5rem;
}

/* ---------- Main ---------- */
.sam-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sam-topbar {
    background: #fff;
    border-bottom: 1px solid var(--sam-border);
    padding: .85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.sam-topbar h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.sam-topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sam-lang-form select {
    border: 1px solid var(--sam-border);
    border-radius: 6px;
    padding: .35rem .6rem;
    background: #fff;
    font-size: .85rem;
    color: var(--sam-text);
}

.sam-user-badge {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .8rem;
    border-radius: 999px;
    background: var(--sam-bg);
    font-size: .85rem;
}

.sam-user-badge .avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-accent));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: .75rem;
}

.sam-content {
    padding: 2rem;
    flex: 1;
}

/* ---------- Cards ---------- */
.sam-welcome {
    margin-bottom: 2rem;
}
.sam-welcome h1 {
    margin: 0 0 .35rem;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.02em;
}
.sam-welcome p {
    margin: 0;
    color: var(--sam-muted);
    font-size: .95rem;
}

.sam-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.sam-stat-card {
    background: #fff;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    padding: 1.25rem;
    transition: box-shadow .2s, transform .2s;
}
.sam-stat-card:hover {
    box-shadow: 0 4px 12px rgba(15,23,42,.06);
    transform: translateY(-2px);
}
.sam-stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--sam-primary);
    line-height: 1;
    margin-bottom: .35rem;
}
.sam-stat-label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--sam-muted);
    font-weight: 600;
}

/* ---------- Table ---------- */
.sam-card {
    background: #fff;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    overflow: hidden;
}
.sam-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--sam-border);
    font-weight: 600;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sam-card-body { padding: 1.25rem; }

.sam-org-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 0;
    border-bottom: 1px solid var(--sam-border);
}
.sam-org-row:last-child { border-bottom: none; }
.sam-org-row .name {
    font-weight: 600;
    margin-bottom: .15rem;
}
.sam-org-row .meta {
    font-size: .8rem;
    color: var(--sam-muted);
}
.sam-org-row .meta code {
    background: var(--sam-bg);
    padding: .1rem .4rem;
    border-radius: 4px;
    font-size: .75rem;
    color: var(--sam-primary);
}

.sam-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--sam-muted);
}
.sam-empty .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: .5;
}

.sam-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1.1rem;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border .15s;
}
.sam-btn-primary {
    background: var(--sam-primary);
    color: #fff;
}
.sam-btn-primary:hover { background: #1e3a8a; }
.sam-btn-ghost {
    background: transparent;
    border-color: var(--sam-border);
    color: var(--sam-text);
}
.sam-btn-ghost:hover { background: var(--sam-bg); }

/* ---------- Login ---------- */
.sam-login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    padding: 1rem;
}
.sam-login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.sam-login-logo {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--sam-primary), var(--sam-accent));
    border-radius: 12px;
    display: grid; place-items: center;
    color: #fff; font-size: 1.3rem;
    margin-bottom: 1.5rem;
}
.sam-login-card h1 {
    margin: 0 0 .35rem;
    font-size: 1.4rem;
    font-weight: 700;
}
.sam-login-card p.subtitle {
    margin: 0 0 1.75rem;
    color: var(--sam-muted);
    font-size: .9rem;
}
.sam-login-card label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--sam-text);
}
.sam-login-card input {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1rem;
    transition: border .15s, box-shadow .15s;
}
.sam-login-card input:focus {
    outline: none;
    border-color: var(--sam-primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}
.sam-login-card button {
    width: 100%;
    padding: .8rem;
    background: var(--sam-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.sam-login-card button:hover { background: #1e3a8a; }
.sam-login-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .85rem;
    margin-bottom: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sam-sidebar { width: 70px; }
    .sam-sidebar .label,
    .sam-brand span { display: none; }
    .sam-nav-item { justify-content: center; padding: .8rem; }
    .sam-content { padding: 1rem; }
    .sam-topbar { padding: .75rem 1rem; }
}
