:root {
    --primary-color: #5c7cfa;
    --secondary-color: #1c1d33;
    --accent-color: #b794f4;
    --text-color: #2d3748;
    --light-color: #ffffff;
    --card-bg: #f8f9fc;
    --card-border: rgba(92, 124, 250, 0.5);
    --gradient-bg: linear-gradient(135deg, #5c7cfa, #b794f4);
}

body {
    font-family: 'Vazirmatn', 'Roboto', sans-serif;
    background: var(--secondary-color);
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    padding-top: 80px;
    position: relative;
    overflow-x: hidden;
}

#particles-js {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.laws-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.article-meta {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 15px;
}

.article-list {
    list-style: none;
    padding: 0;
}

.article-list li {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--light-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-list li:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(92, 124, 250, 0.4);
}

.article-list li a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.article-list li a:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.pagination .page-item {
    margin: 5px;
}

.pagination a {
    color: var(--text-color);
    background: var(--light-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 8px 15px;
    transition: background 0.3s, color 0.3s;
}

.pagination a:hover {
    background: var(--primary-color);
    color: var(--light-color);
}

.pagination .active a {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--light-color);
}

.form-control, .form-select {
    background: var(--light-color);
    color: var(--text-color);
    border-color: var(--card-border);
    border-radius: 8px;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    background: var(--light-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(92, 124, 250, 0.3);
}

.form-control::placeholder {
    color: #6b7280;
    opacity: 0.7;
}

.category-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 5px;
    background: var(--light-color);
}

.btn-primary {
    background: var(--gradient-bg);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(92, 124, 250, 0.5);
}

