/* ===== Mag Page ===== */

.mag-title {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    margin: 0 0 8px;
}
.mag-subtitle {
    font-size: 13px;
    color: #666;
    line-height: 1.8;
    margin: 0 0 24px;
    max-width: 700px;
}

.mag-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

/* ===== Categories (tabs) ===== */
.mag-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 10px 20px;
}
.mag-cat-btn {
    padding: 7px 16px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #555;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.mag-cat-btn:hover {
    border-color: #d32f2f;
    color: #d32f2f;
}
.mag-cat-btn.active {
    background: #d32f2f;
    color: #fff;
    border-color: #d32f2f;
}

/* ===== Grid ===== */
.mag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.mag-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s;
}
.mag-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    transform: translateY(-2px);
}

.mag-card-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
	overflow: hidden;
    background: #f7f7f7;
}
.mag-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.mag-card:hover .mag-card-thumb img {
    transform: scale(1.05);
}

.mag-card-date {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,.95);
    color: #d32f2f;
    border-radius: 8px;
    padding: 4px 10px;
    text-align: center;
    line-height: 1.1;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.mag-card-date .day {
    display: block;
    font-size: 15px;
    font-weight: 700;
}
.mag-card-date .month {
    display: block;
    font-size: 10px;
    color: #666;
    font-weight: 600;
}

.mag-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.mag-card-cat {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #d32f2f;
    background: #fff0f0;
    padding: 2px 8px;
    border-radius: 10px;
    align-self: flex-start;
}

.mag-card-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mag-card-title a {
    color: #222;
    text-decoration: none;
}
.mag-card-title a:hover { color: #d32f2f; }

.mag-card-meta {
    font-size: 11px;
    color: #999;
}

.mag-card-excerpt {
    font-size: 12px;
    font-weight: 400;
    color: #777;
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* pهای داخل excerpt فونت والد را بگیرند */
.mag-card-excerpt p {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: inherit;
    margin: 0 0 4px;
}
.mag-card-excerpt p:last-child {
    margin-bottom: 0;
}

.mag-card-more {
    margin-top: auto;
    font-size: 12px;
    font-weight: 700;
    color: #d32f2f;
    text-decoration: none;
    padding-top: 6px;
}
.mag-card-more:hover { text-decoration: underline; }

/* ===== Sidebar ===== */
.mag-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mag-widget {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 18px;
}
.mag-widget-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Recent posts */
.mag-recent {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mag-recent-item {
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: opacity .2s;
}
.mag-recent-item:hover { opacity: .8; }
.mag-recent-item img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: #f7f7f7;
    flex-shrink: 0;
}
.mag-recent-item > div {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
}
.mag-recent-title {
    font-size: 12px;
    font-weight: 600;
    color: #222;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mag-recent-date {
    font-size: 10px;
    color: #999;
}

/* Categories list */
.mag-cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.mag-cat-list li {
    border-bottom: 1px solid #f5f5f5;
}
.mag-cat-list li:last-child { border-bottom: none; }
.mag-cat-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    transition: color .2s;
}
.mag-cat-list a:hover { color: #d32f2f; }
.cat-count {
    background: #f5f5f5;
    color: #666;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

/* Newsletter widget */
.mag-newsletter-widget p {
    font-size: 12px;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.7;
}
.mag-newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mag-newsletter-form input {
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
}
.mag-newsletter-form input:focus {
    outline: none;
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, .1);
}
.mag-newsletter-form button {
    padding: 9px 12px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s;
}
.mag-newsletter-form button:hover { background: #b71c1c; }
/* ============================================
   برچسب دسته‌بندی روی تصویر (پایین وسط)
   ============================================ */
.mag-card-cat {
    position: absolute;
    bottom: 3px; /* فاصله از پایین تصویر */
    left: 50%; /* قرارگیری در وسط */
    transform: translateX(-50%); /* تنظیم دقیق برای وسط‌چین شدن */

    background: rgb(253 234 234 / 0.9);; /* پس‌زمینه سفید شفاف */
    color: #d32f2f; /* رنگ متن (قرمز) */
    font-size: 11px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 2;
    white-space: nowrap;
}
/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .mag-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .mag-title { font-size: 20px; }
    .mag-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .mag-card-body { padding: 10px; }
    .mag-card-title { font-size: 13px; }
    .mag-card-excerpt { display: none; }
}
