/**
 * استایل‌های محتوای وبلاگ
 * شامل: جداول، نقل قول‌ها، لیست‌ها و سایر المان‌های محتوا
 */

/* ========================================
   جداول (Tables) - طرح جدید و مدرن
   ======================================== */

.text_box_main table {
    width: 100%;
    border-collapse: separate; /* Changed for border-radius on cells */
    border-spacing: 0;
    margin: 2.5rem 0;
    background-color: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
    overflow: hidden; /* Ensures border-radius is respected */
}

.text_box_main table thead {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.text_box_main table thead th {
    padding: 1rem 1.25rem;
    text-align: right;
    font-weight: 600;
    color: var(--bs-heading-color, #212529);
    border-bottom: 2px solid var(--bs-border-color, #dee2e6);
    border-left: 1px solid var(--bs-border-color, #dee2e6);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.text_box_main table thead th:last-child {
    border-left: none;
}

.text_box_main table tbody tr {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.text_box_main table tbody tr:last-child {
    border-bottom: none;
}

.text_box_main table tbody td {
    padding: 1rem 1.25rem;
    text-align: right;
    color: var(--bs-body-color, #495057);
    vertical-align: middle;
    border-left: 1px solid var(--bs-border-color, #dee2e6);
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    transition: background-color 0.2s ease-in-out;
}

.text_box_main table tbody tr:last-child td {
    border-bottom: none;
}

.text_box_main table tbody td:last-child {
    border-left: none;
}

.text_box_main table tbody td:hover {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.text_box_main table tbody td:first-child {
    font-weight: 500;
    color: var(--bs-body-color, #212529);
}

/* Responsive Table */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 2.5rem 0;
}

@media (max-width: 768px) {
    .text_box_main table {
        border: none;
        box-shadow: none;
    }

    .text_box_main table thead {
        display: none;
    }

    .text_box_main table tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
        padding: 0.5rem;
    }

    .text_box_main table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 0.75rem;
        border-bottom: 1px solid var(--bs-border-color-translucent, #e9ecef);
    }

    .text_box_main table tbody tr:last-child td:last-child {
        border-bottom: none;
    }

    .text_box_main table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        text-align: right;
        color: var(--bs-heading-color, #343a40);
        margin-left: 1rem;
    }
}

/* ========================================
   نقل قول‌ها (Blockquotes) - طرح جدید
   ======================================== */

.text_box_main blockquote {
    position: relative;
    margin: 2.5rem 0;
    padding: 1.5rem 2rem 1.5rem 2.5rem;
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    border-right: 4px solid var(--bs-primary, #0d6efd);
    border-radius: 0 8px 8px 0;
    color: var(--bs-body-color, #2c3e50);
    font-style: normal;
}

.text_box_main blockquote:before {
    content: '“';
    position: absolute;
    top: -10px;
    right: 15px;
    font-size: 4.5rem;
    color: var(--bs-primary, #0d6efd);
    opacity: 0.15;
    font-family: 'Times New Roman', serif;
    line-height: 1;
    z-index: 0;
}

.text_box_main blockquote p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.9;
    position: relative;
    z-index: 1;
}

.text_box_main blockquote footer,
.text_box_main blockquote cite {
    display: block;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--bs-secondary-color, #6c757d);
    font-style: normal;
    text-align: left;
}

.text_box_main blockquote footer:before,
.text_box_main blockquote cite:before {
    content: '— ';
}

/* نقل قول با رنگ‌های مختلف */
.text_box_main blockquote.blockquote-success {
    border-right-color: var(--bs-success, #198754);
}
.text_box_main blockquote.blockquote-success:before {
    color: var(--bs-success, #198754);
}

.text_box_main blockquote.blockquote-warning {
    border-right-color: var(--bs-warning, #ffc107);
}
.text_box_main blockquote.blockquote-warning:before {
    color: var(--bs-warning, #ffc107);
}

.text_box_main blockquote.blockquote-danger {
    border-right-color: var(--bs-danger, #dc3545);
}
.text_box_main blockquote.blockquote-danger:before {
    color: var(--bs-danger, #dc3545);
}

.text_box_main blockquote.blockquote-info {
    border-right-color: var(--bs-info, #0dcaf0);
}
.text_box_main blockquote.blockquote-info:before {
    color: var(--bs-info, #0dcaf0);
}

/* ========================================
   لیست‌ها (Lists)
   ======================================== */

.text_box_main ul,
.text_box_main ol {
    margin: 1.5rem 0;
    padding-right: 2rem;
    line-height: 1.8;
    list-style: none; /* حذف دایره پیش‌فرض */
}

.text_box_main ul li,
.text_box_main ol li {
    margin-bottom: 0.75rem;
    color: #495057;
}

.text_box_main ul li:before {
    content: '◆';
    color: #667eea;
    font-weight: bold;
    display: inline-block;
    width: 1.5rem;
    margin-right: -1.5rem;
}

/* لیست‌های تو در تو */
.text_box_main ul ul,
.text_box_main ol ul,
.text_box_main ul ol,
.text_box_main ol ol {
    margin: 0.5rem 0;
}

/* ========================================
   کدها (Code)
   ======================================== */

.text_box_main code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
    border: 1px solid #e9ecef;
}

.text_box_main pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.text_box_main pre code {
    background: transparent;
    padding: 0;
    border: none;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ========================================
   تصاویر (Images)
   ======================================== */

.text_box_main img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.text_box_main img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.text_box_main figure {
    margin: 2rem 0;
    text-align: center;
}

.text_box_main figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
}

/* ========================================
   خط جداکننده (HR)
   ======================================== */

.text_box_main hr {
    border: none;
    height: 2px;
    background: linear-gradient(to left, transparent, #667eea, transparent);
    margin: 3rem 0;
}

/* ========================================
   لینک‌ها (Links)
   ======================================== */

.text_box_main a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.text_box_main a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

/* ========================================
   باکس‌های اطلاعاتی (Alert Boxes)
   ======================================== */

.text_box_main .alert {
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
    border-right: 4px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.text_box_main .alert-info {
    background-color: #d1ecf1;
    border-right-color: #17a2b8;
    color: #0c5460;
}

.text_box_main .alert-success {
    background-color: #d4edda;
    border-right-color: #28a745;
    color: #155724;
}

.text_box_main .alert-warning {
    background-color: #fff3cd;
    border-right-color: #ffc107;
    color: #856404;
}

.text_box_main .alert-danger {
    background-color: #f8d7da;
    border-right-color: #dc3545;
    color: #721c24;
}

/* ========================================
   انیمیشن‌ها
   ======================================== */

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

.text_box_main table,
.text_box_main blockquote {
    animation: fadeInUp 0.6s ease-out;
}

/* ========================================
   حالت تاریک (Dark Mode)
   ======================================== */

[data-bs-theme="dark"] .text_box_main table tbody td:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .text_box_main blockquote {
    background-color: var(--bs-tertiary-bg, #212529);
}

[data-bs-theme="dark"] .text_box_main ul li,
[data-bs-theme="dark"] .text_box_main ol li {
    color: #ced4da; /* رنگ روشن‌تر برای متن لیست در حالت تاریک */
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .text_box_main table {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .text_box_main blockquote {
        box-shadow: none;
        border: 2px solid #000;
        background: #fff;
    }
}