.suggestions {
    position: absolute;
    background: var(--light-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.suggestions div {
    padding: 10px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s;
}

.suggestions div:hover {
    background: var(--primary-color);
    color: var(--light-color);
}

.d-none {
    display: none;
}

.law-group {
    margin-bottom: 30px;
}

.law-group h3 {
    color: var(--primary-color);
    text-align: center;
    border: 1px solid var(--card-border);
    padding: 15px;
    border-radius: 10px;
    background: var(--light-color);
    font-weight: 700;
}

.law-group ul {
    list-style: none;
    padding: 0;
    column-count: 3;
    column-gap: 20px;
}

.law-group li {
    margin-bottom: 10px;
    break-inside: avoid;
}

.law-group a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.law-group a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.item-sharing {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.item-sharing ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 15px;
}

.item-sharing li {
    margin: 0;
}

.item-sharing a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.3s, transform 0.3s;
}

.item-sharing a:hover {
    transform: scale(1.1);
}

.item-sharing .copy a {
    background-color: #6a1b9a;
    color: #fff;
}

.item-sharing .wa a {
    background-color: #25d366;
    color: #fff;
}

.item-sharing .tg a {
    background-color: #0088cc;
    color: #fff;
}

.navbar {
    background: rgba(28, 29, 51, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.navbar-brand img {
    height: 35px;
    margin-right: 10px;
}

.nav-link {
    color: #ffffff !important;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--accent-color) !important;
}

footer {
    background: var(--secondary-color);
    color: var(--light-color);
    text-align: center;
    padding: 15px 0;
    margin-top: 30px;
    border-top: 1px solid var(--card-border);
    font-size: 0.9rem;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.comment-section, .related-section {
    margin-top: 40px;
}

.comment-prompt, .related-prompt {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 600;
}

.comment-form, .reply-form, .related-form, .related-reply-form {
    margin-bottom: 20px;
    display: none;
}

.comment-form.active, .reply-form.active, .related-form.active, .related-reply-form.active {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment, .related {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--light-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.comment:hover, .related:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(92, 124, 250, 0.3);
}

.comment-profile {
    flex-shrink: 0;
    margin-left: 15px;
}

.comment-profile img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.comment-content, .related-content {
    flex-grow: 1;
}

.comment-user {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.comment-user a {
    color: var(--primary-color);
    text-decoration: none;
}

.comment-user a:hover {
    text-decoration: underline;
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 10px;
}

.comment-replies, .related-replies {
    margin-right: 20px;
    padding-right: 20px;
    border-right: 2px solid var(--accent-color);
}

.reply, .related-reply {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    margin-bottom: 10px;
    position: relative;
}

.reply-connector {
    width: 2px;
    height: 100%;
    background: var(--accent-color);
    position: absolute;
    right: -22px;
    top: 0;
}

.reply-connector::before {
    content: '';
    position: absolute;
    top: -5px;
    right: -3px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--accent-color);
}

.reply-connector::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: -3px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--accent-color);
}

.reply-form, .related-reply-form {
    position: relative;
}

.form-content {
    flex-grow: 1;
}

.related-title {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
}

.related-title:hover {
    color: var(--primary-color);
}

.reply-link {
    cursor: pointer;
    color: var(--accent-color);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.3s;
}

.reply-link:hover {
    color: var(--primary-color);
}

.comment-pins {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.comment-pin {
    display: flex;
    align-items: center;
    background: rgba(92, 124, 250, 0.1);
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 0.85rem;
}

.comment-pin img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    margin-right: 8px;
}

.error-message {
    color: #ff4d4d;
    font-size: 0.9rem;
    margin-top: 10px;
}

.view-more-btn {
    display: block;
    margin: 20px auto;
    text-align: center;
    background: var(--gradient-bg);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    color: var(--light-color);
    transition: all 0.3s ease;
    max-width: 200px;
}

.view-more-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(92, 124, 250, 0.5);
    background: var(--primary-color);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .law-group ul {
        column-count: 1;
    }
    .laws-container {
        padding: 15px;
    }
    .comment-profile img {
        width: 40px;
        height: 40px;
    }
    .category-container {
        max-height: 150px;
    }
    .comment-replies, .related-replies {
        margin-right: 10px;
        padding-right: 10px;
        border-right-width: 1px;
    }
    .reply-connector {
        right: -12px;
        width: 1px;
    }
    .reply-connector::before, .reply-connector::after {
        border-left-width: 4px;
        border-right-width: 4px;
        border-bottom-width: 4px;
        border-top-width: 4px;
        right: -4px;
    }
    .comment, .related, .reply, .related-reply {
        padding: 10px;
        flex-direction: row;
        align-items: flex-start;
    }
    .comment-profile {
        margin-left: 0;
        margin-bottom: 10px;
    }
    .comment-content p, .related-text {
        font-size: 0.9rem;
        word-break: break-word;
        white-space: pre-wrap;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.4;
    }
    .laws-container {
        overflow-x: hidden;
    }
    .comment-section, .related-section {
        overflow-x: hidden;
    }
    .comment-content, .related-content {
        min-width: 0;
    }
    .comment-replies .reply .comment-content, .related-replies .related-reply .comment-content {
        padding-right: 10px;
    }
    .reply-form .form-content, .related-reply-form .form-content {
        width: 100%;
    }
    .reply-form textarea, .related-reply-form textarea {
        width: 100%;
        min-height: 80px;
    }
}

@media (max-width: 576px) {
    .comment-profile img {
        width: 35px;
        height: 35px;
    }
    .comment-user, .comment-date {
        font-size: 0.8rem;
    }
    .reply-link {
        font-size: 0.8rem;
    }
    .reply-connector {
        right: -8px;
    }
    .comment-replies, .related-replies {
        margin-right: 5px;
        padding-right: 5px;
    }
}

.accordion-button {
    background-color: var(--light-color);
    color: var(--primary-color);
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background-color: var(--primary-color);
    color: var(--light-color);
}

.accordion-body ul {
    column-count: 1;
    padding: 0;
    list-style: none;
}

@media (min-width: 768px) {
    .accordion-body ul {
        column-count: 3;
    }
}

.back-to-law {
    margin-right: 10px;
}

.btn-minimal {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 50px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-minimal i {
    margin: 0;
}

.share-buttons .btn-minimal {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.share-buttons .btn-minimal:hover {
    background-color: var(--primary-color);
    color: var(--light-color);
}

.back-to-list, .back-to-law {
    margin-top: 20px;
}

.new-item {
    animation: highlight 2s ease-out;
}

@keyframes highlight {
    0% { background-color: rgba(92, 124, 250, 0.3); }
    100% { background-color: transparent; }
}

/* استایل‌های جدید برای نمایش بهتر نتایج جستجو */
.search-results-info {
    background: var(--light-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
}

.search-results-count {
    font-weight: 700;
    color: var(--primary-color);
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-color);
    opacity: 0.7;
}

.search-highlight {
    background-color: rgba(255, 235, 59, 0.3);
    padding: 2px 4px;
    border-radius: 4px;
}

.search-form-container {
    background: var(--light-color);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 1px solid var(--card-border);
}

.advanced-search-toggle {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 10px;
}

.advanced-search-fields {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--card-border);
}

/* اضافه کردن margin-bottom به container اصلی */
.laws-container {
    margin-bottom: 20px; /* فضای کافی برای فوتر */
}

/* تغییر موقعیت فوتر به relative و اضافه کردن padding */
footer {
    position: relative;
    margin-top: 50px;
}

/* استایل برای دکمه‌های بازگشت */
.back-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px 0;
    justify-content: center;
}

.back-to-list, .back-to-law {
    margin: 0;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

/* بهبود ریسپانسیو برای کامنت‌ها و سنجاق‌ها */
@media (max-width: 768px) {
    .comment, .related, .reply, .related-reply {
        flex-direction: column;
        padding: 12px;
    }
    .comment-profile {
        margin-left: 0;
        margin-bottom: 12px;
        align-self: flex-start;
    }
    .comment-profile img {
        width: 45px;
        height: 45px;
    }
    .comment-content, .related-content {
        width: 100%;
    }
    .comment-replies, .related-replies {
        margin-right: 0;
        padding-right: 0;
        border-right: none;
        border-left: 2px solid var(--accent-color);
        padding-left: 15px;
        margin-left: 10px;
    }
    .reply-connector {
        right: auto;
        left: -12px;
        width: 1px;
    }
    .reply-connector::before {
        right: auto;
        left: -3px;
    }
    .reply-connector::after {
        right: auto;
        left: -3px;
    }
    .comment-user {
        font-size: 0.95rem;
    }
    .comment-date {
        font-size: 0.8rem;
    }
    .comment-content p, .related-text {
        font-size: 0.9rem;
        line-height: 1.6;
        text-align: justify;
    }
    /* بهبود فرم‌ها در موبایل */
    .comment-form.active, .reply-form.active,
    .related-form.active, .related-reply-form.active {
        padding: 12px;
        margin: 12px 0;
    }
    .form-control {
        font-size: 0.9rem;
        padding: 10px;
    }
    /* بهبود دکمه‌ها در موبایل */
    .btn-primary {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    /* بهبود نمایش متن در موبایل */
    #article-text {
        font-size: 1rem;
        line-height: 1.8;
        text-align: justify;
    }
    /* بهبود بخش اشتراک‌گذاری */
    .item-sharing ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    .item-sharing li {
        margin: 5px;
    }
    /* بهبود پین‌های کامنت */
    .comment-pins {
        justify-content: center;
    }
    .comment-pin {
        margin: 5px;
        font-size: 0.8rem;
    }
    .comment-pin img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 576px) {
    .laws-container {
        padding: 12px;
        margin-bottom: 80px;
    }
    h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    .article-meta {
        font-size: 0.8rem;
    }
    .comment-prompt, .related-prompt {
        font-size: 1.1rem;
        text-align: center;
    }
    /* بهبود نمایش دکمه‌های بازگشت در موبایل */
    .back-buttons-container {
        flex-direction: column;
        gap: 8px;
    }
    .back-to-list, .back-to-law {
        min-width: 100%;
        padding: 10px;
    }
    /* بهبود نمایش لیست مقالات */
    .article-list li {
        padding: 15px;
    }
    .article-list li h5 {
        font-size: 1rem;
    }
    .article-list li p {
        font-size: 0.9rem;
    }
    /* بهبود پاگیشن */
    .pagination {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 10px;
    }
    .pagination .page-item {
        flex-shrink: 0;
    }
}

/* بهبود نمایش متن فارسی */
.comment-content p, .related-text, #article-text {
    line-height: 1.8;
    text-align: justify;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* بهبود فوتر در موبایل */
@media (max-width: 768px) {
    footer {
        padding: 12px 0;
        font-size: 0.8rem;
        position: relative;
    }
}

/* انیمیشن‌های بهتر برای موبایل */
@media (max-width: 768px) {
    .animate__animated {
        animation-duration: 0.6s;
    }
}

/* بهبود اسکرول در موبایل */
@media (max-width: 768px) {
    .laws-container {
        overflow-x: hidden;
    }
    .comment-section, .related-section {
        overflow-x: hidden;
    }
}

/* بهبود نمایش suggestions در موبایل */
@media (max-width: 768px) {
    .suggestions {
        max-width: 100%;
        left: 0;
        right: 0;
    }
}

/* آیکون آکاردیون */
.accordion-button .accordion-icon {
    transition: transform 0.2s ease-in-out;
    margin-left: 10px;
}

.accordion-button.collapsed .accordion-icon {
    transform: rotate(0deg);
}

.accordion-button:not(.collapsed) .accordion-icon {
    transform: rotate(180deg);
}

/* استایل برای دکمه‌های قبلی و بعدی */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-btn {
    padding: 10px 20px;
    background: var(--gradient-bg);
    color: var(--light-color);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
}

.nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(92, 124, 250, 0.5);
}

.nav-btn.disabled {
    background: gray;
    pointer-events: none;
}
.small-title h5 {
    font-size: 50%;
}
