/* ==========================================================================
   CasBlog design system
   A cohesive, modern theme layered on top of Bootstrap 5.
   ========================================================================== */

:root {
    --cb-brand: #198754;
    --cb-brand-dark: #146c43;
    --cb-brand-darker: #0f5132;
    --cb-brand-soft: #e9f5ee;
    --cb-bg: #f4f6f8;
    --cb-surface: #ffffff;
    --cb-text: #1f2933;
    --cb-text-soft: #64748b;
    --cb-border: #e4e8ee;
    --cb-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --cb-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 10px 28px rgba(16, 24, 40, 0.07);
    --cb-shadow-hover: 0 12px 32px rgba(16, 24, 40, 0.14);
    --cb-radius: 16px;
    --cb-radius-sm: 10px;
    --cb-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --cb-font-display: 'Lora', Georgia, 'Times New Roman', serif;
}

/* ---------- Base ---------- */

body {
    background-color: var(--cb-bg);
    color: var(--cb-text);
    font-family: var(--cb-font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--cb-font-display);
    color: #16202b;
    font-weight: 600;
    letter-spacing: -0.01em;
}

a {
    color: var(--cb-brand);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--cb-brand-darker);
}

::selection {
    background: rgba(25, 135, 84, 0.18);
}

/* ---------- Topbar ---------- */

.cb-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--cb-border);
    box-shadow: var(--cb-shadow-sm);
    margin-bottom: 1.25rem;
}

.cb-topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.7rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cb-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--cb-font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: #16202b;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.cb-brand img {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.30);
}

.cb-brand:hover {
    color: #16202b;
}

.cb-brand-accent {
    color: var(--cb-brand);
}

.cb-search {
    flex: 1 1 300px;
    max-width: 560px;
    gap: 0.5rem;
}

.cb-search .form-control {
    border-radius: 999px;
    border: 1px solid var(--cb-border);
    background: #f7f9fb;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cb-search .form-control:focus {
    background: #fff;
    border-color: var(--cb-brand);
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}

.cb-search .btn {
    border-radius: 999px;
    padding-inline: 1.2rem;
}

.cb-topbar-categories {
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- Layout & sidebar ---------- */

.cb-layout {
    max-width: 1280px;
    margin: 0 auto;
    align-items: flex-start;
    gap: 1.5rem;
}

.cb-sidebar {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow-sm);
    padding: 0.75rem;
    margin-top: 0.25rem;
}

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

.cb-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    justify-content: center;
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-sm);
    padding: 0.5rem 1rem;
    font-family: var(--cb-font);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--cb-text-soft);
    background: #f7f9fb;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cb-sidebar-toggle:hover {
    background: var(--cb-brand-soft);
    color: var(--cb-brand-dark);
}

.cb-sidebar-toggle .navbar-toggler-icon {
    width: 1.1em;
    height: 1.1em;
}

.cb-sidebar-section + .cb-sidebar-section {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--cb-border);
}

.cb-sidebar-label {
    display: block;
    padding: 0 0.85rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9aa5b1;
}

.cb-nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.15rem;
    border-radius: var(--cb-radius-sm);
    color: #46525e;
    font-weight: 600;
    font-size: 0.94rem;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.cb-nav-link i {
    width: 1.15rem;
    text-align: center;
    color: #8b98a5;
    font-size: 0.92rem;
    transition: color 0.15s ease;
}

.cb-nav-link:hover {
    background: var(--cb-brand-soft);
    color: var(--cb-brand-dark);
    transform: translateX(2px);
}

.cb-nav-link:hover i {
    color: var(--cb-brand);
}

