/* ===================================================
   SuperBlog Theme — Main Stylesheet
   =================================================== */

/* --- CSS Variables Extended --- */
:root {
    --sb-primary: #4f46e5;
    --sb-primary-light: #818cf8;
    --sb-primary-dark: #3730a3;
    --sb-accent: #06b6d4;
    --sb-accent-light: #67e8f9;
    --sb-success: #10b981;
    --sb-warning: #f59e0b;
    --sb-danger: #ef4444;
    --sb-info: #3b82f6;

    --sb-bg: #ffffff;
    --sb-bg-secondary: #f8f9fa;
    --sb-bg-tertiary: #e9ecef;
    --sb-text: #1a1a2e;
    --sb-text-secondary: #6c757d;
    --sb-text-light: #adb5bd;
    --sb-border: #e2e8f0;
    --sb-border-light: #f1f5f9;
    --sb-card-bg: #ffffff;
    --sb-card-bg-hover: #fefefe;

    --sb-shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --sb-shadow-sm: 0 2px 8px rgba(0,0,0,.06);
    --sb-shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --sb-shadow-lg: 0 8px 30px rgba(0,0,0,.12);
    --sb-shadow-xl: 0 16px 48px rgba(0,0,0,.16);

    --sb-radius: 12px;
    --sb-radius-sm: 8px;
    --sb-radius-lg: 16px;
    --sb-radius-xl: 24px;
    --sb-radius-full: 999px;

    --sb-transition: all .3s cubic-bezier(.4,0,.2,1);
    --sb-transition-fast: all .15s ease;
    --sb-transition-slow: all .5s ease;

    --sb-header-height: 70px;
    --sb-topbar-height: 36px;

    --sb-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                      "Helvetica Neue", Arial, sans-serif;
    --sb-font-mono: "SF Mono", "Fira Code", monospace;
}

/* --- Base Reset --- */
::selection {
    background: var(--sb-primary);
    color: #fff;
}

a {
    color: var(--sb-primary);
    text-decoration: none;
    transition: var(--sb-transition-fast);
}
a:hover {
    color: var(--sb-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================
   TOP BAR
   ======================== */
.topbar {
    background: var(--sb-bg-secondary);
    border-bottom: 1px solid var(--sb-border-light);
    font-size: .8125rem;
    height: var(--sb-topbar-height);
    display: flex;
    align-items: center;
}
.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.topbar-date {
    color: var(--sb-text-secondary);
}

/* Theme Toggle */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--sb-transition);
    padding: 0;
    color: var(--sb-text);
    font-size: .875rem;
}
.theme-toggle-btn:hover {
    background: var(--sb-primary);
    color: #fff;
    border-color: var(--sb-primary);
}
[data-bs-theme="light"] .theme-icon-dark { display: none; }
[data-bs-theme="dark"] .theme-icon-light { display: none; }

/* ========================
   HEADER
   ======================== */
.site-header {
    background: var(--sb-card-bg);
    border-bottom: 1px solid var(--sb-border-light);
    transition: var(--sb-transition);
}
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1030;
}
.sticky-header.scrolled {
    box-shadow: var(--sb-shadow-md);
}

.site-branding-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.site-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--sb-primary), var(--sb-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.site-tagline {
    font-size: .75rem;
    color: var(--sb-text-secondary);
}

/* Search */
.search-wrapper {
    position: relative;
}
.search-input {
    border-radius: var(--sb-radius-full) !important;
    padding-left: 1rem;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg-secondary);
    transition: var(--sb-transition);
}
.search-input:focus {
    background: var(--sb-card-bg);
    box-shadow: 0 0 0 3px rgba(var(--sb-primary-rgb), .15);
    border-color: var(--sb-primary);
}

