/* ==========================================================================
   استایل اصلی مودال (پنجره پاپ‌آپ)
   ========================================================================== */
#csg-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.8); z-index: 2000000003;
    display: none; /* در ابتدا مخفی با display */
    justify-content: center; align-items: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 20px; box-sizing: border-box;
}
#csg-modal-overlay.csg-visible {
    opacity: 1;
    visibility: visible;
}
#csg-modal-content {
    background-color: #fff; padding: 25px; border-radius: 8px; position: relative;
    max-width: 95%; width: 650px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    transform: scale(0.95); transition: transform 0.3s ease;
}
#csg-modal-overlay.csg-visible #csg-modal-content {
    transform: scale(1);
}
.csg-modal-title { font-size: 22px; font-weight: 600; margin: 0 0 15px; padding-bottom: 15px; border-bottom: 1px solid #eee; text-align: center; }
#csg-close-modal-button { position: absolute; top: 10px; left: 10px; background: transparent; border: none; font-size: 30px; cursor: pointer; color: #aaa; width: 40px; height: 40px; line-height: 40px; text-align: center; transition: color 0.2s; }
#csg-close-modal-button:hover { color: #333; }
#csg-modal-image-container { margin-bottom: 20px; text-align: center; }
#csg-modal-image-container img { max-width: 100%; height: auto; border-radius: 4px; }
#csg-modal-table-container table { width: 100%; border-collapse: collapse; }
#csg-modal-table-container th, #csg-modal-table-container td { padding: 12px 15px; text-align: center; border: 1px solid #e1e1e1; }
#csg-modal-table-container th { background-color: #f8f8f8; font-weight: bold; color: #555; }
#csg-modal-table-container tr:nth-child(even) { background-color: #fdfdfd; }

/* ==========================================================================
   استایل دکمه و آیکون
   ========================================================================== */
.csg-button-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    gap: 0.6em; /* فاصله بین آیکون و متن */
}
.csg-button-base .csg-button-icon-img {
    height: 1.2em; /* ارتفاع آیکون */
    width: auto;
    vertical-align: middle;
}

/* --- کد جدید برای پنهان کردن پوشش خالی --- */
.csg-button-wrapper:empty {
    display: none;
}

/* ==========================================================================
   [ویژگی جدید] استایل تب‌های داخل مودال
   ========================================================================== */
.csg-modal-tabs {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    display: flex;
    border-bottom: 2px solid #eee;
}
.csg-modal-tabs li {
    margin: 0;
    padding: 0;
}
.csg-tab-link {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    border: 2px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
}
.csg-tab-link:hover {
    background-color: #f8f8f8;
    color: #333;
}
.csg-tab-link.active {
    color: #333;
    border-color: #eee;
    background-color: #fff;
    border-bottom-color: #fff;
}
.csg-tab-panel {
    display: none;
}
.csg-tab-panel.active {
    display: block;
}
.csg-guide-content {
    line-height: 1.7;
}
.csg-guide-content h1, .csg-guide-content h2, .csg-guide-content h3, .csg-guide-content h4 {
    margin-top: 0;
}
.csg-guide-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
/* Ensure table inside tab panel has same style */
.csg-tab-panel table {
    width: 100%; border-collapse: collapse;
}
.csg-tab-panel th, .csg-tab-panel td {
    padding: 12px 15px; text-align: center; border: 1px solid #e1e1e1;
}
.csg-tab-panel th {
    background-color: #f8f8f8; font-weight: bold; color: #555;
}
.csg-tab-panel tr:nth-child(even) {
    background-color: #fdfdfd;
}

/* ==========================================================================
   واکنش‌گرایی جدول برای موبایل
   ========================================================================== */
@media screen and (max-width: 600px) { 
    #csg-modal-content { padding: 15px; } 
    .csg-modal-title { font-size: 18px; } 
    #csg-modal-table-container table thead, .csg-tab-panel table thead { display: none; } 
    #csg-modal-table-container table, .csg-tab-panel table, 
    #csg-modal-table-container table tbody, .csg-tab-panel table tbody, 
    #csg-modal-table-container table tr, .csg-tab-panel table tr, 
    #csg-modal-table-container table td, .csg-tab-panel table td { 
        display: block; 
        width: 100%; 
        box-sizing: border-box; 
    } 
    #csg-modal-table-container table tr, .csg-tab-panel table tr { 
        margin-bottom: 15px; 
        border: 1px solid #ddd; 
        border-radius: 4px; 
        overflow: hidden; 
    } 
    #csg-modal-table-container table td, .csg-tab-panel table td { 
        text-align: right; 
        padding-left: 50%; 
        position: relative; 
        border: none; 
        border-bottom: 1px solid #eee; 
    } 
    #csg-modal-table-container table td:last-child, .csg-tab-panel table td:last-child { 
        border-bottom: none; 
    } 
    #csg-modal-table-container table td:before, .csg-tab-panel table td:before { 
        content: attr(data-label); 
        position: absolute; 
        left: 0; 
        top: 0; 
        bottom: 0; 
        width: 45%; 
        padding: 12px 15px; 
        font-weight: bold; 
        text-align: left; 
        background-color: #f8f8f8; 
        box-sizing: border-box; 
    } 
}