/**
 * Virtual Numbers Catalog — شماره مجازی
 * Uses theme variables from variables.css for light/dark support.
 * Responsive: sidebar becomes horizontal strip on mobile.
 */

/* Layout */
.vn-layout {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    align-items: flex-start;
    margin-top: 0.5rem; /* فاصلهٔ کم و بهینه از هدر — تراز باکس جستجو و لیست کاتالوگ */
}

.vn-sidebar {
    flex: 0 0 220px;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.vn-service-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.vn-service-list li {
    margin: 0;
}

.vn-service-list a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
}

.vn-service-list a:hover {
    background: var(--surface-card-hover);
    border-color: var(--surface-border);
}

.vn-service-list a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
}

.vn-service-list .icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    flex-shrink: 0;
}

.vn-main {
    flex: 1;
    min-width: 0;
}

/* Intro box: title + description + search in one clean card */
.vn-intro {
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.vn-intro__title {
    margin: 0 0 0.5rem 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.vn-intro__desc {
    margin: 0 0 1rem 0;
    font-size: 0.925rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.vn-intro__desc a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

.vn-intro__desc a:hover {
    text-decoration: underline;
}

.vn-intro .vn-search-form--inline {
    margin-bottom: 0;
}

.vn-intro .vn-search-form--inline .vn-buy-btn--submit {
    flex-shrink: 0;
}

.vn-unavailable-label {
    font-size: 0.9rem;
}

/* Search form */
.vn-search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.vn-search-form input[type="text"] {
    flex: 1;
    min-width: 160px;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.vn-search-form input[type="text"]::placeholder {
    color: var(--input-placeholder);
}

.vn-search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--input-border-focus);
}

.vn-search-form .vn-buy-btn {
    padding: 0.55rem 1rem;
}

/* Table */
.vn-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: var(--surface-card);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-sm);
}

.vn-table {
    width: 100%;
    border-collapse: collapse;
}

.vn-table th,
.vn-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    color: var(--text-primary);
}

.vn-table th {
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--surface-border);
    background: var(--surface-card-hover);
    white-space: nowrap;
}

.vn-table th a {
    color: var(--text-primary);
    text-decoration: none;
}

.vn-table th a:hover {
    color: var(--primary-light);
}

.vn-table tr:hover td {
    background: var(--surface-card-hover);
}

.vn-table td {
    font-size: 0.95rem;
}

.vn-unavailable {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Buy button */
.vn-buy-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--text-inverse);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    border: none;
    cursor: pointer;
}

.vn-buy-btn:hover {
    color: var(--text-inverse);
    opacity: 0.92;
}

/* Light theme — ensure contrast */
[data-theme="light"] .vn-service-list a {
    background: var(--surface-card);
    border-color: var(--surface-border);
    color: var(--text-primary);
}

[data-theme="light"] .vn-service-list a:hover {
    background: var(--surface-card-hover);
}

[data-theme="light"] .vn-service-list a.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

[data-theme="light"] .vn-table-wrap {
    background: var(--surface-card);
    border-color: var(--surface-border);
}

[data-theme="light"] .vn-table th {
    background: var(--surface-card-hover);
    border-bottom-color: var(--surface-border);
}

/* ----- Responsive: mobile first adjustments ----- */

@media (max-width: 991px) {
    .vn-sidebar {
        flex: 0 0 100%;
        width: 100%;
        position: static;
        order: -1;
    }

    .vn-intro {
        padding: 1rem 1.1rem;
    }

    .vn-service-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.35rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .vn-service-list::-webkit-scrollbar {
        height: 5px;
    }

    .vn-service-list::-webkit-scrollbar-track {
        background: var(--surface-muted);
        border-radius: var(--radius-pill);
    }

    .vn-service-list::-webkit-scrollbar-thumb {
        background: var(--surface-border);
        border-radius: var(--radius-pill);
    }

    .vn-service-list li {
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    .vn-service-list a {
        padding: 0.5rem 0.85rem;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .vn-service-list .icon {
        width: 24px;
        height: 24px;
    }

    .vn-layout {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .vn-intro {
        padding: 0.9rem 1rem;
    }

    .vn-intro__title {
        font-size: 1.2rem;
    }

    .vn-intro__desc {
        font-size: 0.875rem;
    }

    .vn-search-form {
        flex-direction: column;
        margin-bottom: 0.85rem;
    }

    .vn-search-form input[type="text"] {
        min-width: 0;
    }

    .vn-search-form .vn-buy-btn {
        width: 100%;
        justify-content: center;
    }

    .vn-table th,
    .vn-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
    }

    .vn-buy-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .vn-service-list a {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    .vn-service-list .icon {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 380px) {
    .vn-table th,
    .vn-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .vn-buy-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.78rem;
    }
}