/* Live Search Dropdown */
.live-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--sb-card-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    box-shadow: var(--sb-shadow-lg);
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
}
.live-search-results {
    list-style: none;
    margin: 0;
    padding: 0;
}
.live-search-item {
    border-bottom: 1px solid var(--sb-border-light);
}
.live-search-item:last-child {
    border-bottom: none;
}
.live-search-item a {
    display: flex;
    padding: .75rem 1rem;
    color: var(--sb-text);
    transition: var(--sb-transition-fast);
}
.live-search-item a:hover {
    background: var(--sb-bg-secondary);
}
.live-search-thumb img,
.live-search-placeholder {
    width: 50px;
    height: 50px;
    border-radius: var(--sb-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}
.live-search-placeholder {
    background: var(--sb-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-text-light);
}
.live-search-title {
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 2px;
}
.live-search-meta {
    font-size: .75rem;
    color: var(--sb-text-secondary);
    display: flex;
    gap: .5rem;
}
.live-search-footer {
    padding: .5rem 1rem;
    border-top: 1px solid var(--sb-border-light);
}
.live-search-empty {
    text-align: center;
    padding: 2rem;
    color: var(--sb-text-secondary);
}
.live-search-empty i {
    font-size: 2rem;
    margin-bottom: .5rem;
    display: block;
}

/* ========================
   BREADCRUMBS
   ======================== */
.breadcrumbs-bar {
    background: var(--sb-bg-secondary);
    border-bottom: 1px solid var(--sb-border-light);
    padding: .5rem 0;
}
.breadcrumb {
    margin: 0;
    font-size: .8125rem;
    background: none;
    padding: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "\F285";
    font-family: "bootstrap-icons";
    font-size: .65rem;
    color: var(--sb-text-light);
}
.breadcrumb-item a {
    color: var(--sb-text-secondary);
}
.breadcrumb-item a:hover {
    color: var(--sb-primary);
}
.breadcrumb-item.active {
    color: var(--sb-text);
    font-weight: 500;
}

/* ========================
   HERO SECTION
   ======================== */
.hero-section {
    padding: 1.5rem 0;
    background: var(--sb-bg-secondary);
}
.hero-main {
    position: relative;
    border-radius: var(--sb-radius-lg);
    overflow: hidden;
    height: 100%;
    min-height: 420px;
}
.hero-main-link {
    display: block;
    height: 100%;
}
.hero-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 420px;
}
.hero-main-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 30%, rgba(0,0,0,.75) 100%);
}
.hero-main-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    color: #fff;
}
.hero-category {
    display: inline-block;
    padding: .25rem .75rem;
    border-radius: var(--sb-radius-full);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--cat-color, var(--sb-primary));
    color: #fff;
    margin-bottom: .75rem;
}
.hero-category-sm {
    font-size: .65rem;
    padding: .15rem .5rem;
}
.hero-main-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: .5rem;
    color: #fff;
}
.hero-main-excerpt {
    font-size: .9rem;
    opacity: .85;
    margin-bottom: .75rem;
}
.hero-main-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .8rem;
    opacity: .8;
}
.hero-main-meta img {
    margin-right: .25rem;
}

/* Hero Side Posts */
.hero-side-posts {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    height: 100%;
}
.hero-side-post {
    position: relative;
    border-radius: var(--sb-radius);
    overflow: hidden;
    flex: 1;
    min-height: 130px;
}
.hero-side-link {
    display: block;
    height: 100%;
}
.hero-side-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 130px;
}
.hero-side-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 20%, rgba(0,0,0,.7) 100%);
}
.hero-side-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    color: #fff;
}
.hero-side-title {
    font-size: .95rem;
    font-weight: 700;
    margin: .25rem 0;
    line-height: 1.3;
    color: #fff;
}
.hero-side-date {
    font-size: .7rem;
    opacity: .7;
}

/* ========================
   STATS SECTION
   ======================== */
.stats-section {
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border-light);
}
.stat-counter {
    padding: 1rem;
    text-align: center;
}
.stat-counter-icon {
    font-size: 1.5rem;
    color: var(--sb-primary);
    margin-bottom: .25rem;
}
.stat-counter-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--sb-text);
    font-variant-numeric: tabular-nums;
}
.stat-counter-label {
    font-size: .8rem;
    color: var(--sb-text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ========================
   SECTION HEADERS
   ======================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sb-text);
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
}
.section-title i {
    color: var(--sb-primary);
}

/* Archive Controls */
.archive-controls {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.filter-controls {
    display: flex;
    gap: .5rem;
}
.filter-controls .form-select {
    width: auto;
    min-width: 140px;
    border-radius: var(--sb-radius-sm);
    font-size: .8125rem;
}
.layout-switcher .btn {
    padding: .3rem .5rem;
}
.results-count {
    font-size: .8125rem;
}

/* ========================
   POST CARDS
   ======================== */
.post-card {
    background: var(--sb-card-bg);
    border-radius: var(--sb-radius);
    overflow: hidden;
    border: 1px solid var(--sb-border-light);
    transition: var(--sb-transition);
    display: flex;
    flex-direction: column;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sb-shadow-lg);
    border-color: transparent;
}

