/* ═══════════════════════════════════════════════════════════════
   SafiTech – Shared View Toggle (List / Cards)
   ═══════════════════════════════════════════════════════════════ */

.safi-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f7ff;
    border: 1px solid #c7deff;
    border-radius: 8px;
    padding: 7px 14px;
    animation: safiBulkFadeIn .15s ease;
    box-shadow: 0 1px 4px rgba(35,151,229,.08);
}
@keyframes safiBulkFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.safi-bulk-bar-left {
    display: flex;
    align-items: center;
}
.safi-bulk-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.safi-bulk-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
    line-height: 1.5;
}
.safi-bulk-action-btn i { font-size: 1rem; line-height: 1; color: inherit; }
.safi-bulk-action-btn--danger i { color: #d9214e; }
.safi-bulk-action-btn--warning i { color: #2397E5; }
.safi-bulk-action-btn--danger {
    background: #fff0f0;
    color: #d9214e;
    border-color: #ffd6de;
}
.safi-bulk-action-btn--danger:hover {
    background: #ffd9e1;
    border-color: #fbb6c4;
    color: #b5173f;
}
.safi-bulk-action-btn--warning {
    background: #e9f4fd;
    color: #2397E5;
    border-color: #c7deff;
}
.safi-bulk-action-btn--warning:hover {
    background: #d0e8fb;
    border-color: #9fc8f5;
    color: #1a7bc2;
}

/* ─── Toggle Button Group ───────────────────────────────────────── */
.safi-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    min-height: 38px;
    border: 1px solid #EFF2F5;
    border-radius: 8px;
    background: #F5F8FA;
}

.safi-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #A1A5B7;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.safi-view-btn:hover,
.safi-view-btn.active {
    background: #FFFFFF;
    color: #2397E5;
    box-shadow: 0 3px 10px rgba(35, 151, 229, .10);
}

/* ─── Card Grid ─────────────────────────────────────────────────── */
.safi-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 16px 0 20px;
}

.safi-card-grid--wide {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
}

#OrderConfirmationsTable_cardGrid .safi-card-title {
    color: #2397E5;
    cursor: pointer;
}

/* ─── Single Card ───────────────────────────────────────────────── */
.safi-card {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border: 1.5px solid #E4E6EF;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.safi-card:hover {
    border-color: #2397E5;
    box-shadow: 0 6px 20px rgba(35, 151, 229, .14);
    transform: translateY(-2px);
}

/* ─── Card Header ───────────────────────────────────────────────── */
.safi-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.safi-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #181C32;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    cursor: default;
}

.safi-card-subtitle {
    font-size: .8rem;
    font-weight: 400;
    color: #A1A5B7;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.safi-card-badge {
    flex-shrink: 0;
}

/* ─── Card Fields ───────────────────────────────────────────────── */
.safi-card-fields {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.safi-card-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #F8FBFF;
    border: 1px solid #EEF6FD;
    min-width: 0;
    overflow: hidden;
    cursor: default;
}

.safi-card-field-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #E9F4FD;
    color: #2397E5;
    flex-shrink: 0;
    font-size: .85rem;
}

.safi-card-field-content {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.safi-card-field-label {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    color: #A1A5B7;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.safi-card-field-value {
    display: block;
    font-size: .84rem;
    font-weight: 600;
    color: #3F4254;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Card Actions ──────────────────────────────────────────────── */
.safi-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #EFF2F5;
}

.safi-card-actions .btn {
    flex: 1 1 calc(33.33% - 5px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: .78rem;
    font-weight: 500;
    min-width: 0;
    padding: 6px 8px;
}

/* ─── Empty State ───────────────────────────────────────────────── */
.safi-card-empty {
    text-align: center;
    padding: 40px 16px;
    color: #A1A5B7;
    font-size: .9rem;
}

.safi-card-empty i {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    opacity: .5;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .safi-card-grid {
        grid-template-columns: 1fr;
    }
    .safi-card-fields {
        grid-template-columns: 1fr !important;
    }
    .safi-card-actions .btn {
        flex: 1 1 100%;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .safi-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .safi-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) and (max-width: 1599.98px) {
    .safi-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1600px) {
    .safi-card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ─── RTL Support ───────────────────────────────────────────────── */
html[dir="rtl"] .safi-card-title,
html[dir="rtl"] .safi-card-subtitle,
html[dir="rtl"] .safi-card-field-label,
html[dir="rtl"] .safi-card-field-value {
    text-align: right;
}

html[dir="rtl"] .safi-card-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .safi-card-field {
    flex-direction: row-reverse;
    text-align: right;
}

.safi-card-image {
    position: relative;
    width: calc(100% + 36px);
    margin: -18px -18px 14px;
    height: 180px;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    background: #F5F8FA;
}

.safi-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s ease;
}

.safi-card:hover .safi-card-image img {
    transform: scale(1.04);
}

.safi-card-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #A1A5B7;
}

.safi-card-image-placeholder i {
    font-size: 2.4rem;
    color: #C7D2E2;
}

.safi-card-image-placeholder > span {
    font-size: 1.1rem;
    font-weight: 700;
    color: #C7D2E2;
    text-transform: uppercase;
}

.safi-card-image-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
}

.safi-search-box [id^="search-btn_"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    flex-shrink: 0;
}

[dir="rtl"] .safi-search-box .svg-icon svg {
    transform: scaleX(-1);
}

[dir="rtl"] .safi-search-box [id^="search-btn_"] i {
    display: inline-block;
    transform: scaleX(-1);
}
