/* Console of scrapynews (same look as socialshare): Bootstrap 5.3 with a sidebar layout, light and dark theme (data-bs-theme on <html>) */

:root {
    --sn-brand: #6d5dfc;
    --sn-brand-2: #c850c0;
    --sn-gradient: linear-gradient(135deg, var(--sn-brand) 0%, var(--sn-brand-2) 100%);
    --sn-sidebar-width: 15.5rem;
    --sn-sidebar-bg: #15132b;
    --sn-sidebar-fg: #c9c6e6;
    --sn-sidebar-muted: #8581ad;
    --sn-sidebar-active: rgba(255, 255, 255, .09);
    --sn-body-bg: #f4f5fb;
    --sn-card-bg: #ffffff;
    --sn-card-border: #e7e8f2;
    --sn-shadow: 0 1px 2px rgba(20, 20, 60, .04), 0 4px 16px rgba(20, 20, 60, .05);
    /* status colors, reserved for ok / failed (never a series), always with an icon or a label */
    --sn-ok: #0ca30c;
    --sn-fail: #d03b3b;
    --bs-primary: #6d5dfc;
    --bs-primary-rgb: 109, 93, 252;
    --bs-link-color: #5a49f0;
    --bs-link-color-rgb: 90, 73, 240;
    --bs-link-hover-color: #3f2fd4;
    --bs-border-radius: .6rem;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] {
    --sn-body-bg: #0f0e1d;
    --sn-card-bg: #191830;
    --sn-card-border: #2a2846;
    --sn-sidebar-bg: #0b0a17;
    --sn-ok: #0ca30c;
    --sn-fail: #d03b3b;
    --sn-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --bs-body-bg: #0f0e1d;
    --bs-link-color: #a99fff;
    --bs-link-color-rgb: 169, 159, 255;
    --bs-link-hover-color: #c9c2ff;
    --bs-border-color: #2a2846;
    --bs-tertiary-bg: #1f1d39;
    --bs-secondary-bg: #24223f;
}

body {
    background: var(--sn-body-bg);
    min-height: 100vh;
}

.btn-primary {
    --bs-btn-bg: var(--sn-brand);
    --bs-btn-border-color: var(--sn-brand);
    --bs-btn-hover-bg: #5a49f0;
    --bs-btn-hover-border-color: #5a49f0;
    --bs-btn-active-bg: #4b3ae0;
    --bs-btn-active-border-color: #4b3ae0;
    --bs-btn-disabled-bg: var(--sn-brand);
    --bs-btn-disabled-border-color: var(--sn-brand);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--sn-brand);
    --bs-btn-hover-bg: var(--sn-brand);
    --bs-btn-hover-border-color: var(--sn-brand);
    --bs-btn-active-bg: var(--sn-brand);
    --bs-btn-active-border-color: var(--sn-brand);
}

.btn-gradient {
    background: var(--sn-gradient);
    border: 0;
    color: #fff;
}

.btn-gradient:hover, .btn-gradient:focus {
    color: #fff;
    filter: brightness(1.07);
}

.form-check-input:checked {
    background-color: var(--sn-brand);
    border-color: var(--sn-brand);
}

.nav-pills .nav-link.active {
    background: var(--sn-brand);
}

.page-link {
    color: var(--bs-link-color);
}

.active > .page-link, .page-link.active {
    background-color: var(--sn-brand);
    border-color: var(--sn-brand);
}

/* Layout */

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

.sidebar {
    width: var(--sn-sidebar-width);
    /* !important: .offcanvas-lg makes the background transparent on large screens */
    background: var(--sn-sidebar-bg) !important;
    color: var(--sn-sidebar-fg);
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

.sidebar.offcanvas-lg {
    --bs-offcanvas-width: var(--sn-sidebar-width);
    --bs-offcanvas-bg: var(--sn-sidebar-bg);
    --bs-offcanvas-color: var(--sn-sidebar-fg);
}

.sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.25rem 1.25rem 1rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -.01em;
}

.brand:hover {
    color: #fff;
}

