@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

a, .btn-link {
    color: #0366d6;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.content {
    padding: 0 !important;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.k-window {
    direction: rtl !important;
}

.Q1X {
    border-radius: 5px 5px 5px 5px;
    background-color: #ede9fe9e;
    margin-top: 10px;
    padding: 5px;
}

.Q2X {
    border-radius: 5px 5px 5px 5px;
    background-color: #ffcfc19e;
    margin-top: 10px;
    padding: 5px;
}

/* ================================================================
   بازیابی استایل از دست رفته (Z_Report_Dynamic) - منبع: نسخه قبلی app.css
   ================================================================ */
.Z_Report_Dynamic {
    padding-top: 10px;
    padding-bottom: 10px;
    border: dotted 2px #bababa;
    margin-top: 10px;
    padding: 3px;
    border-radius: 10px;
    background-color: #0000000e;
}

/* ==================== ستون‌های قابل تغییر عرض (zTableResize) ==================== */
.z-th-resizable {
    position: relative;
}

.z-col-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 5;
    touch-action: none;
}

    .z-col-resizer:hover, .z-col-resizer:active {
        background: rgba(59, 130, 246, 0.35);
    }

th.sortable {
    cursor: pointer;
    user-select: none;
}

    th.sortable:hover {
        background: rgba(0,0,0,.05);
    }

.compact-table td {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* هایلایت ردیف انتخاب‌شده با کلیک (بازگردانی قابلیت نسخه‌های قدیمی) */
.compact-table tr.selected-row,
.classic-admin-table tr.selected-row {
    background-color: #dbeafe !important;
}
.compact-table tr.selected-row td,
.classic-admin-table tr.selected-row td {
    background-color: #dbeafe !important;
}

/* ==========================================================================
   زیرفرم‌های تودرتو (آدرس‌ها / تلفن‌ها / کارت‌های بانکی مخاطب)
   استفاده‌شده در: Forms/Publics/Public_Contact.razor و اجزای فرزند
   ========================================================================== */
.z-subform {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-soft);
    margin-bottom: 1rem;
    overflow: hidden;
}

.z-subform-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .9rem;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--text-primary);
    font-size: .95rem;
}

.z-subform-head > .bi {
    color: var(--primary-color);
    font-size: 1.05rem;
}

.z-subform-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

.z-subform-head .z-add {
    margin-inline-start: auto;
    white-space: nowrap;
}

.z-subform-body {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    padding: .75rem .9rem;
}

.z-child-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .55rem .6rem;
    border: 1px dashed var(--border-color);
    border-radius: 11px;
    background: var(--bg-subtle);
    transition: border-color .15s ease, background .15s ease;
}

.z-child-row:hover,
.z-child-row:focus-within {
    border-color: var(--primary-color);
    background: var(--bg-hover);
}

.z-child-fields {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: start;
}

.z-child-fields.z-child-fields-wide {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.z-child-del {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, .35);
    background: rgba(239, 68, 68, .08);
    color: var(--danger);
    border-radius: 9px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.z-child-del:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.z-subform-empty {
    text-align: center;
    font-size: .85rem;
    color: var(--text-muted);
    padding: .85rem .5rem;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
}

[data-theme="dark"] .z-subform,
html[data-theme="dark"] .z-subform {
    background: var(--bg-card);
}

@media (max-width: 575.98px) {
    .z-child-row {
        flex-direction: column;
        align-items: stretch;
    }

    .z-child-del {
        align-self: flex-end;
    }
}

/* هدر و بدنهٔ زیرفرم‌ها (سازگار با مارک‌آپ فعلی کارت) */
.z-subform > .card-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .9rem;
    margin: 0;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
    border-radius: 14px 14px 0 0;
    color: var(--text-primary);
    font-weight: 700;
    font-size: .95rem;
}

.z-subform > .card-header::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background: var(--primary-color);
    display: inline-block;
}

.z-subform > .card-body {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    padding: .8rem .9rem;
    background: var(--bg-card);
    border-radius: 0 0 14px 14px;
}

/* دکمهٔ «افزودن» به‌صورت ردیف خط‌چین در انتهای هر بخش */
.z-subform > .card-body > button.btn-success,
.z-subform > .card-body > .btn.btn-success {
    align-self: stretch;
    margin-top: .15rem;
    background-color: transparent !important;
    background-image: none !important;
    color: var(--primary-color) !important;
    border: 1px dashed var(--primary-color) !important;
    border-radius: 10px !important;
    font-weight: 600;
    font-size: .88rem;
    padding: .5rem .75rem;
    transition: background-color .15s ease, color .15s ease;
}

.z-subform > .card-body > button.btn-success:hover,
.z-subform > .card-body > .btn.btn-success:hover {
    background-color: var(--primary-color) !important;
    border-style: solid !important;
    color: #fff !important;
}

/* چیدمان اختصاصی ستون‌های هر ردیف (تلفن/آدرس/کارت) */
/* پیش‌فرض (موبایل/تبلت/مودال باریک): شبکهٔ انعطاف‌پذیر با حداقل عرض قابل استفاده */
.z-child-fields.z-phone,
.z-child-fields.z-addr,
.z-child-fields.z-cart {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.z-child-fields.z-cart {
    grid-template-columns: 1fr;
}

/* فقط در نمایشگرهای عریض: چیدمان تخصصی هر ردیف */
@media (min-width: 1200px) {
    .z-child-fields.z-phone {
        grid-template-columns: 130px 175px 175px 95px;
    }

    .z-child-fields.z-addr {
        grid-template-columns: 130px 155px minmax(220px, 1fr) 95px 175px;
    }

    .z-child-fields.z-cart {
        grid-template-columns: 1fr;
    }
}

/* تراز دکمهٔ حذف با خط ورودی‌ها (در هر سه بخش) */
.z-child-row {
    align-items: flex-end;
}

.z-child-del {
    align-self: flex-end;
    width: 42px;
    height: 42px;
    margin-bottom: 1px;
}

/* جلوگیری از شکستن ردیف و تراز دقیق دکمهٔ حذف */
.z-child-row {
    flex-wrap: nowrap;
}

.z-child-fields > * {
    min-width: 0;
    overflow: hidden;
}

/* تراز عمودی دکمهٔ حذف در وسط ردیف */
.z-child-row {
    align-items: center;
}

.z-child-del {
    align-self: center;
}
