/* =====================================================================
   LinkedIn-inspired theme on top of Bootstrap 5.3
   ===================================================================== */
:root {
    --li-blue: #0a66c2;
    --li-blue-dark: #004182;
    --li-blue-soft: #e8f1fb;
    --li-bg: #f4f2ee;
    --li-card: #ffffff;
    --li-border: #e0dfdc;
    --li-text: #191919;
    --li-muted: #666666;
    --li-green: #057642;
    --li-red: #cc1016;
    --sidebar-w: 248px;
    --topbar-h: 56px;

    --bs-primary: var(--li-blue);
    --bs-primary-rgb: 10, 102, 194;
    --bs-success: var(--li-green);
    --bs-success-rgb: 5, 118, 66;
    --bs-danger: var(--li-red);
    --bs-danger-rgb: 204, 16, 22;
    --bs-link-color: var(--li-blue);
    --bs-link-color-rgb: 10, 102, 194;
    --bs-link-hover-color: var(--li-blue-dark);
    --bs-link-hover-color-rgb: 0, 65, 130;
    /* --bs-body-bg stays white: cards, inputs, dropdowns and modals inherit it. Only <body> gets the LinkedIn grey. */
    --bs-body-color: var(--li-text);
    --bs-secondary-color: var(--li-muted);
    --bs-border-color: var(--li-border);
    --bs-border-radius: .5rem;
    --bs-body-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    --bs-body-font-size: .9375rem;
}

body { background: var(--li-bg); color: var(--li-text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .sidebar-link:hover, .nav-link:hover, .stat-card:hover, .dropdown-item:hover { text-decoration: none; }
h4, .h4 { font-weight: 600; font-size: 1.35rem; }
.text-muted { color: var(--li-muted) !important; }
.min-w-0 { min-width: 0; }

/* ---------------------------------------------------------------- Shell */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    background: var(--li-card);
    border-right: 1px solid var(--li-border);
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .app-sidebar {
        position: fixed; top: 0; bottom: 0; left: 0;
        overflow: hidden; /* only the nav list scrolls; brand, profile and footer stay pinned */
        z-index: 1030;
    }
    .app-main { margin-left: var(--sidebar-w); }
}
@media (max-width: 991.98px) {
    .app-sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; }
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar-brand {
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--li-border);
    flex-shrink: 0;
}
.brand-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: var(--li-blue); color: #fff;
    border-radius: 6px;
    font-weight: 700; font-size: 1.25rem; letter-spacing: -1px;
    font-family: Arial, sans-serif;
}
.brand-logo.sm { width: 30px; height: 30px; font-size: 1.1rem; }
.brand-text { font-weight: 700; color: var(--li-text); font-size: 1.05rem; }

.sidebar-profile {
    display: flex; align-items: center; gap: .75rem; flex-shrink: 0;
    margin: .75rem 1rem .25rem; padding: .6rem .75rem;
    border: 1px solid var(--li-border); border-radius: .5rem;
    background: linear-gradient(180deg, #a0b4b7 0 22px, #fff 22px);
}
.profile-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    border: 2px solid #fff; object-fit: cover; flex-shrink: 0;
}
.profile-initials {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--li-blue); color: #fff; font-weight: 600;
}
.profile-name { font-weight: 600; font-size: .9rem; margin-top: 10px; }
.profile-status { font-size: .75rem; color: var(--li-muted); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

.sidebar-nav {
    padding: 0 .75rem .75rem; flex: 1; min-height: 0; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: #d0cfcc transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #d0cfcc; border-radius: 3px; }
.nav-section-title {
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    color: var(--li-muted); padding: .7rem .75rem .25rem;
}
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .45rem .75rem;
    border-radius: .375rem;
    color: #404040; font-weight: 500; font-size: .9rem;
    position: relative;
    transition: background .15s;
}
.sidebar-link i { font-size: 1.1rem; width: 20px; text-align: center; color: var(--li-muted); }
.sidebar-link:hover { background: #f3f2ef; color: var(--li-text); }
.sidebar-link.active { background: var(--li-blue-soft); color: var(--li-blue); font-weight: 600; }
.sidebar-link.active i { color: var(--li-blue); }
.sidebar-link.active::before {
    content: ""; position: absolute; left: -.75rem; top: 6px; bottom: 6px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--li-blue);
}
.sidebar-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; background: var(--li-blue); color: #fff;
    font-size: .7rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-badge.danger { background: var(--li-red); }

.sidebar-footer { border-top: 1px solid var(--li-border); padding: .5rem .75rem; flex-shrink: 0; }
.queue-pill {
    font-size: .75rem; padding: .4rem .75rem; margin-bottom: .25rem;
    border-radius: 1rem; background: #f3f2ef; color: var(--li-muted);
}
.queue-pill.warn { background: #fff4e5; color: #915907; }

/* ---------------------------------------------------------------- Topbar */
.app-topbar {
    height: var(--topbar-h);
    background: var(--li-card);
    border-bottom: 1px solid var(--li-border);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; font-size: 1rem; color: var(--li-muted); }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; font-size: .85rem; }
.btn-icon { border: 0; padding: .25rem .5rem; color: var(--li-muted); }
.btn-icon:hover { background: #f3f2ef; }

.app-content { padding: 1.5rem; flex: 1; max-width: 1600px; width: 100%; }

/* Page header rows wrap nicely on small screens */
.app-content > .d-flex.justify-content-between { flex-wrap: wrap; gap: .75rem; }

/* ---------------------------------------------------------------- Cards */
.card {
    --bs-card-border-color: var(--li-border);
    --bs-card-border-radius: .5rem;
    --bs-card-inner-border-radius: calc(.5rem - 1px);
    border: 1px solid var(--li-border);
    box-shadow: none;
}
.card-header {
    background: var(--li-card);
    font-weight: 600; font-size: .95rem;
    border-bottom-color: var(--li-border);
    padding: .85rem 1rem;
}
.card-footer { border-top-color: var(--li-border); }
.list-group { --bs-list-group-border-color: var(--li-border); }

/* Stat cards */
/* Accent colour comes from Bootstrap's border-start + border-{color} (themed via the --bs-*-rgb vars above). */
.stat-card {
    transition: box-shadow .15s, transform .15s;
    border-width: 1px !important; border-left-width: 4px !important;
    border-top-color: var(--li-border) !important; border-right-color: var(--li-border) !important; border-bottom-color: var(--li-border) !important;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); transform: translateY(-1px); }
.stat-card .card-body { display: block; color: inherit; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--li-text); }
.stat-card .stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--li-muted); font-weight: 600; }
.stat-card a { color: inherit; }

