/* ============================================================
   ARTICLES PAGE STYLES
   ============================================================ */

.articles-page {
    padding-top: 100px;
    background: #F7FAFC;
    min-height: 100vh;
}

.articles-hero {
    padding: 60px 0 40px;
    background: linear-gradient(135deg, #0A2540 0%, #0E3A5C 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.articles-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(28,169,201,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255,122,0,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.articles-hero .section-tag {
    background: rgba(28,169,201,0.2);
    color: #4DD0E1;
    border: 1px solid rgba(28,169,201,0.3);
}

.articles-hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 15px 0;
    color: white;
}

.articles-hero-subtitle {
    color: rgba(255,255,255,0.75);
    font-size: 1.05rem;
    max-width: 650px;
    margin: 0 auto;
}

.articles-content {
    padding: 50px 0 80px;
}

.articles-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 30px;
    align-items: start;
}

/* Sidebar */
.articles-sidebar {
    background: white;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

.articles-sidebar::-webkit-scrollbar {
    width: 5px;
}

.articles-sidebar::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 5px;
}

.sidebar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #F0F4F8;
}

.filter-btn {
    padding: 7px 13px;
    border-radius: 50px;
    background: #F7FAFC;
    color: #4A5568;
    border: 1px solid #E2E8F0;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}

.filter-btn:hover {
    background: #E0F6FB;
    border-color: #1CA9C9;
    color: #1CA9C9;
}

.filter-btn.active {
    background: linear-gradient(135deg, #1CA9C9, #0E7A94);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(28,169,201,0.3);
}

/* Articles List */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.article-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    transition: all 0.3s;
    width: 100%;
}

.article-list-item:hover {
    background: #F0F9FF;
    border-color: rgba(28,169,201,0.15);
    transform: translateX(-3px);
}

.article-list-item.active {
    background: linear-gradient(135deg, #E0F6FB, #F0F9FF);
    border-color: #1CA9C9;
    box-shadow: 0 4px 15px rgba(28,169,201,0.15);
}

.article-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 1rem;
}

.article-list-icon.network { background: linear-gradient(135deg, #1CA9C9, #0E7A94); }
.article-list-icon.security { background: linear-gradient(135deg, #FF7A00, #E56B00); }
.article-list-icon.hardware { background: linear-gradient(135deg, #6F42C1, #553098); }
.article-list-icon.software { background: linear-gradient(135deg, #28A745, #1E7E34); }
.article-list-icon.infrastructure { background: linear-gradient(135deg, #E83E8C, #C2185B); }

.article-list-content {
    flex: 1;
    min-width: 0;
}

.article-list-content h6 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0A2540;
    margin: 0 0 4px 0;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-list-meta {
    display: flex;
    gap: 10px;
    font-size: 0.68rem;
    color: #718096;
    flex-wrap: wrap;
}

.article-list-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.article-list-meta i {
    color: #1CA9C9;
    font-size: 0.75rem;
}

.no-articles {
    padding: 30px 20px;
    text-align: center;
    color: #A0AEC0;
    font-size: 0.88rem;
}

/* Detail */
.articles-detail {
    background: white;
    border-radius: 20px;
    padding: 40px 45px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    min-height: 500px;
}

.article-detail-header {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 2px solid #F0F4F8;
}

.article-detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.article-detail-tag.network { background: #E0F6FB; color: #0E7A94; }
.article-detail-tag.security { background: #FFEDD5; color: #C2410C; }
.article-detail-tag.hardware { background: #EDE9FE; color: #553098; }
.article-detail-tag.software { background: #D1FAE5; color: #065F46; }
.article-detail-tag.infrastructure { background: #FCE7F3; color: #9D174D; }

.article-detail-title {
    font-size: 1.7rem;
    font-weight: 900;
    color: #0A2540;
    margin: 0 0 18px 0;
    line-height: 1.45;
}

.article-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 14px 18px;
    background: #F7FAFC;
    border-radius: 12px;
    font-size: 0.82rem;
    color: #4A5568;
    font-weight: 500;
}

.article-detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-detail-meta i {
    color: #1CA9C9;
    font-size: 0.95rem;
}

/* Cover Image */
.article-cover-image {
    margin-bottom: 30px;
    border-radius: 16px;
    overflow: hidden;
    background: #F7FAFC;
    display: flex;
    justify-content: center;
}

.article-cover-image img {
    width: 100%;
    height: auto;
    max-height: 500px;      /* ← حداکثر ارتفاع */
    object-fit: contain;    /* ← تصویر کامل، بدون برش */
    display: block;
}

/* Body */
.article-detail-body {
    color: #4A5568;
    font-size: 0.95rem;
    line-height: 2;
}

.article-detail-body p {
    margin-bottom: 18px;
    text-align: justify;
}

.article-detail-body h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0A2540;
    margin: 30px 0 15px 0;
    padding-right: 14px;
    border-right: 4px solid #1CA9C9;
}

.article-detail-body h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0E7A94;
    margin: 22px 0 12px 0;
}

.article-detail-body ul,
.article-detail-body ol {
    margin: 15px 0 20px 0;
    padding-right: 25px;
}

.article-detail-body li {
    margin-bottom: 10px;
    line-height: 1.9;
}

.article-detail-body li strong {
    color: #0A2540;
}

.article-detail-body code,
.article-detail-body pre {
    background: #0A2540;
    color: #4DD0E1;
    padding: 14px 18px;
    border-radius: 10px;
    display: block;
    direction: ltr;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    margin: 15px 0;
    overflow-x: auto;
}

.article-detail-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.article-detail-body table th {
    background: #1CA9C9;
    color: white;
    padding: 12px 15px;
    text-align: right;
    font-size: 0.88rem;
    font-weight: 700;
}

.article-detail-body table td {
    padding: 12px 15px;
    border-bottom: 1px solid #F0F4F8;
    font-size: 0.85rem;
}

.article-detail-body table tr:last-child td {
    border-bottom: none;
}

.article-detail-body table tr:hover td {
    background: #F0F9FF;
}

.article-detail-body blockquote {
    background: #F0F9FF;
    border-right: 4px solid #1CA9C9;
    padding: 18px 22px;
    margin: 20px 0;
    border-radius: 10px;
    font-style: italic;
    color: #0A2540;
}

/* CTA */
.article-detail-cta {
    margin-top: 40px;
    padding: 25px 30px;
    background: linear-gradient(135deg, #0A2540 0%, #0E3A5C 100%);
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    color: white;
    position: relative;
    overflow: hidden;
}

.article-detail-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(28,169,201,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.cta-content {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.cta-content > i {
    font-size: 2.2rem;
    color: #4DD0E1;
    flex-shrink: 0;
}

.cta-content strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.cta-content p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
}

.btn-article-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 26px;
    background: linear-gradient(135deg, #FF7A00, #E56B00);
    color: white;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 6px 18px rgba(255,122,0,0.3);
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.btn-article-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255,122,0,0.5);
    color: white;
    gap: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .articles-page { padding-top: 80px; }
    .articles-hero { padding: 40px 0 30px; }
    .articles-hero-title { font-size: 1.8rem; }
    .articles-hero-subtitle { font-size: 0.9rem; }
    .articles-content { padding: 30px 0 50px; }
    
    .articles-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .articles-sidebar {
        position: static;
        max-height: none;
        padding: 18px;
    }
    
    .articles-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .articles-detail { padding: 25px 22px; }
    .article-detail-title { font-size: 1.35rem; }
}

@media (max-width: 576px) {
    .articles-hero-title { font-size: 1.5rem; }
    .articles-list { grid-template-columns: 1fr; }
    .articles-detail { padding: 20px 16px; }
    .article-detail-title { font-size: 1.15rem; }
    .article-detail-meta { font-size: 0.75rem; gap: 12px; }
    .article-detail-body { font-size: 0.9rem; }
    .article-detail-body h3 { font-size: 1.05rem; }
    .article-detail-body h4 { font-size: 0.95rem; }
    .filter-btn { font-size: 0.7rem; padding: 6px 10px; }
    .article-detail-cta { padding: 20px; text-align: center; justify-content: center; }
    .btn-article-cta { width: 100%; justify-content: center; }
    .cta-content { flex-direction: column; text-align: center; }
}

/* ============================================================
   SIDEBAR SEARCH
   ============================================================ */
.sidebar-search {
    position: relative;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F0F4F8;
}

.sidebar-search i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #A0AEC0;
    font-size: 0.95rem;
    pointer-events: none;
    transition: color 0.25s;
}

.sidebar-search input {
    width: 100%;
    padding: 11px 40px 11px 14px;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    background: #F7FAFC;
    font-family: inherit;
    font-size: 0.85rem;
    color: #1A1A2E;
    transition: all 0.25s;
    outline: none;
}

.sidebar-search input::placeholder {
    color: #A0AEC0;
    font-size: 0.82rem;
}

.sidebar-search input:focus {
    border-color: #1CA9C9;
    background: white;
    box-shadow: 0 0 0 4px rgba(28, 169, 201, 0.1);
}

.sidebar-search input:focus + i,
.sidebar-search:focus-within i {
    color: #1CA9C9;
}

/* ★ دکمه پاک کردن سرچ — فقط ضربدر، بدون دایره */
.sidebar-search-clear {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: auto;
    background: transparent;           /* ★ بدون پس‌زمینه */
    color: #A0AEC0;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;                   /* ★ بزرگ‌تر برای وضوح */
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
    line-height: 1;
}

.sidebar-search-clear:hover {
    background: transparent;           /* ★ بدون پس‌زمینه */
    color: #DC3545;                    /* ★ فقط رنگ عوض میشه */
}

.sidebar-search-clear.show {
    display: flex;
}

.sidebar-search-clear.show {
    display: flex;
}

/* ★ پیام خالی */
.search-empty {
    padding: 30px 20px;
    text-align: center;
    color: #A0AEC0;
    font-size: 0.85rem;
    line-height: 1.7;
}

.search-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    color: #CBD5E0;
}

.search-empty strong {
    color: #4A5568;
    font-weight: 700;
}

/* ★ ریسپانسیو */
@media (max-width: 991.98px) {
    .sidebar-search {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    .sidebar-search input {
        padding: 10px 38px 10px 12px;
        font-size: 0.82rem;
    }
    .sidebar-search i {
        font-size: 0.88rem;
        right: 12px;
    }
}

/* ============================================================
   ★★★ DARK MODE — ARTICLES PAGE ★★★
   ============================================================ */
[data-theme="dark"] .articles-page {
    background: #0D1117;
}

[data-theme="dark"] .articles-hero {
    background: linear-gradient(135deg, #05080D 0%, #0A2540 100%);
}

[data-theme="dark"] .articles-sidebar {
    background: #1C2128;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .articles-sidebar::-webkit-scrollbar-thumb {
    background: #30363D;
}

[data-theme="dark"] .sidebar-filters {
    border-bottom-color: #30363D;
}

[data-theme="dark"] .filter-btn {
    background: #21262D;
    color: #B1BAC4;
    border-color: #30363D;
}

[data-theme="dark"] .filter-btn:hover {
    background: rgba(28, 169, 201, 0.15);
    border-color: #22B8D8;
    color: #4DD0E1;
}

[data-theme="dark"] .article-list-item:hover {
    background: rgba(28, 169, 201, 0.1);
    border-color: rgba(28, 169, 201, 0.3);
}

[data-theme="dark"] .article-list-item.active {
    background: rgba(28, 169, 201, 0.18);
    border-color: #22B8D8;
}

[data-theme="dark"] .article-list-content h6 {
    color: #E6EDF3;
}

[data-theme="dark"] .article-list-meta {
    color: #8B949E;
}

[data-theme="dark"] .articles-detail {
    background: #1C2128;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .article-detail-header {
    border-bottom-color: #30363D;
}

[data-theme="dark"] .article-detail-title {
    color: #E6EDF3;
}

[data-theme="dark"] .article-detail-meta {
    background: #161B22;
    color: #B1BAC4;
}

[data-theme="dark"] .article-detail-body {
    color: #B1BAC4;
}

[data-theme="dark"] .article-detail-body h3 {
    color: #E6EDF3;
}

[data-theme="dark"] .article-detail-body h4 {
    color: #4DD0E1;
}

[data-theme="dark"] .article-detail-body li strong {
    color: #E6EDF3;
}

[data-theme="dark"] .article-detail-body table {
    background: #161B22;
}

[data-theme="dark"] .article-detail-body table td {
    border-bottom-color: #30363D;
    color: #B1BAC4;
}

[data-theme="dark"] .article-detail-body table tr:hover td {
    background: rgba(28, 169, 201, 0.1);
}

[data-theme="dark"] .article-detail-body blockquote {
    background: rgba(28, 169, 201, 0.1);
    color: #E6EDF3;
}

[data-theme="dark"] .article-cover-image {
    background: #161B22;
}

[data-theme="dark"] .no-articles {
    color: #6E7681;
}

/* ★ Sidebar Search */
[data-theme="dark"] .sidebar-search {
    border-bottom-color: #30363D;
}

[data-theme="dark"] .sidebar-search input {
    background: #21262D;
    border-color: #30363D;
    color: #E6EDF3;
}

[data-theme="dark"] .sidebar-search input::placeholder {
    color: #6E7681;
}

[data-theme="dark"] .sidebar-search input:focus {
    background: #161B22;
    border-color: #22B8D8;
}

[data-theme="dark"] .sidebar-search-clear {
    color: #6E7681;
}

[data-theme="dark"] .search-empty {
    color: #6E7681;
}

[data-theme="dark"] .search-empty strong {
    color: #B1BAC4;
}

/* ★ Tags */
[data-theme="dark"] .article-detail-tag.network { background: rgba(28, 169, 201, 0.2); color: #4DD0E1; }
[data-theme="dark"] .article-detail-tag.security { background: rgba(255, 122, 0, 0.2); color: #FFA94D; }
[data-theme="dark"] .article-detail-tag.hardware { background: rgba(111, 66, 193, 0.25); color: #B197FC; }
[data-theme="dark"] .article-detail-tag.software { background: rgba(40, 167, 69, 0.2); color: #69DB7C; }
[data-theme="dark"] .article-detail-tag.infrastructure { background: rgba(232, 62, 140, 0.2); color: #F783AC; }

/* Fallback for aspect-ratio */
@supports not (aspect-ratio: 4/3) {
    .article-cover-image img {
        max-height: 500px;
    }
}