.cb-nav-link.active {
    background: linear-gradient(135deg, var(--cb-brand) 0%, var(--cb-brand-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.30);
}

.cb-nav-link.active i {
    color: #fff;
}

/* ---------- Page header & content area ---------- */

.content-area {
    min-width: 0;
}

.cb-page-header {
    border-bottom: none !important;
    padding: 0.35rem 0 0.9rem;
}

.cb-page-title {
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0;
}

.cb-welcome {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 999px;
    padding: 0.35rem 1rem 0.35rem 0.35rem;
    box-shadow: var(--cb-shadow-sm);
}

.cb-welcome .profile-picture {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.cb-welcome-text {
    font-size: 0.92rem;
    color: var(--cb-text-soft);
}

.cb-welcome-text strong {
    color: var(--cb-text);
}

/* ---------- Buttons ---------- */

.btn {
    border-radius: var(--cb-radius-sm);
    font-weight: 600;
    letter-spacing: 0.005em;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--cb-brand) 0%, var(--cb-brand-dark) 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.25);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--cb-brand-dark) 0%, var(--cb-brand-darker) 100%);
    border: none;
    box-shadow: 0 6px 18px rgba(25, 135, 84, 0.35);
    transform: translateY(-1px);
}

.btn-outline-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.22);
}

/* ---------- Cards ---------- */

.card {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow-sm);
}

.cb-post-card {
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cb-post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--cb-shadow-hover);
    border-color: rgba(25, 135, 84, 0.35);
}

.cb-post-card-media {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--cb-brand-soft);
}

.cb-post-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.cb-post-card:hover .cb-post-card-media img {
    transform: scale(1.04);
}

.cb-post-meta-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.cb-post-meta-item {
    font-size: 0.8rem;
    color: var(--cb-text-soft);
    font-weight: 500;
}

.cb-post-meta-item i {
    margin-right: 0.25rem;
    color: var(--cb-brand);
}

.cb-chip {
    display: inline-block;
    background: var(--cb-brand-soft);
    color: var(--cb-brand-dark);
    border-radius: 999px;
    padding: 0.18rem 0.7rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cb-post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
    line-height: 1.35;
}

.cb-post-title a {
    color: #16202b;
}

.cb-post-title a:hover {
    color: var(--cb-brand);
}

.cb-post-excerpt {
    color: var(--cb-text-soft);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    max-height: 4.8em;
    overflow: hidden;
}

.cb-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.cb-read-more i {
    transition: transform 0.15s ease;
}

.cb-read-more:hover i {
    transform: translateX(3px);
}

.cb-post-list {
    border: none;
    background: transparent;
}

.cb-post-list .list-group-item {
    border: none;
    background: transparent;
    padding-left: 0;
    padding-right: 0;
}

/* ---------- Hero (home page) ---------- */

.cb-hero {
    position: relative;
    background:
        radial-gradient(900px 320px at 12% -10%, rgba(25, 135, 84, 0.16), transparent 60%),
        radial-gradient(700px 300px at 95% 110%, rgba(25, 135, 84, 0.12), transparent 55%),
        linear-gradient(160deg, #ffffff 0%, #f0f7f3 100%);
    border: 1px solid rgba(25, 135, 84, 0.18);
    border-radius: 22px;
    padding: 3rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--cb-shadow);
    overflow: hidden;
}

.cb-hero-logo {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 10px 26px rgba(25, 135, 84, 0.30);
    margin-bottom: 1.1rem;
}

.cb-hero-title {
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.cb-hero-lead {
    color: var(--cb-text-soft);
    font-size: 1.08rem;
    max-width: 620px;
    margin: 0 auto 1.5rem;
}

.cb-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.cb-policy-card {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.cb-policy-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.cb-policy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.8rem;
}

.cb-policy-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    background: #f7f9fb;
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-sm);
    color: var(--cb-text);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.cb-policy-item i {
    color: var(--cb-brand);
}

.cb-policy-item:hover {
    background: var(--cb-brand-soft);
    border-color: rgba(25, 135, 84, 0.35);
    color: var(--cb-brand-dark);
    transform: translateY(-2px);
    box-shadow: var(--cb-shadow-sm);
}

/* ---------- Categories ---------- */

.cb-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.cb-category-card {
    display: block;
    color: var(--cb-text);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cb-category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--cb-shadow-hover);
    border-color: rgba(25, 135, 84, 0.35);
    color: var(--cb-text);
}

