/*
 * campaign.withimpact.com — custom design layer over Bootstrap 5.
 * Goal: compact, dense, productive admin UI — not vanilla Bootstrap spacing.
 * This file only overrides tokens/utilities; it never replaces Bootstrap.
 */

[x-cloak] {
    display: none !important;
}

:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-light: #eef2ff;
    --surface: #ffffff;
    --surface-muted: #f8f9fc;
    --border-color: #e6e8f0;
    --text-strong: #1c1f2a;
    --text-muted: #6b7280;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
    --sidebar-w: 240px;
    --topbar-h: 56px;
    --gap-tight: .5rem;
}

* {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: .875rem;
    color: var(--text-strong);
    background: var(--surface-muted);
}

/* ---------- Compact spacing overrides ---------- */
/* Bootstrap defaults are generous; tighten globally for information density. */

.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-body {
    padding: 1rem 1.1rem;
}

.card + .card,
.row > * > .card {
    margin-bottom: 0;
}

.form-label {
    margin-bottom: .3rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control,
.form-select {
    padding: .45rem .7rem;
    font-size: .875rem;
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .15rem rgba(79, 70, 229, .15);
}

.mb-3 {
    margin-bottom: .85rem !important;
}

.btn {
    padding: .45rem .9rem;
    font-size: .85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: .3rem .6rem;
    font-size: .78rem;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.table {
    font-size: .82rem;
}

.table > :not(caption) > * > * {
    padding: .55rem .75rem;
}

.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    border-bottom-width: 1px;
    background: var(--surface-muted);
}

.badge {
    font-weight: 600;
    padding: .3em .55em;
    border-radius: 999px;
}

.alert {
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    font-size: .85rem;
}

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.modal-header,
.modal-footer {
    padding: .85rem 1.25rem;
    border-color: var(--border-color);
}

.modal-body {
    padding: 1.1rem 1.25rem;
}

.offcanvas {
    box-shadow: var(--shadow-md);
}

.offcanvas-header,
.offcanvas-body {
    padding: 1rem 1.25rem;
}

/* ---------- App shell ---------- */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--text-strong);
    color: #cfd3e6;
    display: flex;
    flex-direction: column;

    /* Off-canvas on mobile: fixed drawer, hidden until toggled open. */
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .2s ease;
}

.app-sidebar.is-open {
    transform: translateX(0);
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 26, .45);
    z-index: 1035;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: static;
        transform: none;
    }

    .app-sidebar-backdrop {
        display: none;
    }
}

.app-sidebar .app-logo {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.app-sidebar .app-nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem .6rem;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .7rem;
    border-radius: var(--radius-sm);
    color: #cfd3e6;
    font-size: .83rem;
    font-weight: 500;
    margin-bottom: .15rem;
}

.app-sidebar .nav-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.app-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: var(--brand);
    color: #fff;
}

.app-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: var(--topbar-h);
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-main {
    flex: 1;
    padding: .85rem;
    min-width: 0;
}

@media (min-width: 992px) {
    .app-main {
        padding: 1.25rem;
    }
}

.app-topbar {
    padding: 0 .85rem;
}

@media (min-width: 992px) {
    .app-topbar {
        padding: 0 1.25rem;
    }
}

/* Any wide content (tables, forms) scrolls within its own card instead
   of forcing the whole page to overflow horizontally. */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* ---------- Skeleton loader ---------- */

.x-skeleton {
    display: block;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #eceef4 25%, #f6f7fb 37%, #eceef4 63%);
    background-size: 400% 100%;
    animation: x-skeleton-shimmer 1.4s ease infinite;
}

@keyframes x-skeleton-shimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

/* ---------- Auth pages ---------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-muted);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem 1.75rem;
}

.auth-card .brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-strong);
    margin-bottom: .25rem;
}

.auth-card .subtitle {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ---------- Utility tightening ---------- */

.gap-tight {
    gap: var(--gap-tight) !important;
}

.text-muted-sm {
    font-size: .78rem;
    color: var(--text-muted);
}
