/**
 * Blog Sidebar
 * Minimal, compatible with variables.css + Bootstrap 5
 * Dark mode via [data-theme="dark"] — NOT @media prefers-color-scheme
 *
 * @package 911myweb
 */

/* ============================================================
   VARIABLES
   ============================================================ */
.sidebar-blog {
    --sb-bg:           #ffffff;
    --sb-shadow:       0 2px 12px rgba(0, 37, 66, 0.07);
    --sb-radius:       0.75rem;
    --sb-padding:      1.5rem;
    --sb-border:       #e9ecef;
    --sb-text:         #212529;
    --sb-text-muted:   #6c757d;
    --sb-link:         var(--bs-primary, #002542);
    --sb-link-hover:   var(--bs-primary, #002542);
    --sb-badge-bg:     #f1f3f5;
    --sb-badge-color:  #495057;
    --sb-icon-color:   var(--bs-secondary, #f47a16);
    --sb-about-bg:     #002542;
    --sb-about-text:   #ffffff;
}

/* ============================================================
   CARD BASE
   ============================================================ */
.sidebar-blog .card {
    background-color: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    box-shadow: var(--sb-shadow);
    padding: var(--sb-padding);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Remove !important from card base - allow overrides */
.sidebar-blog .card.border-0 {
    border: none !important;
}

.sidebar-blog .card.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 37, 66, 0.08) !important;
}

.sidebar-blog .card.p-4 {
    padding: 1.5rem !important;
}

/* Section headings */
.sidebar-blog .card h5 {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--sb-text);
    margin-bottom: 1rem;
}

.sidebar-blog .card h5 i {
    font-size: 1.1rem;
    color: var(--sb-icon-color);
    line-height: 1;
}

/* ============================================================
   ABOUT CARD (DARK BG FOR WHITE LOGO)
   ============================================================ */
.sidebar-blog .about-card {
    background-color: var(--sb-about-bg) !important;
    color: var(--sb-about-text);
}

.sidebar-blog .about-card p {
    color: rgba(255, 255, 255, 0.8) !important;
}

.sidebar-blog .about-card img {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

/* ============================================================
   SEARCH FORM
   ============================================================ */
.sidebar-blog .search-form {
    display: flex;
    gap: 0.5rem;
}

.sidebar-blog .search-form .search-field {
    flex: 1;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--sb-border);
    border-radius: 0.375rem;
    background-color: var(--sb-bg);
    color: var(--sb-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-blog .search-form .search-field:focus {
    outline: none;
    border-color: var(--sb-link);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.sidebar-blog .search-form .search-field::placeholder {
    color: var(--sb-text-muted);
}

.sidebar-blog .search-form .search-submit {
    padding: 0.45rem 0.875rem;
    font-size: 0.875rem;
    background-color: var(--sb-link);
    color: #ffffff;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: filter 0.2s ease;
    white-space: nowrap;
}

.sidebar-blog .search-form .search-submit:hover {
    filter: brightness(1.1);
}

/* ============================================================
   CATEGORIES
   ============================================================ */
.sidebar-blog .list-unstyled li {
    border-bottom: 1px solid var(--sb-border) !important;
}

.sidebar-blog .list-unstyled li:last-child {
    border-bottom: none !important;
}

.sidebar-blog .category-link {
    font-size: 0.875rem;
    color: var(--sb-text);
    transition: color 0.15s ease;
}

.sidebar-blog .category-link:hover {
    color: var(--sb-link);
}

.sidebar-blog .list-unstyled .badge {
    background-color: var(--sb-badge-bg) !important;
    color: var(--sb-badge-color) !important;
    border: 1px solid var(--sb-border);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 50rem;
}

/* ============================================================
   RECENT POSTS
   ============================================================ */
.sidebar-blog .recent-post-item {
    border-bottom: 1px solid var(--sb-border);
    padding-bottom: 0.875rem;
}

.sidebar-blog .recent-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0 !important;
}

.sidebar-blog .recent-post-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.375rem;
    transition: opacity 0.2s ease;
}

.sidebar-blog .recent-post-thumbnail:hover {
    opacity: 0.85;
}

.sidebar-blog .recent-post-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sb-text);
    line-height: 1.4;
    transition: color 0.15s ease;
}