.cb-category-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cb-brand-soft);
    color: var(--cb-brand);
    border-radius: 12px;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.cb-category-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.cb-category-desc {
    color: var(--cb-text-soft);
    font-size: 0.88rem;
    margin-bottom: 0;
}

/* ---------- Article / post detail ---------- */

.cb-article .post-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--cb-border);
    margin-bottom: 1.5rem;
}

.cb-article .post-header h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    line-height: 1.25;
}

.cb-byline {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    color: var(--cb-text-soft);
    font-size: 0.92rem;
}

.cb-byline strong {
    color: var(--cb-text);
}

.cb-featured-image {
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    border: 1px solid var(--cb-border);
}

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

.cb-auth-wrap {
    display: flex;
    justify-content: center;
    padding: 1rem 0 2rem;
}

.cb-auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 20px;
    box-shadow: var(--cb-shadow);
    padding: 0.5rem;
}

.cb-auth-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cb-brand) 0%, var(--cb-brand-dark) 100%);
    color: #fff;
    border-radius: 14px;
    font-size: 1.2rem;
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.30);
    margin-bottom: 1rem;
}

.cb-auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.cb-auth-subtitle {
    color: var(--cb-text-soft);
    margin-bottom: 1.25rem;
}

.cb-auth-card .form-control,
.cb-auth-card .form-select {
    border-radius: var(--cb-radius-sm);
    border-color: var(--cb-border);
    padding: 0.55rem 0.9rem;
}

.cb-auth-card .form-control:focus,
.cb-auth-card .form-select:focus {
    border-color: var(--cb-brand);
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}

.cb-auth-card .btn-primary {
    width: 100%;
    padding: 0.6rem;
}

.cb-auth-footer-text {
    text-align: center;
    color: var(--cb-text-soft);
    font-size: 0.92rem;
    margin: 1.25rem 0 0.25rem;
}

/* ---------- Alerts & notifications ---------- */

.alert {
    border-radius: var(--cb-radius-sm);
    border: none;
    font-size: 0.95rem;
    box-shadow: var(--cb-shadow-sm);
}

.notification-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.45);
    border: 2px solid #fff;
}

.dropdown-menu {
    border-radius: var(--cb-radius-sm);
    border: 1px solid var(--cb-border);
    box-shadow: var(--cb-shadow);
    padding: 0.4rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.92rem;
}

.dropdown-item:hover {
    background: var(--cb-brand-soft);
    color: var(--cb-brand-dark);
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 3rem;
    background: linear-gradient(160deg, #16202b 0%, #101820 100%);
    color: #cbd5e1;
    border-radius: 22px 22px 0 0;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 2rem;
}

.footer-brand-name {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--cb-font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.6rem;
}

.footer-brand-name img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    object-fit: cover;
}

.footer-blurb {
    font-size: 0.9rem;
    color: #94a3b8;
    max-width: 300px;
}

.footer-heading {
    font-family: var(--cb-font);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8b98a5;
    margin-bottom: 0.9rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: #cbd5e1;
    font-size: 0.92rem;
    transition: color 0.15s ease, padding-left 0.15s ease;
}

.footer-links a:hover {
    color: #6ee7b7;
    padding-left: 3px;
}

.footer-bottom {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.1rem 1.5rem 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #8b98a5;
}

/* ---------- Misc / responsive ---------- */

.profile-picture {
    object-fit: cover;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cb-brand-soft);
}

.content {
    column-width: unset !important;
}

@media (max-width: 991.98px) {
    .cb-layout {
        flex-direction: column;
    }

    .cb-sidebar {
        width: 100%;
        min-width: 0 !important;
        max-width: none !important;
    }

    .content-area {
        width: 100%;
    }

    .site-footer {
        border-radius: 16px 16px 0 0;
    }
}

@media (max-width: 767.98px) {
    .cb-topbar-inner {
        padding: 0.6rem 0.9rem;
        gap: 0.6rem;
    }

    .cb-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .cb-hero {
        padding: 2.1rem 1.2rem;
        border-radius: 16px;
    }

    .cb-page-title {
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
