﻿/* ═══════════════════════════════════════════════════════════
   HesabPicker — استایل پیکر انتخاب حساب
   ═══════════════════════════════════════════════════════════ */

.hp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: hp-fade-in .15s ease;
    backdrop-filter: blur(2px);
}

    .hp-overlay.closing {
        animation: hp-fade-out .15s ease forwards;
    }

@keyframes hp-fade-in {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes hp-fade-out {
    from {
        opacity: 1
    }

    to {
        opacity: 0
    }
}

.hp-box {
    background: #fff;
    border-radius: 14px;
    width: min(680px, 94vw);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .05);
    animation: hp-slide-up .18s ease;
    direction: rtl;
}

@keyframes hp-slide-up {
    from {
        transform: translateY(12px) scale(.98);
        opacity: 0
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1
    }
}

/* ─── Header ─── */
.hp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(180deg, #F9FAFB, #F3F4F6);
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.hp-title {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
}

.hp-close {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: #6B7280;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all .12s;
}

    .hp-close:hover {
        background: #E5E7EB;
        color: #111827;
    }

/* ─── Search ─── */
.hp-search {
    position: relative;
    padding: 12px 16px;
    border-bottom: 1px solid #F3F4F6;
    flex-shrink: 0;
}

.hp-search-icon {
    position: absolute;
    left: auto;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    opacity: .6;
    pointer-events: none;
}

.hp-search-input {
    width: 100%;
    padding: 10px 42px 10px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
    transition: all .15s;
    background: #F9FAFB;
}

    .hp-search-input:focus {
        outline: none;
        border-color: #4F46E5;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
    }

.hp-kbd-hint {
    display: block;
    font-size: 10.5px;
    color: #9CA3AF;
    margin-top: 6px;
    text-align: center;
}

    .hp-kbd-hint kbd {
        background: #F3F4F6;
        border: 1px solid #E5E7EB;
        border-bottom-width: 2px;
        border-radius: 4px;
        padding: 1px 5px;
        font-family: monospace;
        font-size: 10px;
        color: #374151;
    }

/* ─── Tabs ─── */
.hp-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 14px 0;
    background: #FAFBFC;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.hp-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: #6B7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .12s;
    border-radius: 6px 6px 0 0;
}

    .hp-tab:hover {
        color: #374151;
        background: rgba(0,0,0,.03);
    }

    .hp-tab.active {
        color: #4F46E5;
        border-bottom-color: #4F46E5;
        font-weight: 600;
        background: #fff;
    }

/* ─── List ─── */
.hp-list {
    flex: 1;
    overflow-y: auto;
    min-height: 240px;
    max-height: 55vh;
    padding: 6px 0;
    scrollbar-width: thin;
}

    .hp-list::-webkit-scrollbar {
        width: 8px;
    }

    .hp-list::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 4px;
    }

        .hp-list::-webkit-scrollbar-thumb:hover {
            background: #9CA3AF;
        }

/* ─── Group (کل + معین‌ها) ─── */
.hp-group {
    border-bottom: 1px solid #F3F4F6;
}

    .hp-group:last-child {
        border-bottom: none;
    }

/* ─── Row ─── */
.hp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    cursor: pointer;
    transition: background .08s;
    user-select: none;
    border-right: 3px solid transparent;
}

    .hp-row:hover {
        background: #F9FAFB;
    }

    .hp-row.focused {
        background: #EEF2FF;
        border-right-color: #6366F1;
    }

    .hp-row.selected {
        background: #E0E7FF;
        border-right-color: #4F46E5;
        font-weight: 600;
    }

    .hp-row.disabled {
        opacity: .55;
        cursor: not-allowed;
    }

/* ─── Col header ─── */
.hp-row-col-header {
    background: linear-gradient(90deg, #F9FAFB, #fff);
    font-weight: 600;
}

    .hp-row-col-header:hover {
        background: #F3F4F6;
    }

.hp-row-arrow {
    width: 16px;
    text-align: center;
    color: #6B7280;
    font-size: 10px;
    transition: transform .15s;
}

/* ─── Moein ─── */
.hp-row-moein {
    padding-right: 46px;
    background: #fff;
}

    .hp-row-moein::before {
        content: '';
        position: absolute;
        right: 28px;
        width: 1px;
        height: 100%;
        background: #E5E7EB;
    }

.hp-moeins[hidden] {
    display: none;
}

/* ─── Tafzil ─── */
.hp-row-tafzil {
    padding-right: 32px;
}

/* ─── Icons & codes ─── */
.hp-row-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    opacity: .8;
}

.hp-row-icon-leaf {
    opacity: .5;
    font-size: 12px;
}

.hp-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12.5px;
    background: #F3F4F6;
    color: #4F46E5;
    padding: 2px 8px;
    border-radius: 5px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    flex-shrink: 0;
}

.hp-row.selected .hp-code {
    background: #4F46E5;
    color: #fff;
}

.hp-name {
    flex: 1;
    font-size: 13.5px;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Badges ─── */
.hp-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.hp-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.hp-badge-tafzil {
    background: #DBEAFE;
    color: #1E40AF;
}

.hp-badge-stock {
    background: #FEF3C7;
    color: #92400E;
}

/* ─── Empty ─── */
.hp-empty {
    padding: 50px 20px;
    text-align: center;
    color: #9CA3AF;
}

.hp-empty-icon {
    font-size: 42px;
    margin-bottom: 10px;
    opacity: .4;
}

.hp-empty-text {
    font-size: 14px;
    margin-bottom: 4px;
}

.hp-empty-hint {
    font-size: 12px;
    opacity: .7;
}

.hp-loading-moeins {
    padding: 10px 46px;
    font-size: 12px;
    color: #9CA3AF;
    font-style: italic;
}

/* ─── Footer ─── */
.hp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.hp-footer-actions {
    display: flex;
    gap: 8px;
}

.hp-create-btn {
    font-size: 12.5px;
}

    .hp-create-btn:not(:disabled) {
        background: #FEF3C7;
        color: #92400E;
        border-color: #FCD34D;
    }

        .hp-create-btn:not(:disabled):hover {
            background: #FDE68A;
        }

.hp-create-label {
    font-weight: 600;
    margin-right: 2px;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .hp-box {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .hp-list {
        max-height: none;
    }

    .hp-kbd-hint {
        display: none;
    }

    .hp-footer {
        padding: 10px 12px;
    }

    .hp-row {
        padding: 11px 14px;
    }

    .hp-row-moein {
        padding-right: 36px;
    }
}

/* ─── Dark mode (اختیاری) ─── */
@media (prefers-color-scheme: dark) {
    /* فعلاً غیرفعال — چون پروژه روشنه */
}