.brand-logo {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: .65rem;
    background: var(--sn-gradient);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    color: #fff;
    box-shadow: 0 4px 14px rgba(109, 93, 252, .45);
}

.nav-section {
    padding: .9rem 1.25rem .35rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--sn-sidebar-muted);
    font-weight: 600;
}

.side-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: .1rem .65rem;
    padding: .5rem .7rem;
    border-radius: .5rem;
    color: var(--sn-sidebar-fg);
    text-decoration: none;
    font-size: .92rem;
}

.side-link i {
    font-size: 1.05rem;
    width: 1.2rem;
    text-align: center;
    opacity: .85;
}

.side-link:hover {
    background: var(--sn-sidebar-active);
    color: #fff;
}

.side-link.active {
    background: var(--sn-sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--sn-brand-2);
}

.side-link .badge {
    margin-left: auto;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    font-size: .75rem;
    color: var(--sn-sidebar-muted);
    border-top: 1px solid rgba(255, 255, 255, .06);
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.5rem;
    background: color-mix(in srgb, var(--sn-body-bg) 82%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--sn-card-border);
}

.topbar h1 {
    font-size: 1.2rem;
    font-weight: 650;
    margin: 0;
    letter-spacing: -.01em;
}

.topbar .subtitle {
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

.content {
    padding: 1.5rem;
    flex: 1;
}

.app-footer {
    padding: 1rem 1.5rem;
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

@media (max-width: 575.98px) {
    .content, .topbar {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Cards */

.card {
    --bs-card-bg: var(--sn-card-bg);
    --bs-card-border-color: var(--sn-card-border);
    --bs-card-cap-bg: transparent;
    box-shadow: var(--sn-shadow);
    border-radius: .85rem;
}

.card > .card-header {
    padding: .9rem 1.15rem;
}

.card-title-sm {
    font-size: 1rem;
    font-weight: 650;
    margin: 0;
}

section + section, .section-gap {
    margin-top: 1.25rem;
}

/* Forms */

.info-tip {
    display: inline-block;
    margin-left: .3rem;
    color: var(--bs-secondary-color);
    cursor: help;
    font-size: .85em;
}

.info-tip:focus {
    outline: 2px solid var(--sn-brand);
    border-radius: 50%;
}

.form-section-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 650;
    color: var(--bs-secondary-color);
    margin-bottom: .75rem;
}

/* Login, setup */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(109, 93, 252, .35), transparent 60%),
                radial-gradient(900px 500px at 110% 110%, rgba(200, 80, 192, .3), transparent 60%),
                var(--sn-body-bg);
}

.auth-card {
    width: 100%;
    max-width: 25rem;
    border-radius: 1.1rem;
}

.auth-card .brand {
    color: var(--bs-body-color);
    justify-content: center;
    padding: 0 0 .5rem;
    font-size: 1.35rem;
}

/* Tables */

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table > thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    font-weight: 600;
    white-space: nowrap;
}

.table > :not(caption) > * > * {
    padding: .65rem .85rem;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--bs-secondary-color);
}

.empty-state i {
    font-size: 2.2rem;
    display: block;
    margin-bottom: .5rem;
    opacity: .6;
}

pre.traceback {
    max-height: 24rem;
    overflow: auto;
    white-space: pre-wrap;
    background: var(--bs-tertiary-bg);
}

.text-break-all {
    word-break: break-all;
}

.min-w-0 {
    min-width: 0;
}

@media (max-width: 575.98px) {
    .topbar h1 {
        font-size: 1.05rem;
    }
}

/* Logo of scrapynews (the favicon: a pickaxe) in the brand */

.brand-logo img {
    width: 100%;
    height: 100%;
    border-radius: .65rem;
}

/* Pages of scrapynews */

section + section {
    margin-top: 1.25rem;
}

.source-page iframe, .target-page iframe {
    display: block;
    margin: 10px;
}

section.pages img {
    width: 10em;
    height: auto;
}

.image-credits {
    font-size: small;
}

.banned {
    color: var(--sn-fail);
}

/* Home: stat tiles */

