/* ==========================================================================
   استایل قالب AI Metrics Dashboard - تم مشکی
   نسخه نهایی با قاب‌های هم‌اندازه، کاروسل حرفه‌ای، و قاب‌های طوسی عکس‌دار
   ========================================================================== */

:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    --text-light: #e0e0e0;
    --text-muted: #a0a0a0;
    --green: #2ecc71;
    --red: #e74c3c;
    --blue: #3498db;
    --border-radius: 16px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.5);
    --carousel-height: 320px;
    --border-gray: #808080;   /* رنگ طوسی کادرها */
    --border-thin: 2px;       /* ضخامت نازک */
}

/* ==================== فونت ==================== */
@font-face {
    font-family: 'Ray-Black';
    src: url('../fonts/Ray-Black.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

body {
    font-family: 'Ray-Black', Tahoma, Arial, sans-serif;
    direction: rtl;
    text-align: right;
    background: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.site-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== نوار متحرک ==================== */
.dashboard-header-box {
    background: linear-gradient(90deg, #1a1a1a 0%, #2c2c2c 50%, #1a1a1a 100%);
    border: 1px solid #333;
    border-radius: var(--border-radius);
    padding: 15px 0;
    margin-bottom: 25px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
}
.dashboard-header-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    animation: slideLine 3s infinite;
}
@keyframes slideLine {
    0% { left: -100%; }
    100% { left: 100%; }
}
.ribbon-track {
    display: flex;
    width: fit-content;
    animation: scrollRibbon 20s linear infinite;
    white-space: nowrap;
}
.ribbon-track h2 {
    margin: 0;
    padding: 0 40px;
    font-size: 1.6rem;
    color: var(--text-light);
    font-weight: bold;
    display: inline-block;
}
@keyframes scrollRibbon {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* ==================== گرید اصلی ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.section-title-red {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 15px 0;
    padding: 10px 15px;
    text-align: right;
    border-right: 4px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
}

.section-title-green {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 15px 0;
    padding: 10px 15px;
    text-align: right;
    border-right: 4px solid #2ecc71;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 8px;
}

.main-red-area { display: flex; flex-direction: column; }

/* ==================== گرید ۳×۲ قاب‌های قرمز ==================== */
.red-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, var(--carousel-height)) !important;
    gap: 20px !important;
    width: 100% !important;
}

.red-item {
    display: block !important;
    width: 100% !important;
    height: var(--carousel-height) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: var(--carousel-height) !important;
    max-height: var(--carousel-height) !important;
}

/* ==================== کاروسل حرفه‌ای ==================== */
.hero-carousel {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #000;
    transition: box-shadow 0.4s ease;
}

.hero-carousel:hover {
    box-shadow: var(--shadow-hover);
}

.hero-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    pointer-events: none;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hero-slide-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 6s ease;
}

.hero-slide.active .hero-slide-bg {
    transform: scale(1.05);
}

.hero-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.9) 100%
    );
}

.hero-slide-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;      /* ← تغییر از flex-end به center */
    align-items: center;          /* ← وسط‌چین افقی */
    padding: 20px;
    text-align: center;           /* ← متن وسط‌چین */
    color: #fff;
}

.hero-category-badge {
    display: inline-block;
    background: rgba(46, 204, 113, 0.85);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
    /* align-self: flex-start;  ← حذف شد */
    backdrop-filter: blur(5px);
    text-decoration: none;
}

.hero-slide-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: opacity 0.3s ease;
    width: 100%;
    text-align: center;
}
.hero-slide-link:hover {
    opacity: 0.85;
}

.hero-slide-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: bold;
    color: #ffffff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;       /* ← از ۲ خط به ۳ خط */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 4.2em;
    max-height: 4.2em;
    text-align: center;           /* ← متن وسط‌چین */
}

.hero-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    z-index: 10;
    background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    pointer-events: none;
}

.hero-controls > * {
    pointer-events: auto;
}

.hero-nav-buttons {
    display: flex;
    gap: 8px;
}

.hero-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    padding: 0;
}

.hero-nav:hover {
    background: #fff;
    color: #121212;
    border-color: #fff;
    transform: scale(1.1);
}

.hero-nav:active {
    transform: scale(0.95);
}

.hero-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.2);
}

.hero-dot.active {
    width: 22px;
    border-radius: 4px;
    background: var(--blue);
}

/* ==================== ستون سبز - با عکس پس‌زمینه ==================== */
.sidebar-green {
    display: flex;
    flex-direction: column;
    gap: 20px;
    order: 2;
}

.green-box {
    background-color: var(--bg-card);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* 🟢 تغییر: قاب طوسی و نازک */
    border: var(--border-thin) solid var(--border-gray);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-light);
    cursor: pointer;
}

.green-box-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.85) 100%);
    transition: background 0.4s ease;
}

.green-box:hover .green-box-overlay {
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.7) 100%);
}

.green-box h3 {
    margin: 0;
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-light);
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.green-box:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-hover);
    /* در هاور، قاب کمی روشن‌تر می‌شود */
    border-color: #aaaaaa;
}

/* ==================== بخش آخرین اخبار ==================== */
.news-blue-area {
    background: var(--bg-card);
    border: var(--border-thin) solid var(--border-gray);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}
.news-header h3 {
    margin: 0 0 20px;
    font-size: 1.3rem;
    text-align: right;
    color: #ffffff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

/* گرید ۳ ستونه - ۹ خبر در ۳ ردیف */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 20px;
}

/* لینک تیتر خبر - بدون قاب و بدون پس‌زمینه */
.news-title-link {
    display: block;
    padding: 10px 15px 10px 0;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.6;
    border-bottom: 1px dashed #333;
    transition: all 0.3s ease;
    position: relative;
}

/* نشانگر کوچک قبل از هر تیتر */
.news-title-link::before {
    content: '◄';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--blue);
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

.news-title-link:hover {
    color: var(--blue);
    border-bottom-color: var(--blue);
    padding-right: 20px;
}

.news-title-link:hover::before {
    transform: translateY(-50%) translateX(-3px);
}

/* ==================== فوتر ==================== */
.site-footer {
    margin-top: 40px;
    text-align: center;
    padding: 25px;
    border-top: 1px solid #333;
    color: var(--text-muted);
}

/* ==================== ریسپانسیو ==================== */
@media (max-width: 992px) {
    :root {
        --carousel-height: 300px;
    }
    .dashboard-grid { grid-template-columns: 1fr; }
    .sidebar-green { flex-direction: row; flex-wrap: wrap; order: 1; }
    .green-box { flex: 1 1 30%; }
    .main-red-area { order: 2; }
    .red-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-rows: auto !important;
    }
    .news-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    :root {
        --carousel-height: 280px;
    }
    .sidebar-green { flex-direction: column; }
    .green-box { flex: 1 1 100%; }
    .red-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
    }
    .news-grid { grid-template-columns: 1fr; }
    .ribbon-track h2 { font-size: 1.2rem; }
    .hero-slide-title { font-size: 0.85rem; }
    .hero-nav { width: 32px; height: 32px; }
}