/* ---------------------------------------------------------------- Buttons (LinkedIn pill style) */
.btn { border-radius: 1.5rem; font-weight: 600; padding-left: 1rem; padding-right: 1rem; }
.btn-sm { padding: .3rem .85rem; font-size: .82rem; }
.btn-link { border-radius: .25rem; font-weight: 600; }
.btn-primary {
    --bs-btn-bg: var(--li-blue); --bs-btn-border-color: var(--li-blue);
    --bs-btn-hover-bg: var(--li-blue-dark); --bs-btn-hover-border-color: var(--li-blue-dark);
    --bs-btn-active-bg: #09223b; --bs-btn-active-border-color: #09223b;
    --bs-btn-disabled-bg: var(--li-blue); --bs-btn-disabled-border-color: var(--li-blue);
    --bs-btn-focus-shadow-rgb: 10, 102, 194;
}
.btn-outline-primary {
    --bs-btn-color: var(--li-blue); --bs-btn-border-color: var(--li-blue);
    --bs-btn-hover-bg: var(--li-blue-soft); --bs-btn-hover-color: var(--li-blue-dark); --bs-btn-hover-border-color: var(--li-blue-dark);
    --bs-btn-active-bg: #d0e2f7; --bs-btn-active-color: var(--li-blue-dark); --bs-btn-active-border-color: var(--li-blue-dark);
    border-width: 1px; box-shadow: inset 0 0 0 1px transparent;
}
.btn-outline-primary:hover { box-shadow: inset 0 0 0 1px var(--li-blue-dark); }
.btn-outline-secondary {
    --bs-btn-color: #5e5e5e; --bs-btn-border-color: #8c8c8c;
    --bs-btn-hover-bg: #f3f2ef; --bs-btn-hover-color: var(--li-text); --bs-btn-hover-border-color: #404040;
}
.btn-success {
    --bs-btn-bg: var(--li-green); --bs-btn-border-color: var(--li-green);
    --bs-btn-hover-bg: #045631; --bs-btn-hover-border-color: #045631;
}
.btn-outline-success { --bs-btn-color: var(--li-green); --bs-btn-border-color: var(--li-green); --bs-btn-hover-bg: var(--li-green); --bs-btn-hover-border-color: var(--li-green); }
.btn-danger { --bs-btn-bg: var(--li-red); --bs-btn-border-color: var(--li-red); --bs-btn-hover-bg: #a00d12; --bs-btn-hover-border-color: #a00d12; }
.btn-outline-danger { --bs-btn-color: var(--li-red); --bs-btn-border-color: var(--li-red); --bs-btn-hover-bg: var(--li-red); --bs-btn-hover-border-color: var(--li-red); }
.btn-secondary { --bs-btn-bg: #5e5e5e; --bs-btn-border-color: #5e5e5e; }

/* ---------------------------------------------------------------- Forms */
.form-control, .form-select { border-color: #b0b0b0; border-radius: .375rem; }
.form-control:focus, .form-select:focus {
    border-color: var(--li-blue);
    box-shadow: 0 0 0 1px var(--li-blue);
}
.form-check-input:checked { background-color: var(--li-blue); border-color: var(--li-blue); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(10, 102, 194, .25); }
.form-label { font-weight: 500; color: #404040; }

/* ---------------------------------------------------------------- Nav pills / tabs / pagination */
.nav-pills { gap: .35rem; }
.nav-pills .nav-link {
    border-radius: 1.5rem; border: 1px solid #8c8c8c; color: #5e5e5e;
    padding: .3rem .85rem; font-weight: 600; background: #fff;
}
.nav-pills .nav-link.active { background: var(--li-green); border-color: var(--li-green); color: #fff; }
.nav-pills .nav-link.active .badge { background: rgba(255,255,255,.25) !important; color: #fff !important; }
.nav-tabs { --bs-nav-tabs-border-color: var(--li-border); }
.nav-tabs .nav-link { color: var(--li-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--li-green); border-bottom-color: var(--li-green); background: transparent; }
.pagination { --bs-pagination-active-bg: var(--li-blue); --bs-pagination-active-border-color: var(--li-blue); --bs-pagination-color: var(--li-blue); }
.progress-bar { background-color: var(--li-blue); }

/* ---------------------------------------------------------------- Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--li-muted); font-weight: 600; white-space: nowrap; }
.table-light { --bs-table-bg: #f9f8f6; --bs-table-border-color: var(--li-border); }
.table td, .table th { vertical-align: middle; border-color: var(--li-border); }
.table-sm td { font-size: .88rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f7f6f3; }

/* Badges */
.badge { font-weight: 600; border-radius: .3rem; }

/* Alerts */
.alert { border-radius: .5rem; border-width: 1px; }

/* ---------------------------------------------------------------- Post preview (LinkedIn feed card) */
.post-preview {
    background: #fff; border: 1px solid var(--li-border); border-radius: .5rem; padding: 12px 16px;
    white-space: pre-wrap; font-size: .875rem; line-height: 1.45; color: rgba(0,0,0,.9);
}
.post-preview .hashtags { color: var(--li-blue); font-weight: 600; }
.post-preview img { max-width: calc(100% + 32px); margin: 12px -16px -12px; border-radius: 0 0 .5rem .5rem; display: block; }

/* ---------------------------------------------------------------- Misc */
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: .375rem; }
.img-version { width: 80px; height: 80px; object-fit: cover; border-radius: .375rem; cursor: pointer; border: 3px solid transparent; }
.img-version.active { border-color: var(--li-blue); }
.char-count.over { color: var(--li-red); font-weight: 700; }
pre.payload { background: #1d2226; color: #e9e5df; padding: 12px; border-radius: .375rem; max-height: 400px; overflow: auto; font-size: .8rem; white-space: pre-wrap; word-break: break-word; }
.btn-busy { pointer-events: none; opacity: .7; }
.ai-text { white-space: pre-wrap; }
.comment { border-left: 3px solid var(--li-border); padding-left: 10px; margin-bottom: 12px; }
.comment.reply { margin-left: 24px; border-color: var(--li-blue); }
code { color: #b24020; }

/* Calendar */
.fc { --fc-button-bg-color: #fff; --fc-button-text-color: #404040; --fc-button-border-color: #8c8c8c;
      --fc-button-hover-bg-color: #f3f2ef; --fc-button-hover-border-color: #404040; --fc-button-hover-text-color: #191919;
      --fc-button-active-bg-color: var(--li-blue-soft); --fc-button-active-border-color: var(--li-blue); --fc-button-active-text-color: var(--li-blue);
      --fc-today-bg-color: #fff8e6; --fc-border-color: var(--li-border); font-size: .85rem; }
.fc .fc-button { border-radius: 1.5rem !important; font-weight: 600; font-size: .8rem; padding: .3rem .8rem; box-shadow: none !important; }
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 600; }
.fc-event { cursor: pointer; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-wrap .card { box-shadow: 0 4px 12px rgba(0,0,0,.08); border-radius: .75rem; }

/* Toasts */
.toast { border-radius: .5rem; }

/* ---------------------------------------------------------------- Mobile */
@media (max-width: 991.98px) {
    .app-topbar { padding: 0 .75rem; }
    .app-content { padding: 1rem .75rem; }
}
@media (max-width: 575.98px) {
    h4, .h4 { font-size: 1.15rem; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .card-header { padding: .7rem .8rem; }
    .fc .fc-toolbar { flex-direction: column; gap: .5rem; }
    .fc .fc-toolbar-title { font-size: 1rem; }
    .nav-pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; }
    .nav-pills .nav-link { white-space: nowrap; }
    .table td, .table th { white-space: nowrap; }
    .post-preview { font-size: .85rem; }
}
