/* --- Color Tokens --- */
:root {
    --primary-purple: #6a3bcf;
    --primary-purple-dark: #4a29a3;
    --primary-purple-light: #8b65e6;
    --purple-soft: rgba(106, 59, 207, 0.08);
}

.text-purple { color: var(--primary-purple) !important; }
.bg-purple { background-color: var(--primary-purple) !important; }
.bg-purple-soft { background-color: var(--purple-soft) !important; }
.btn-purple { 
    background-color: var(--primary-purple); 
    color: white; 
    border: none;
}
.btn-purple:hover {
    background-color: var(--primary-purple-dark);
    color: white;
}
.btn-outline-purple {
    border: 1px solid var(--primary-purple);
    color: var(--primary-purple);
    background: transparent;
}
.btn-outline-purple:hover {
    background: var(--purple-soft);
    color: var(--primary-purple);
}

/* --- Category Navigation --- */
.blog-categories-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.blog-categories-nav::-webkit-scrollbar {
    display: none;
}

/* --- Blog Card --- */
.blog-card {
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-radius: 20px !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(106, 59, 207, 0.12) !important;
}

.blog-card-img-wrapper {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.blog-card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.blog-card:hover .blog-card-img-wrapper img {
    transform: scale(1.08);
}

.blog-card-category {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-purple);
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.blog-card-title a {
    transition: color 0.2s;
}

.blog-card:hover .blog-card-title a {
    color: var(--primary-purple) !important;
}

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

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
}

/* --- Author Avatars --- */
.blog-author-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 1.5px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.blog-author-avatar {
    width: 44px; /* Premium size, not too big */
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.mode-mobile .blog-author-avatar {
    width: 38px; /* Slightly smaller for mobile-in-app */
    height: 38px;
}

/* --- Blog Article (Detail) --- */
.blog-article {
    padding-top: 1rem;
}

.blog-article-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #111;
}

.blog-article-meta {
    font-weight: 500;
    color: #666;
}

.blog-article-thumbnail img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 400px; /* Limit height while keeping aspect ratio */
    height: auto;
    width: auto;
    object-fit: contain;
    border-radius: 16px;
}

.blog-article-content {
    color: #222;
}

.article-body {
    font-size: 1.15rem;
    line-height: 1.85;
}

.article-body img {
    max-width: 100% !important;
    height: auto !important;
}

.article-body p {
    margin-bottom: 1.75rem;
}

/* --- Animation Utilities --- */
.transition-scale {
    transition: transform 0.3s ease;
}
.group:hover .transition-scale {
    transform: scale(1.05);
}

/* --- Sidebar --- */
.blog-sidebar {
    background: white;
}

.blog-sidebar-thumb {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
}

.last-border-0:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* --- Pagination --- */
.pagination-rounded .page-link {
    border-radius: 50% !important;
    margin: 0 4px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #666;
    font-weight: 600;
}

.pagination-rounded .page-item.active .page-link {
    background-color: var(--primary-purple);
    color: white;
}

/* --- Hide Scrollbar --- */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .blog-article-title {
        font-size: 1.75rem;
        text-align: left;
    }
    
    .blog-article {
        padding-top: 0.5rem;
    }

    .blog-card-img-wrapper {
        height: 180px;
    }

    .mobile-header {
        border-bottom-color: rgba(0,0,0,0.05);
    }

    /* Override dashboard styles if leaked */
    .navbar, footer, .desktop-only {
        display: none !important;
    }
    
    main.container {
        padding-top: 10px !important;
        margin-top: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Force hidden elements in mode-mobile regardless of screen width */
.mode-mobile .navbar, 
.mode-mobile footer, 
.mode-mobile .desktop-only,
.mode-mobile .blog-sidebar {
    display: none !important;
}

.mode-mobile main.container {
    padding-top: 0 !important;
    margin-top: 0 !important;
    max-width: 100% !important;
}

.mode-mobile .blog-article-title {
    font-size: 1.65rem !important;
    margin-top: 0.5rem;
}

.mode-mobile .blog-article-thumbnail img {
    max-height: 280px; /* Slightly taller for contain mode */
    width: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 12px;
}

.mode-mobile .article-body img {
    max-width: 100% !important;
    height: auto !important;
}