.stats .stat {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: .75rem 1rem;
    border: 1px solid var(--sn-card-border);
    border-radius: .7rem;
    color: inherit;
    text-decoration: none;
    transition: transform .12s ease, border-color .12s ease;
}

.stats a.stat:hover {
    border-color: var(--sn-brand);
    transform: translateY(-2px);
}

.stats .stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.stats .stat-label {
    color: var(--bs-secondary-color);
    font-size: .8rem;
}

.stats .stat-main {
    border-color: color-mix(in srgb, var(--sn-brand) 55%, transparent);
    background: color-mix(in srgb, var(--sn-brand) 8%, transparent);
}

.stats .stat-main .stat-value {
    background: var(--sn-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stats .stat-error .stat-value {
    color: var(--sn-fail);
}

.run-error td {
    border-top: 0;
    padding-top: 0;
}

/* Hourly view of today's schedule */

.day-view {
    display: flex;
    flex-direction: column;
}

.day-hour {
    display: flex;
    border-top: 1px solid var(--sn-card-border);
    min-height: 2.25rem;
}

.day-hour-empty {
    min-height: 1.25rem;
}

.day-hour-label {
    flex: 0 0 4.5rem;
    padding: 2px 12px;
    color: var(--bs-secondary-color);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.day-hour-entries {
    flex: 1;
    padding: 3px 12px 3px 0;
}

.day-hour-now {
    background: color-mix(in srgb, var(--sn-brand) 9%, transparent);
}

.day-hour-now .day-hour-label {
    color: var(--bs-link-color);
    font-weight: 600;
}

.day-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    margin: 2px 0;
    border-left: 3px solid #adb5bd;
    background: var(--bs-tertiary-bg);
    border-radius: 4px;
}

.day-entry-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.day-entry-success { border-left-color: #198754; }
.day-entry-error { border-left-color: #dc3545; }
.day-entry-missed { border-left-color: #ffc107; }
.day-entry-running { border-left-color: #0dcaf0; }
.day-entry-scheduled { border-left-color: var(--sn-brand); }

/* an automatic cycle in the hours after its start (its estimated or real duration) */
.day-entry-continued {
    border-left-style: dashed;
    background: var(--bs-secondary-bg);
    padding-top: 2px;
    padding-bottom: 2px;
}

/* Home > Articles: the states in groups (can still be published, not published, published), a dot of color each */

.article-group-total > td {
    font-weight: 600;
    border-top: 2px solid var(--sn-card-border);
}

.state-dot {
    display: inline-block;
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    margin-right: .5rem;
    vertical-align: baseline;
}

.state-dot-open { background: #f5c542; }
.state-dot-closed { background: #e57373; }
.state-dot-done { background: #5cb85c; }

.schedules input[type=number] {
    width: 5rem;
}

/* Source pages */

.source-pages .thumb {
    width: 96px;
}

.source-pages .thumb img {
    width: 88px;
    height: 58px;
    object-fit: cover;
    border-radius: .45rem;
    border: 1px solid var(--sn-card-border);
}

.source-pages .article {
    min-width: 18rem;
    max-width: 38rem;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.source-page article {
    line-height: 1.6;
}

.info dd {
    margin-bottom: .4rem;
}

/* The administrator viewing the console as a user */

.impersonation-bar {
    padding: .5rem 1.5rem;
    background: var(--sn-gradient);
    color: #fff;
    font-size: .9rem;
}

.site-filter select {
    min-width: 11rem;
    max-width: 16rem;
}

@media (max-width: 575.98px) {
    .site-filter select {
        min-width: 0;
        max-width: 8.5rem;
    }
}

/* Social (pages Social, Messages; imported from socialshare) */

/* Stat tiles */

.stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    height: 100%;
    color: inherit;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease;
}

a.stat-card:hover {
    transform: translateY(-2px);
    color: inherit;
}

.stat-icon {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: .75rem;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    color: var(--tone, var(--sn-brand));
    background: color-mix(in srgb, var(--tone, var(--sn-brand)) 14%, transparent);
}

.stat-card .stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.stat-card .stat-label {
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

/* Social networks: --nl / --nd are the colors of the network in the light / dark theme, --il / --id the colors of
   the icons on them (network_style()) */

[style*="--nl"] {
    --network: var(--nl);
    --network-ink: var(--il);
}

[data-bs-theme="dark"] [style*="--nl"] {
    --network: var(--nd);
    --network-ink: var(--id);
}

/* the text keeps the text color: the icon carries the color of the network */
.network-badge {
    background: color-mix(in srgb, var(--network) 12%, transparent);
    color: var(--bs-body-color);
    font-weight: 600;
    border: 1px solid color-mix(in srgb, var(--network) 35%, transparent);
}

.network-badge i {
    color: var(--network);
}

.post-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: .8rem;
    color: var(--network-ink, #fff);
    background: var(--network);
    position: relative;
}

.post-dot.failed::after, .post-dot.ok::after {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: .8rem;
    height: .8rem;
    border-radius: 50%;
    font-family: bootstrap-icons;
    font-size: .55rem;
    line-height: .8rem;
    text-align: center;
    border: 1.5px solid var(--sn-card-bg);
}

.post-dot.ok::after {
    content: "\F26E";
    background: var(--sn-ok);
}

.post-dot.failed::after {
    content: "\F62A";
    background: var(--sn-fail);
}

.network-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 0;
}

.network-row + .network-row {
    border-top: 1px dashed var(--sn-card-border);
}

.network-icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: .6rem;
    display: grid;
    place-items: center;
    color: var(--network-ink, #fff);
    background: var(--network);
    flex-shrink: 0;
}

.account-card {
    border-top: 3px solid var(--network, var(--sn-brand));
}

.account-card.disabled-account {
    opacity: .65;
}

/* Messages */

.message-thumb {
    width: 4.5rem;
    height: 3.2rem;
    object-fit: cover;
    border-radius: .45rem;
    border: 1px solid var(--sn-card-border);
    background: var(--bs-tertiary-bg);
}

.message-thumb-empty {
    display: grid;
    place-items: center;
    color: var(--bs-secondary-color);
}

.message-text {
    max-width: 38rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.status-tabs .nav-link {
    color: var(--bs-secondary-color);
    font-size: .9rem;
    padding: .4rem .8rem;
}

.status-tabs .nav-link.active {
    color: #fff;
}

.status-tabs .nav-link .badge {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.status-tabs .nav-link.active .badge {
    background: rgba(255, 255, 255, .25);
    color: #fff;
}

/* Preview of a post (form of a message) */

.post-preview {
    border: 1px solid var(--sn-card-border);
    border-radius: .85rem;
    overflow: hidden;
    background: var(--sn-card-bg);
}

.post-preview .head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem .9rem;
}

.post-preview .avatar {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: var(--sn-gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.post-preview .text {
    padding: 0 .9rem .75rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .92rem;
}

.post-preview img {
    width: 100%;
    display: block;
    max-height: 22rem;
    object-fit: cover;
    background: var(--bs-tertiary-bg);
}

.post-preview .link {
    padding: .6rem .9rem;
    font-size: .8rem;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--sn-card-border);
    word-break: break-all;
}

.char-limits .badge {
    font-weight: 500;
}

.image-drop {
    border: 1.5px dashed var(--sn-card-border);
    border-radius: .7rem;
    padding: .75rem;
    background: var(--bs-tertiary-bg);
}

.image-drop img {
    max-height: 9rem;
    max-width: 100%;
    border-radius: .45rem;
}

/* Schedule grid (page Social) */

.schedule-grid th.today, .schedule-grid td.today {
    background: color-mix(in srgb, var(--sn-brand) 7%, transparent);
}

.slot-cell {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: .55rem;
    border: 1.5px solid var(--sn-card-border);
    background: transparent;
    color: #fff;
    font-weight: 700;
    line-height: 1;
}

.slot-cell:hover {
    border-color: var(--sn-brand);
}

.slot-cell.on {
    background: var(--sn-gradient);
    border-color: transparent;
}

.slot-cell.next {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sn-brand-2) 45%, transparent);
}

.time-input {
    width: 7.5rem;
}
