/* Shared Arabic RTL UI cleanup */

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IPASansArabic';
    src: url('../IPASans/IBMPlexSansArabic-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

html[dir="rtl"] {
    direction: rtl;
    font-family: 'IPASansArabic', 'IBM Plex Sans Arabic', sans-serif !important;
}

html[dir="rtl"] *,
html[dir="rtl"] *::before,
html[dir="rtl"] *::after {
    font-family: 'IPASansArabic', 'IBM Plex Sans Arabic', sans-serif !important;
}

html[dir="rtl"] body {
    text-align: right;
    letter-spacing: 0;
    direction: rtl;
}

html[dir="rtl"] .layout,
html[dir="rtl"] .content,
html[dir="rtl"] .filters-container,
html[dir="rtl"] .table-container,
html[dir="rtl"] .page-header,
html[dir="rtl"] .filters-header,
html[dir="rtl"] .table-header {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="time"],
html[dir="rtl"] input[type="datetime-local"],
html[dir="rtl"] .ltr-value,
html[dir="rtl"] .phone-value,
html[dir="rtl"] [data-phone],
html[dir="rtl"] a[href^="tel:"] {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

html[dir="rtl"] table {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .sidebar {
    right: 0 !important;
    left: auto !important;
}

html[dir="rtl"] .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

html[dir="rtl"] .topbar-actions {
    margin-right: auto;
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: nowrap;
}

html[dir="rtl"] .search-box {
    margin-left: 0;
}

html[dir="rtl"] .search-box input {
    max-width: 100%;
}

html[dir="rtl"] .user-menu {
    margin-right: 0;
    white-space: nowrap;
}

html[dir="rtl"] .topbar .user-menu {
    position: relative;
    display: block;
}

html[dir="rtl"] .topbar .user-menu-trigger {
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: inherit;
    font: inherit;
    padding: 6px 8px;
    border-radius: 10px;
}

html[dir="rtl"] .topbar .user-menu-trigger:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

html[dir="rtl"] .topbar .user-menu-trigger .user-avatar {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .topbar .user-avatar.with-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: transparent !important;
    text-indent: -9999px;
    overflow: hidden;
}

html[dir="rtl"] .topbar .user-menu-caret {
    width: 16px;
    height: 16px;
    color: #5f6368;
}

html[dir="rtl"] .topbar .user-menu.open .user-menu-caret {
    transform: rotate(180deg);
}

html[dir="rtl"] .topbar .user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 300;
}

html[dir="rtl"] .topbar .user-menu-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #202124;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row-reverse;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: right;
    font-size: 15px;
}

html[dir="rtl"] .topbar .user-menu-item i,
html[dir="rtl"] .topbar .user-menu-item svg {
    width: 18px;
    height: 18px;
    color: #1a73e8;
    stroke: currentColor;
}

html[dir="rtl"] .topbar .user-menu-item:hover {
    background: #f3f7ff;
}

html[dir="rtl"] .topbar .user-menu-item.danger {
    color: #c5221f;
}

html[dir="rtl"] .topbar .user-menu-item.danger i,
html[dir="rtl"] .topbar .user-menu-item.danger svg {
    color: #c5221f;
}

html[dir="rtl"] .content {
    margin-right: 280px !important;
    margin-left: 0 !important;
}

@media (max-width: 768px) {
    html[dir="rtl"] .content {
        margin-right: 72px !important;
        margin-left: 0 !important;
    }
}

html[dir="rtl"] th,
html[dir="rtl"] td {
    text-align: right;
    vertical-align: middle;
}

html[dir="rtl"] .nav-item i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

html[dir="rtl"] .sidebar .nav-item {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 20px;
    text-decoration: none;
}

html[dir="rtl"] .sidebar .nav-item span {
    margin: 0;
    line-height: 1.35;
    white-space: nowrap;
    text-align: right;
}

html[dir="rtl"] .sidebar .nav-item i,
html[dir="rtl"] .sidebar .nav-item svg {
    color: #1a73e8;
    stroke: currentColor;
    margin: 0 !important;
}

html[dir="rtl"] .sidebar .nav-item:hover i,
html[dir="rtl"] .sidebar .nav-item:hover svg {
    color: #155fc4;
}

html[dir="rtl"] .sidebar .nav-item.active i,
html[dir="rtl"] .sidebar .nav-item.active svg {
    color: #1a73e8;
}

html[dir="rtl"] .table-actions,
html[dir="rtl"] .actions,
html[dir="rtl"] .form-actions,
html[dir="rtl"] .modal-actions {
    direction: rtl;
}

html[dir="rtl"] .status-badge {
    white-space: nowrap;
    line-height: 1.4;
}

html[dir="rtl"] .empty-state,
html[dir="rtl"] .loading,
html[dir="rtl"] .stat-card,
html[dir="rtl"] .report-card {
    text-align: center;
}

html[dir="rtl"] .patient-contact,
html[dir="rtl"] .appointment-date,
html[dir="rtl"] .case-diagnosis,
html[dir="rtl"] .plan-description,
html[dir="rtl"] .payment-method,
html[dir="rtl"] .prescription-details {
    unicode-bidi: plaintext;
}
