/* --- Carousel --- */
.nilay-carousel-wrapper {
    position: relative;
    padding-bottom: 30px;
    direction: ltr;
}

.nilay-carousel {
    overflow: hidden;
    position: relative;
}

.nilay-carousel-track {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 10px 0;
}

.nilay-carousel-track::-webkit-scrollbar {
    display: none;
}

.nilay-carousel-item {
    flex-shrink: 0;
    box-sizing: border-box;
}

.nilay-item-inner {
    position: relative;
    height: 100%;
}

.nilay-full-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.nilay-prev,
.nilay-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--n-nav-size, 40px);
    height: var(--n-nav-size, 40px);
    background: var(--n-nav-bg, #fff);
    color: var(--n-nav-color, #333);
    border: 1px solid #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nilay-prev {
    left: 10px;
}

.nilay-next {
    right: 10px;
}

.nilay-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.nilay-dot {
    width: var(--n-dot-size, 10px);
    height: var(--n-dot-size, 10px);
    background: var(--n-dot-color, #ccc);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.nilay-dot.active {
    background: var(--n-dot-active, #2196F3);
    transform: scale(1.2);
}

/* --- TOC --- */
.nilay-toc-widget {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}

.nilay-toc-title {
    margin: 0 0 10px 0;
    font-size: var(--t-title-size, 18px);
    color: var(--t-title-color, #000);
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
    display: inline-block;
}

.nilay-toc-list {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

.nilay-toc-list li {
    position: relative;
    padding-right: 20px;
    margin-bottom: 5px;
}

.nilay-toc-list li::before {
    content: '•';
    position: absolute;
    right: 0;
    top: 0;
    color: var(--t-bullet-color, #2196F3);
    font-size: var(--t-bullet-size, 20px);
    line-height: 1;
}

.nilay-toc-list a {
    text-decoration: none;
    font-size: var(--t-item-size, 14px);
    color: var(--t-item-color, #333);
    transition: color 0.2s;
}

.nilay-toc-list a:hover {
    color: var(--t-bullet-color);
}

.nilay-toc-level-2 {
    margin-right: 0;
}

.nilay-toc-level-3 {
    margin-right: 15px;
}

/* --- Search Widget --- */
.nilay-search-wrapper {
    position: relative;
    padding: var(--s-pad);
    margin: var(--s-mar);
    border: 1px solid var(--s-border-col);
    border-radius: var(--s-radius);
    background: #fff;
    direction: rtl;
}

.nilay-search-box {
    display: flex;
    align-items: stretch;
    gap: var(--s-input-gap);
}

.nilay-search-wrapper .nilay-search-input {
    width: var(--s-input-w);
    border: none;
    background: transparent;
    padding: 0 10px;
    font-size: var(--s-input-size);
    color: var(--s-text-col) !important;
    outline: none;
    height: auto;
    font-family: inherit;
}

.nilay-search-wrapper .nilay-search-btn {
    width: var(--s-btn-w);
    background: var(--s-btn-bg) !important;
    color: var(--s-btn-text) !important;
    border: none;
    border-radius: var(--s-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: var(--s-btn-size);
    transition: all 0.3s;
    padding: 10px;
    white-space: nowrap;
}

.nilay-search-wrapper .nilay-search-btn:hover {
    background: var(--s-btn-hover) !important;
}

.nilay-search-icon {
    font-size: var(--s-icon-size);
    color: var(--s-icon-col);
}

.nilay-search-btn:hover .nilay-search-icon {
    color: var(--s-icon-hover);
}

/* --- Search Results --- */
.nilay-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--s-res-bg, #fff) !important;
    z-index: 999;
    display: none;
    margin-top: 5px;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--s-res-shadow, 0 10px 30px rgba(0, 0, 0, 0.1)) !important;
    overflow: hidden;
    border: 1px solid var(--s-res-border, #eee) !important;
    direction: rtl !important;
    text-align: right !important;
}

.nilay-search-section {
    border-bottom: 1px solid #f0f0f0;
}

.nilay-search-cat-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #444;
    transition: background 0.2s;
    justify-content: flex-start;
}

.nilay-search-cat-item:hover {
    background: #f9f9f9;
}

.nilay-search-cat-item i {
    margin-left: 10px;
    color: var(--s-cat-icon-col, #999);
    font-size: var(--s-cat-icon-size, 14px);
    order: 1;
    flex-shrink: 0;
}

.nilay-search-cat-item span {
    order: 2;
}

.nilay-search-prod-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f9f9f9;
    transition: background 0.2s;
    justify-content: flex-start;
    text-align: right;
}

.nilay-search-prod-item:hover {
    background: #f5f5f5;
}

.nilay-si-thumb {
    width: 40px;
    height: 40px;
    margin-left: 10px;
    flex-shrink: 0;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    order: 1;
}

.nilay-si-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nilay-si-info {
    flex-grow: 1;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
    order: 2;
}

.nilay-view-more-wrapper {
    padding: 10px;
    background: transparent;
    text-align: center;
}

.nilay-view-more-btn {
    display: block;
    width: 100%;
    padding: 10px 0;
    background: var(--s-vm-bg) !important;
    color: var(--s-vm-color) !important;
    font-size: var(--s-vm-size);
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background 0.3s;
}

.nilay-view-more-btn:hover {
    background: var(--s-vm-bg-h) !important;
    color: var(--s-vm-color-h) !important;
}

.nilay-no-result {
    padding: 15px;
    text-align: center;
    color: #777;
}

/* --- Filters Widget --- */
.nilay-filter-widget {
    background: var(--nf-bg, #fff);
    border: 1px solid var(--nf-border, #eee);
    border-radius: var(--nf-radius, 8px);
    box-shadow: var(--nf-shadow, none);
    padding: var(--nf-pad, 15px);
    margin: var(--nf-mar, 20px);
    width: var(--nf-width, 100%);
    box-sizing: border-box;
    direction: rtl;
}

.nilay-filter-block {
    margin-bottom: 20px;
    border-bottom: 1px solid #f5f5f5;
    padding-bottom: 15px;
}

.nilay-filter-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.nilay-fb-title {
    font-size: var(--nf-title-size, 18px);
    color: var(--nf-title-col, #333);
    margin: 0 0 10px 0;
    font-weight: bold;
}

.nilay-fb-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.nilay-filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.nilay-filter-option input {
    margin-left: 8px;
    accent-color: var(--nf-accent, #2196F3);
}

.nilay-filter-option .nfo-text {
    font-weight: 500;
    font-size: var(--nf-text-size, 14px);
    color: var(--nf-text-col, #666);
    flex-grow: 1;
}

.nilay-filter-option .nfo-count {
    font-size: 11px;
    color: #aaa;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 10px;
}

.nilay-filter-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: var(--nf-text-size, 14px);
    color: var(--nf-text-col, #666);
}

/* Price Slider UI */
.nilay-price-filter {
    padding: 10px 5px;
}

.nilay-price-slider {
    margin-bottom: 15px;
    background: #eee;
    height: 6px;
    border-radius: 3px;
    position: relative;
}

.nilay-price-slider .ui-slider-range {
    background: var(--nf-accent, #2196F3);
    position: absolute;
    height: 100%;
    border-radius: 3px;
}

.nilay-price-slider .ui-slider-handle {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid var(--nf-accent, #2196F3);
    border-radius: 50%;
    position: absolute;
    top: -5px;
    cursor: pointer;
    outline: none;
}

.nilay-price-inputs {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.nilay-filter-submit {
    width: 100%;
    padding: 10px;
    background: var(--nf-accent, #2196F3);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
    transition: background 0.3s;
}

.nilay-filter-submit:hover {
    background: var(--nf-accent-h, #1976D2);
}

.nilay-auto-submit .nilay-filter-submit {
    display: none !important;
}

.nilay-clear-filters-wrapper {
    text-align: center;
    margin-top: 10px;
}

.nilay-clear-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 12px;
    color: #b32d2e;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.nilay-clear-filters-btn:hover {
    background: #fff0f0;
    color: #d63638;
}

/* --- CUSTOM CARD BUILDER STYLES --- */
.nilay-card-container {
    background-color: var(--nc-bg);
    border: 1px solid var(--nc-border);
    border-radius: var(--nc-radius);
    padding: var(--nc-pad);
    box-shadow: var(--nc-shadow);
    display: flex;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    direction: rtl;
    transition: all 0.3s ease;
}

/* Layout Variations */
.nilay-layout-top {
    flex-direction: column;
}

.nilay-layout-bottom {
    flex-direction: column-reverse;
}

.nilay-layout-left {
    flex-direction: row;
    align-items: center;
}

.nilay-layout-right {
    flex-direction: row-reverse;
    align-items: center;
}

@media (max-width: 600px) {

    .nilay-layout-left,
    .nilay-layout-right {
        flex-direction: column !important;
    }

    .nilay-card-image-wrap {
        width: 100% !important;
        margin: 0 0 15px 0 !important;
    }
}

/* Image Wrapper */
.nilay-card-image-wrap {
    position: relative;
    flex-shrink: 0;
    width: var(--nc-img-w);
    padding: var(--nc-img-pad);
    box-sizing: border-box;
}

.nilay-layout-top .nilay-card-image-wrap {
    margin-bottom: var(--nc-img-mar);
    width: 100%;
}

.nilay-layout-bottom .nilay-card-image-wrap {
    margin-top: var(--nc-img-mar);
    width: 100%;
}

.nilay-layout-left .nilay-card-image-wrap {
    margin-left: var(--nc-img-mar);
}

.nilay-layout-right .nilay-card-image-wrap {
    margin-right: var(--nc-img-mar);
}

.nilay-card-image-wrap img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--nc-img-radius);
    object-fit: cover;
}

/* Content Wrapper */
.nilay-card-content-wrap {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Typography */
.nilay-card-title {
    margin: 0 0 10px;
    line-height: 1.4;
    text-align: var(--nc-title-align);
}

.nilay-card-title a {
    color: var(--nc-title-col);
    font-size: var(--nc-title-size);
    text-decoration: none;
    transition: opacity 0.2s;
}

.nilay-card-title a:hover {
    opacity: 0.8;
}

.nilay-card-desc {
    color: var(--nc-desc-col);
    font-size: var(--nc-desc-size);
    margin-bottom: 15px;
    line-height: 1.6;
    text-align: var(--nc-desc-align);
}

/* Price & Meta */
.nilay-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: var(--nc-price-align);
}

/* راست = flex-start چون جهت RTL است، اما برای اطمینان بیشتر */
.nilay-card-meta[style*="right"] {
    justify-content: flex-start;
}

.nilay-card-meta[style*="left"] {
    justify-content: flex-end;
}

.nilay-card-meta[style*="center"] {
    justify-content: center;
}

.nilay-card-price {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: var(--nc-price-align);
}

.nilay-card-price del {
    opacity: 0.6;
    font-size: 0.9em;
}

.nilay-card-price .amount {
    color: var(--nc-price-col);
    font-size: var(--nc-price-size);
}

.nilay-card-price ins .amount {
    color: var(--nc-sale-col);
    font-size: var(--nc-sale-size);
}

/* Badges */
.nilay-card-badge {
    background: var(--nc-badge-bg);
    color: var(--nc-badge-col);
    font-size: var(--nc-badge-size);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.2;
}

.nilay-badge-overlay {
    position: absolute;
    z-index: 2;
}

.pos-img_left {
    top: 10px;
    left: 10px;
}

.pos-img_right {
    top: 10px;
    right: 10px;
}

/* Buttons */
.nilay-card-actions {
    margin-top: auto;
    display: flex;
    justify-content: var(--nc-actions-align);
}

.nilay-card-btn {
    display: inline-block;
    background: var(--nc-btn-bg);
    color: var(--nc-btn-col);

    padding-top: var(--nc-btn-pt);
    padding-right: var(--nc-btn-pr);
    padding-bottom: var(--nc-btn-pb);
    padding-left: var(--nc-btn-pl);

    margin-top: var(--nc-btn-mt);
    margin-right: var(--nc-btn-mr);
    margin-bottom: var(--nc-btn-mb);
    margin-left: var(--nc-btn-ml);

    font-size: var(--nc-btn-fs);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
    width: var(--nc-btn-w);
    box-sizing: border-box;
    line-height: 1.4;
}

.nilay-card-btn:hover {
    background: var(--nc-btn-bg-h);
    color: var(--nc-btn-col-h);
}

/* Loading state for ajax add to cart */
.nilay-card-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.nilay-card-btn.added::after {
    font-family: dashicons;
    content: "\f147";
    margin-right: 5px;
}

.nilay-cat-search-box {
    direction: rtl;
}

.nilay-cat-search-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.nilay-cat-search-results {
    margin-top: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 8px;
    background: #fff;
    display: none;
}

.nilay-cat-group {
    border-bottom: 1px solid #f5f5f5;
    padding: 8px 0;
}

.nilay-cat-group:last-child {
    border-bottom: none;
}

.nilay-cat-parent {
    font-weight: 600;
    margin-bottom: 6px;
}

.nilay-cat-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nilay-cat-children li {
    padding: 2px 0;
    font-size: 13px;
    color: #444;
}

.nilay-highlight {
    background: #fff3cd;
    color: inherit;
}

.nilay-cat-select {
    display: inline-block;
    background: #f8f9fa;
    border: 1px solid #e2e3e5;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: #333;
}

.nilay-cat-select:hover {
    background: #eef0f2;
}

.nilay-cat-selected {
    background: #d1e7dd !important;
    border-color: #badbcc !important;
}

.nilay-cat-actions {
    margin-top: 6px;
}

.nilay-cat-select-all {
    background: #f0f6ff;
    border: 1px solid #cfe2ff;
    color: #0b5ed7;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

.nilay-cat-select-all:hover {
    background: #e2edff;
}

.nilay-cat-select-children {
    background: #eef9f1;
    border: 1px solid #cdebd6;
    color: #198754;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

.nilay-cat-select-children:hover {
    background: #e1f4e8;
}

.nilay-cat-clear-all {
    background: #fff5f5;
    border: 1px solid #f1c2c4;
    color: #b02a37;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.nilay-cat-clear-all:hover {
    background: #ffe9ea;
}

.nilay-inline-cat-search-wrap {
    margin: 8px 0;
}

.nilay-inline-cat-search {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* --- TICKET SYSTEM BUTTONS --- */
.nilay-ticket-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    border: none;
    border-radius: 8px;
    /* Rounded corners */
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: normal;
}

.nilay-ticket-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.nilay-btn-primary {
    background-color: #2196F3;
    color: #fff !important;
}

.nilay-btn-primary:hover {
    background-color: #1976D2;
    color: #fff !important;
}

.nilay-btn-secondary {
    background-color: #f0f0f0;
    color: #333 !important;
    border: 1px solid #ccc;
}

.nilay-btn-secondary:hover {
    background-color: #e0e0e0;
    color: #000 !important;
}

.nilay-btn-small {
    padding: 5px 10px;
    font-size: 12px;
    background-color: #2196F3;
    color: #fff !important;
    border-radius: 4px;
}

.nilay-btn-small:hover {
    background-color: #1976D2;
}

/* --- Admin Panel General Styles --- */
.nilay-admin-panel {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.nilay-section-title {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
    color: #1d2327;
}

/* Flex Grid System for Admin */
.nilay-flex-row,
.nilay-flex-row-2,
.nilay-flex-row-3,
.nilay-flex-row-4 {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.nilay-flex-row>div,
.nilay-flex-row-2>div,
.nilay-flex-row-3>div,
.nilay-flex-row-4>div {
    flex: 1;
    min-width: 200px;
}

/* Specific Columns */
.nilay-flex-row-2>div {
    flex-basis: calc(50% - 20px);
}

.nilay-flex-row-3>div {
    flex-basis: calc(33.33% - 20px);
}

.nilay-flex-row-4>div {
    flex-basis: calc(25% - 20px);
}

/* Form Elements Spacing & Polish */
.nilay-admin-panel label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3338;
    line-height: 1.4;
}

.nilay-admin-panel input[type="text"],
.nilay-admin-panel input[type="number"],
.nilay-admin-panel input[type="email"],
.nilay-admin-panel input[type="password"],
.nilay-admin-panel input[type="url"],
.nilay-admin-panel select {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    height: 40px;
    line-height: 1.3;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    padding: 0 12px;
    transition: all 0.2s;
}

.nilay-admin-panel input:focus,
.nilay-admin-panel select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.nilay-admin-panel textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    box-sizing: border-box;
    line-height: 1.5;
}

/* Color Picker Alignment */
.nilay-admin-panel input[type="color"] {
    height: 40px;
    width: 60px;
    padding: 4px;
    cursor: pointer;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    vertical-align: middle;
}

/* Fix for WP List Table Filters */
.tablenav .actions select {
    max-width: 200px;
    margin-left: 5px;
    margin-right: 5px;
}

/* Card Builder Specifics */
.nilay-admin-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-top: 20px;
    border-radius: 4px;
}

/* --- Utilities --- */
.nilay-mt-5 {
    margin-top: 5px !important;
}

.nilay-mt-10 {
    margin-top: 10px !important;
}

.nilay-mb-5 {
    margin-bottom: 5px !important;
}

.nilay-mb-10 {
    margin-bottom: 10px !important;
}

/* --- WP List Table Fixes (Critical) --- */
/* Override generic input width for standard WP filters */
.tablenav .actions select,
.tablenav .actions input[type="submit"],
.tablenav .actions .button {
    width: auto !important;
    display: inline-block !important;
    margin: 0 5px !important;
    /* Ensure separation */
    vertical-align: middle;
    height: 30px !important;
    /* Standard WP height */
    line-height: 28px !important;
}

/* Fix specifically for date picker dropdowns if they use different classes */
.tablenav .alignleft.actions select {
    margin-right: 5px;
    margin-left: 5px;
}