.sidebar-blog .recent-post-title:hover {
    color: var(--sb-link);
}

.sidebar-blog .recent-post-date {
    font-size: 0.75rem;
    color: var(--sb-text-muted);
}

.sidebar-blog .recent-post-date i {
    font-size: 0.7rem;
}

/* ============================================================
   TAGS
   ============================================================ */
.sidebar-blog .tag-link {
    font-size: 0.75rem;
    font-weight: 500;
    background-color: var(--sb-badge-bg) !important;
    color: var(--sb-badge-color) !important;
    border: 1px solid var(--sb-border) !important;
    border-radius: 50rem;
    padding: 0.3rem 0.65rem;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-blog .tag-link i {
    font-size: 0.7rem;
}

.sidebar-blog .tag-link:hover {
    background-color: var(--sb-link) !important;
    color: #ffffff !important;
    border-color: var(--sb-link) !important;
}

/* ============================================================
   CTA CARD
   ============================================================ */
.sidebar-blog .cta-card {
    background: linear-gradient(135deg, #002542 0%, #003d66 100%) !important;
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 37, 66, 0.25) !important;
}

.sidebar-blog .cta-card h5 {
    color: #ffffff;
}

.sidebar-blog .cta-card .cta-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.sidebar-blog .cta-card i.display-6 {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-blog .cta-card .btn {
    background-color: var(--bs-secondary, #f47a16);
    border-color: var(--bs-secondary, #f47a16);
    color: #ffffff;
    font-size: 0.875rem;
    transition: filter 0.2s ease;
}

.sidebar-blog .cta-card .btn:hover {
    filter: brightness(1.1);
    background-color: var(--bs-secondary, #f47a16) !important;
    border-color: var(--bs-secondary, #f47a16) !important;
}

/* ============================================================
   DARK MODE — [data-theme="dark"] only, never @media
   ============================================================ */
[data-theme="dark"] .sidebar-blog {
    --sb-bg:          #1e2228;
    --sb-shadow:      0 2px 12px rgba(0, 0, 0, 0.3);
    --sb-border:      rgba(255, 255, 255, 0.08);
    --sb-text:        #e9ecef;
    --sb-text-muted:  #adb5bd;
    --sb-badge-bg:    #252b33;
    --sb-badge-color: #ced4da;
    --sb-about-bg:    #002542;
    --sb-about-text:  #ffffff;
}

[data-theme="dark"] .sidebar-blog .card h5 {
    color: #f1f3f5;
}

/* About card keeps dark bg in both modes */
[data-theme="dark"] .sidebar-blog .about-card {
    background-color: var(--sb-about-bg) !important;
}

[data-theme="dark"] .sidebar-blog .search-form .search-field {
    background-color: #252b33;
    color: #e9ecef;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sidebar-blog .search-form .search-field::placeholder {
    color: #6c757d;
}

[data-theme="dark"] .sidebar-blog .tag-link:hover {
    background-color: var(--bs-secondary, #f47a16) !important;
    color: #ffffff !important;
    border-color: var(--bs-secondary, #f47a16) !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar-blog {
        margin-top: 2rem;
    }
}

@media (max-width: 767.98px) {
    .sidebar-blog {
        --sb-padding: 1.25rem;
    }

    .sidebar-blog .search-form {
        flex-direction: column;
    }

    .sidebar-blog .search-form .search-submit {
        width: 100%;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .sidebar-blog .search-form .search-submit,
    .sidebar-blog .tag-link,
    .sidebar-blog .recent-post-thumbnail,
    .sidebar-blog .cta-card .btn {
        transition: none;
    }
}

.sidebar-blog a:focus-visible,
.sidebar-blog .search-form .search-submit:focus-visible,
.sidebar-blog .tag-link:focus-visible {
    outline: 3px solid var(--sb-link);
    outline-offset: 3px;
    border-radius: 4px;
}
