:root {
    --page-bg: #f5f7fb;
    --card-bg: #ffffff;
    --text-main: #182230;
    --text-soft: #667085;
    --border-color: #e4e7ec;
    --primary-color: #155eef;
    --primary-soft: rgba(21, 94, 239, 0.08);
    --success-color: #12b76a;
    --success-soft: rgba(18, 183, 106, 0.12);
    --danger-color: #f04438;
    --danger-soft: rgba(240, 68, 56, 0.12);
    --warning-color: #f79009;
    --warning-soft: rgba(247, 144, 9, 0.12);
    --shadow-soft: 0 10px 30px rgba(16, 24, 40, 0.08);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 10px;
}

/* =============================
   Layout
============================= */
.categories-admin-page {
    background: var(--page-bg);
}

.page-shell {
    display: grid;
    gap: 20px;
}

.page-toolbar,
.content-card {
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow-soft);
}

.page-toolbar {
    padding: 20px;
}

.toolbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
}

.page-subtitle {
    color: var(--text-soft);
    font-size: 14px;
}

.toolbar-filters .form-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #98a2b3;
    z-index: 2;
}

html[lang="ar"] .input-icon-wrap i {
    right: 14px;
}

html[lang="en"] .input-icon-wrap i {
    left: 14px;
}

html[lang="ar"] .input-icon-wrap .form-control {
    padding-right: 40px;
}

html[lang="en"] .input-icon-wrap .form-control {
    padding-left: 40px;
}

.stats-pill {
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    background: #fff;
    color: var(--text-main);
}

/* =============================
   Buttons
============================= */
.btn {
    border-radius: 12px;
    font-weight: 700;
    padding: 10px 16px;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #155eef, #004ee8);
    border: 0;
}

.btn-success {
    background: linear-gradient(135deg, #12b76a, #039855);
    border: 0;
}

.btn-light,
.btn-outline-secondary {
    border-color: var(--border-color);
}

/* =============================
   Table
============================= */
.modern-table-wrap {
    min-height: 240px;
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table thead th {
    background: #101828;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 16px 14px;
    border: 0;
    white-space: nowrap;
    text-align: center;
}

.modern-table tbody tr {
    transition: background 0.18s ease, transform 0.18s ease;
}

.modern-table tbody tr:hover {
    background: #f9fafb;
}

.modern-table td {
    padding: 14px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
    text-align: center;
    color: var(--text-main);
}

.cell-main-text {
    font-weight: 700;
}

.description-cell {
    max-width: 260px;
    margin: 0 auto;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slug-code {
    background: #f2f4f7;
    color: #344054;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 12px;
}

.table-category-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #eef2f6;
    background: #fff;
}

.category-icon-preview {
    font-size: 18px;
    margin-inline-end: 6px;
    color: var(--primary-color);
}

.action-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.action-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    cursor: pointer;
    transition: 0.2s ease;
    color: #344054;
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn.edit {
    color: var(--primary-color);
    background: rgba(21, 94, 239, 0.08);
}

.action-btn.translate {
    color: var(--success-color);
    background: rgba(18, 183, 106, 0.1);
}

.action-btn.delete {
    color: var(--danger-color);
    background: rgba(240, 68, 56, 0.1);
}

.action-btn.toggle.warn {
    color: var(--warning-color);
    background: rgba(247, 144, 9, 0.12);
}

.action-btn.toggle.success {
    color: var(--success-color);
    background: rgba(18, 183, 106, 0.12);
}

.status-badge,
.status-badge-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge.active,
.status-badge-preview.active {
    background: var(--success-soft);
    color: var(--success-color);
}

.status-badge.inactive,
.status-badge-preview.inactive {
    background: var(--danger-soft);
    color: var(--danger-color);
}

/* =============================
   States
============================= */
.empty-state,
.loading-state {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: var(--text-soft);
    text-align: center;
    padding: 24px;
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: #f2f4f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #98a2b3;
    font-size: 28px;
}

/* =============================
   Modal
============================= */
.modern-modal {
    border: 0;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(16, 24, 40, 0.15);
}

.modal-header,
.modal-footer {
    border: 0;
    padding: 18px 22px;
}

.modal-body {
    padding: 22px;
}

.modal-title {
    font-weight: 800;
    color: var(--text-main);
}

.textarea-control {
    min-height: 120px;
    resize: vertical;
}

.form-control,
.form-select {
    border-radius: 12px;
    min-height: 46px;
    border: 1px solid #d0d5dd;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.12);
}

.image-upload-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px;
    background: #f8fafc;
}

.image-preview {
    position: relative;
    width: 100%;
    max-width: 220px;
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px dashed #cfd4dc;
    margin-bottom: 12px;
}

.image-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-btn {
    position: absolute;
    bottom: 10px;
    width: 42px !important;
    height: 42px !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 24, 40, 0.72);
    color: #fff;
    border: 0;
    padding: 0 !important;
}

html[lang="ar"] .upload-btn {
    right: 10px;
}

html[lang="en"] .upload-btn {
    left: 10px;
}

.image-help .muted {
    color: var(--text-soft);
    font-size: 13px;
}

.image-help .file-name {
    margin-top: 6px;
    font-weight: 700;
    word-break: break-word;
}

.status-switch-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    border-radius: 16px;
    padding: 14px 16px;
}

.switch {
    position: relative;
    width: 56px;
    height: 30px;
    margin: 0;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    background: #d0d5dd;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s ease;
}

.slider::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    top: 3px;
    left: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.switch input:checked+.slider {
    background: var(--success-color);
}

.switch input:checked+.slider::before {
    transform: translateX(26px);
}

/* =============================
   RTL
============================= */
body[dir="rtl"] .page-title,
body[dir="rtl"] .page-subtitle,
body[dir="rtl"] .form-label,
body[dir="rtl"] .modal-title {
    text-align: right;
}

/* =============================
   Responsive
============================= */
@media (max-width: 992px) {
    .page-title {
        font-size: 24px;
    }

    .toolbar-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .btn {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .page-toolbar {
        padding: 16px;
    }

    .modal-dialog {
        margin: 12px;
    }

    .modern-table thead th,
    .modern-table td {
        padding: 12px 10px;
        font-size: 13px;
    }

    .table-category-image {
        width: 48px;
        height: 48px;
    }

    .image-preview {
        height: 180px;
    }

    .description-cell {
        max-width: 160px;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 21px;
    }

    .status-switch-wrap {
        align-items: flex-start;
        flex-direction: column;
    }

    .action-group {
        gap: 4px;
    }

    .action-btn {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }
}