@font-face {
    font-family: 'IranSans';
    src: url('https://cdn.font-store.ir/iransans/woff/IRANSansWeb.woff') format('woff');
    font-weight: normal;
}

.ijpc-wrapper {
    direction: rtl;
    font-family: 'IranSans', 'Vazir', tahoma, sans-serif;
    margin: 20px 0;
    max-width: 100%;
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

/* Header & Controls */
.ijpc-header-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.ijpc-title-box h3 { margin: 0 0 5px 0; font-size: 18px; color: #333; }
.ijpc-date-badge { font-size: 11px; background: #eee; padding: 3px 8px; border-radius: 4px; color: #555; }

/* Input Group */
.ijpc-modern-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2px;
    width: 100%;
    max-width: 500px;
    background: #fdfdfd;
}

.ijpc-select-wrapper { position: relative; min-width: 140px; }
.ijpc-modern-select {
    width: 100%; border: none; background: transparent; padding: 10px 25px 10px 10px;
    font-family: inherit; font-size: 13px; outline: none; cursor: pointer; appearance: none;
}
.ijpc-select-arrow { position: absolute; left: 10px; top: 12px; font-size: 10px; color: #999; pointer-events: none; }

.ijpc-input-divider { width: 1px; height: 20px; background: #eee; margin: 0 5px; }

.ijpc-input-wrapper { flex-grow: 1; display: flex; align-items: center; position: relative; }
.ijpc-modern-input { width: 100%; border: none; background: transparent; padding: 10px; outline: none; font-family: inherit; }
.ijpc-search-icon { color: #ccc; margin-left: 10px; }

/* Table General */
.ijpc-table-container { 
    width: 100%;
}
.ijpc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ijpc-table thead { background: #f4f6f8; }
.ijpc-table th { padding: 12px; text-align: right; color: #555; font-weight: bold; border-bottom: 2px solid #eee; white-space: nowrap; cursor: pointer; }
.ijpc-table td { padding: 10px 12px; border-bottom: 1px solid #f1f1f1; vertical-align: middle; color: #333; }
.ijpc-table tr:hover { background-color: #f9fbfd; }

/* Status Colors */
.col-change { display: inline-block; padding: 3px 8px; border-radius: 5px; font-weight: bold; font-size: 12px; }
.col-change.up { background: #e6fffa; color: #047857; }
.col-change.down { background: #fff5f5; color: #c53030; }
.col-change.neutral { background: #f3f4f6; color: #6b7280; }

/* Button */
.ijpc-chart-btn {
    background: #ebf8ff; color: #3182ce; border: none; padding: 5px 10px;
    border-radius: 5px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 5px;
    transition: 0.2s;
}
.ijpc-chart-btn:hover { background: #3182ce; color: white; }

/* Modal */
.ijpc-modal {
    display: none; position: fixed; z-index: 99999; left: 0; top: 0;
    width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    align-items: center; justify-content: center;
}
.ijpc-modal-content {
    background: #fff; padding: 20px; width: 90%; max-width: 650px; border-radius: 12px;
    position: relative; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ijpc-close { position: absolute; left: 20px; top: 15px; font-size: 24px; cursor: pointer; color: #999; }
.ijpc-chart-container { height: 300px; width: 100%; margin-top: 15px; }


/* =======================================================
   RESPONSIVE CARD VIEW (Mobile)
   ======================================================= */
@media screen and (max-width: 768px) {
    
    .ijpc-modern-input-group { flex-wrap: wrap; }
    .ijpc-select-wrapper { width: 100%; border-bottom: 1px solid #eee; }
    .ijpc-input-divider { display: none; }

    /* مخفی کردن هدر جدول */
    .ijpc-table thead { display: none; }
    .ijpc-company-header { display: none; }

    /* تبدیل المان‌های جدول به بلاک */
    .ijpc-table, .ijpc-table tbody, .ijpc-table tr, .ijpc-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    /* استایل کارت */
    .ijpc-table tr {
        margin-bottom: 20px;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
        padding: 5px 0;
        overflow: hidden;
    }

    /* استایل سلول‌ها (وسط چین و درشت) */
    .ijpc-table td {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 12px 10px;
        border-bottom: 1px solid #f0f4f8;
        font-size: 16px; /* سایز عدد */
        font-weight: 800;
        color: #2d3748;
    }

    .ijpc-table td:last-child { border-bottom: none; }

    /* 1. استایل عمومی برای عنوان‌ها (لیبل‌ها) */
    .ijpc-table td::before {
        display: block;
        margin-bottom: 5px;
        font-size: 13px; /* سایز عنوان */
        color: #888;
        font-weight: normal;
    }

    /* 2. تعریف نام عنوان‌ها به صورت دستی (چون در PHP نیست) */
    .ijpc-table td:nth-of-type(1)::before { content: "شرکت سازنده"; }
    /* ستون دوم (نام خودرو) عنوان نمی‌خواهد */
    .ijpc-table td:nth-of-type(3)::before { content: "قیمت بازار"; }
    .ijpc-table td:nth-of-type(4)::before { content: "قیمت کارخانه"; }
    .ijpc-table td:nth-of-type(5)::before { content: "وضعیت بازار"; }
    .ijpc-table td:nth-of-type(6)::before { content: "میزان تغییر"; }
    .ijpc-table td:nth-of-type(7)::before { content: "آخرین بروزرسانی"; }

    /* 3. استایل هدر کارت (نام خودرو - ستون دوم) */
    .ijpc-table td:nth-of-type(2) {
        background: #ebf8ff;
        color: #2b6cb0;
        font-size: 18px;
        font-weight: 900;
        padding: 15px;
        border-bottom: 2px solid #bee3f8;
    }
    
    /* حذف عنوان برای نام خودرو تا فقط اسم ماشین دیده شود */
    .ijpc-table td:nth-of-type(2)::before {
        display: none;
    }

    /* دکمه نمودار */
    .ijpc-chart-btn {
        width: 90%;
        justify-content: center;
        padding: 12px;
        margin: 10px auto;
        font-size: 14px;
        border-radius: 8px;
    }
}

/* Tab Styles */
.ijpc-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.ijpc-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-family: 'IranSans', tahoma, sans-serif;
    font-size: 14px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    top: 2px;
}

.ijpc-tab-btn:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

.ijpc-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.ijpc-tab-content {
    display: none;
}

.ijpc-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal - نسخه بهبود یافته */
.ijpc-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

.ijpc-modal-content {
    background: #fff;
    padding: 25px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 16px;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ijpc-close {
    position: absolute;
    left: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ijpc-close:hover {
    color: #e53e3e;
    transform: scale(1.1);
}

#ijpc-modal-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.ijpc-chart-container {
    height: 400px;
    width: 100%;
    margin-top: 15px;
    background: #f9fafb;
    border-radius: 8px;
    padding: 15px;
}

#ijpc-loading {
    text-align: center;
    padding: 40px;
    font-size: 14px;
    color: #666;
}

/* Responsive Modal */
@media screen and (max-width: 768px) {
    .ijpc-modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .ijpc-chart-container {
        height: 300px;
        padding: 10px;
    }
}