/* Card Image */
.post-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3/2;
}
.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.post-card:hover .post-card-image img {
    transform: scale(1.05);
}
.card-img-placeholder {
    width: 100%;
    height: 100%;
    background: var(--sb-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--sb-text-light);
}

/* Card Overlay */
.post-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--sb-transition);
}
.post-card:hover .post-card-overlay {
    opacity: 1;
}
.post-card-read-more {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--sb-primary);
    transform: scale(.8);
    transition: var(--sb-transition);
}
.post-card:hover .post-card-read-more {
    transform: scale(1);
}

/* Category Badge on Card */
.post-card-category {
    position: absolute;
    top: .75rem;
    left: .75rem;
    padding: .2rem .6rem;
    border-radius: var(--sb-radius-full);
    font-size: .7rem;
    font-weight: 600;
    background: var(--cat-color, var(--sb-primary));
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .3px;
    z-index: 2;
}
.post-card-reading-time {
    position: absolute;
    top: .75rem;
    right: .75rem;
    padding: .2rem .5rem;
    border-radius: var(--sb-radius-full);
    font-size: .65rem;
    background: rgba(0,0,0,.6);
    color: #fff;
    z-index: 2;
}

/* Card Body */
.post-card-body {
    padding: 1.25rem;
    flex: 1;
}
.post-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: .5rem;
}
.post-card-title a {
    color: var(--sb-text);
}
.post-card-title a:hover {
    color: var(--sb-primary);
}
.post-card-excerpt {
    font-size: .85rem;
    color: var(--sb-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Card Footer */
.post-card-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--sb-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.post-card-author {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}
.post-card-author img {
    flex-shrink: 0;
}
.post-card-author-info {
    min-width: 0;
}
.post-card-author-name {
    font-size: .8rem;
    font-weight: 600;
    color: var(--sb-text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.post-card-date {
    font-size: .7rem;
    color: var(--sb-text-light);
}
.post-card-stats {
    display: flex;
    gap: .5rem;
    flex-shrink: 0;
}
.post-card-stats .stat-item {
    font-size: .75rem;
    color: var(--sb-text-secondary);
    display: flex;
    align-items: center;
    gap: .2rem;
}
.stat-rating {
    color: var(--sb-warning) !important;
}

/* ========================
   HORIZONTAL CARD
   ======================== */
.post-card-horizontal {
    background: var(--sb-card-bg);
    border-radius: var(--sb-radius);
    overflow: hidden;
    border: 1px solid var(--sb-border-light);
    transition: var(--sb-transition);
}
.post-card-horizontal:hover {
    box-shadow: var(--sb-shadow-md);
    border-color: transparent;
}
.post-card-h-image {
    position: relative;
    height: 100%;
    min-height: 200px;
}
.post-card-h-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-card-h-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.post-card-h-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: auto;
    font-size: .8rem;
    color: var(--sb-text-secondary);
}

/* ========================
   FEATURED CARD
   ======================== */
.post-card-featured {
    border-radius: var(--sb-radius-lg);
    overflow: hidden;
    position: relative;
}
.featured-image-wrap {
    position: relative;
    min-height: 420px;
}
.featured-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 420px;
}
.featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 30%, rgba(0,0,0,.8));
}
.featured-content {
    position: absolute;
    bottom: 0;
    padding: 2rem;
    color: #fff;
}
.featured-category {
    display: inline-block;
    padding: .25rem .75rem;
    border-radius: var(--sb-radius-full);
    font-size: .75rem;
    font-weight: 600;
    background: var(--cat-color);
    color: #fff;
    margin-bottom: .5rem;
}
.featured-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: .5rem;
}
.featured-title a { color: #fff; }
.featured-excerpt {
    opacity: .85;
    font-size: .95rem;
    margin-bottom: .75rem;
}
.featured-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .8rem;
    opacity: .8;
}

/* ========================
   MINIMAL CARD
   ======================== */
.post-card-minimal {
    padding: .5rem 0;
    border-bottom: 1px solid var(--sb-border-light);
}
.post-card-minimal:last-child {
    border-bottom: none;
}
.post-card-minimal a {
    color: var(--sb-text);
}
.post-card-minimal a:hover .minimal-title {
    color: var(--sb-primary);
}
.minimal-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    flex-shrink: 0;
}
.minimal-title {
    font-size: .9rem;
    font-weight: 600;
    margin: 0 0 .25rem;
    line-height: 1.3;
    transition: var(--sb-transition-fast);
}
.minimal-meta {
    font-size: .7rem;
    color: var(--sb-text-secondary);
    display: flex;
    gap: .5rem;
}