/* =========================================================
   Shared Styles — Modals, Tables, Forms
   در همه صفحات پنل استفاده می‌شود
   ========================================================= */

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 32, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}
.modal-box {
    background: var(--c-surface, #fff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}
.modal-overlay.open .modal-box {
    transform: translateY(0);
}
.modal-box.modal-lg { max-width: 800px; }
.modal-box.modal-sm { max-width: 400px; }

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border, #e1e6ef);
}
.modal-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--c-text, #1f2a3d);
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--c-text-muted, #8a93a6);
    cursor: pointer;
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    transition: all 0.15s ease;
}
.modal-close:hover {
    background: var(--c-surface-2, #f8fafc);
    color: var(--c-danger, #c25a54);
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--c-border, #e1e6ef);
    background: var(--c-surface-2, #f8fafc);
}
.modal-actions .btn { min-width: 100px; justify-content: center; }

/* ---------- Table ---------- */
.table-card {
    background: var(--c-surface, #fff);
    border: 1px solid var(--c-border, #e1e6ef);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}
.table-responsive {
    overflow-x: auto;
    width: 100%;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: inherit;
}
.data-table thead th {
    background: var(--c-surface-2, #f8fafc);
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text-soft, #4b5565);
    border-bottom: 1px solid var(--c-border, #e1e6ef);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--c-text, #1f2a3d);
    border-bottom: 1px solid var(--c-border-soft, #eef1f7);
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: var(--c-surface-2, #f8fafc);
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table .col-actions {
    width: 130px;
    text-align: left;
}
.data-table .table-loading {
    text-align: center;
    padding: 40px;
    color: var(--c-text-muted, #8a93a6);
}
.data-table .table-empty {
    text-align: center;
    padding: 40px;
    color: var(--c-text-muted, #8a93a6);
    font-size: 13px;
}
.data-table .table-empty i {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: rgba(63,138,106,.14); color: #3f8a6a; }
.badge-danger  { background: rgba(194,90,84,.14);  color: #c25a54; }
.badge-warning { background: rgba(208,138,63,.14); color: #d08a3f; }
.badge-info    { background: rgba(74,134,168,.14); color: #4a86a8; }
.badge-secondary { background: var(--c-surface-2, #f1f5f9); color: #64748b; }

/* ---------- Row Actions ---------- */
.row-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.row-actions .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: transparent;
    border: none;
    color: var(--c-text-muted, #8a93a6);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
    text-decoration: none;
}
.row-actions .btn-icon:hover {
    background: var(--c-surface-2, #f1f5f9);
    color: var(--c-primary-600, #3d5f8f);
}
.row-actions .btn-icon.js-del:hover {
    background: rgba(194,90,84,.10);
    color: var(--c-danger, #c25a54);
}

/* ---------- Form Grid ---------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid .field-full { grid-column: 1 / -1; }
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-soft, #4b5565);
}
.field label .req { color: var(--c-danger, #c25a54); }
.field .form-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--c-border, #e1e6ef);
    border-radius: 8px;
    background: var(--c-surface, #fff);
    font-family: inherit;
    font-size: 13px;
    color: var(--c-text, #1f2a3d);
    transition: all 0.15s ease;
}
.field .form-input:focus {
    outline: none;
    border-color: var(--c-primary-500, #4f78ac);
    box-shadow: 0 0 0 3px var(--c-primary-50, #f2f6fc);
}
.field .form-hint {
    font-size: 11px;
    color: var(--c-text-muted, #8a93a6);
}
.field-error {
    color: var(--c-danger, #c25a54);
    font-size: 11px;
}

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .data-table thead th, .data-table tbody td { padding: 10px 12px; font-size: 12px; }
    .modal-box { max-width: calc(100% - 32px); }
}