/**
 * Khmer Font Families
 * Kantomruy Pro and Hanuman fonts for Khmer language support
 */

/* Kantomruy Pro Font Family */
@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap');

/* Hanuman Font Family */
@import url('https://fonts.googleapis.com/css2?family=Hanuman:wght@100;300;400;700;900&display=swap');

/* Root font variables */
:root {
    --font-khmer-primary: 'Kantumruy Pro', sans-serif;
    --font-khmer-secondary: 'Hanuman', serif;
}

/* Apply Kantomruy Pro as default for Khmer locale */
html[lang="km"],
html[lang="km-KH"] {
    font-family: 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Apply to body for Khmer content */
body[data-lang="km"],
body[data-lang="km-KH"],
.khmer-text,
.lang-km {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Hanuman for specific elements (headings, titles) */
.khmer-heading,
.khmer-title,
h1.khmer,
h2.khmer,
h3.khmer {
    font-family: 'Hanuman', serif;
    font-weight: 700;
}

/* Kantumruy Pro weight classes */
.font-khmer-thin {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 100;
}

.font-khmer-extralight {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 200;
}

.font-khmer-light {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 300;
}

.font-khmer-regular {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 400;
}

.font-khmer-medium {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 500;
}

.font-khmer-semibold {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 600;
}

.font-khmer-bold {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 700;
}

/* Hanuman weight classes */
.font-hanuman-thin {
    font-family: 'Hanuman', serif;
    font-weight: 100;
}

.font-hanuman-light {
    font-family: 'Hanuman', serif;
    font-weight: 300;
}

.font-hanuman-regular {
    font-family: 'Hanuman', serif;
    font-weight: 400;
}

.font-hanuman-bold {
    font-family: 'Hanuman', serif;
    font-weight: 700;
}

.font-hanuman-black {
    font-family: 'Hanuman', serif;
    font-weight: 900;
}

/* Improved Khmer text rendering */
.khmer-text,
html[lang="km"] body,
html[lang="km-KH"] body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Khmer line height adjustments for better readability */
.khmer-text,
html[lang="km"] p,
html[lang="km"] span,
html[lang="km"] div {
    line-height: 1.75;
}

/* Khmer button and form styles */
html[lang="km"] button,
html[lang="km"] .btn,
html[lang="km"] input,
html[lang="km"] select,
html[lang="km"] textarea {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Navigation and menu items */
html[lang="km"] .nav-link,
html[lang="km"] .nav-text,
html[lang="km"] .menu-item,
html[lang="km"] .sidebar-text,
html[lang="km"] .nav-item-caption {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 400;
}

/* Nav item caption - section headers in sidebar */
.nav-item-caption {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 600;
    letter-spacing: 0.05em;
}

html[lang="km"] .nav-item-caption span,
html[lang="km"] .nav-item-caption .fadeable {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 600;
}

/* Sidebar and navigation specific styles */
html[lang="km"] .sidebar .nav-item-caption,
html[lang="km"] .sidebar-section .nav-item-caption {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0.02em;
}

/* Ensure nested spans in nav-item-caption use Khmer font */
.nav-item-caption span {
    font-family: inherit;
}

html[lang="km"] .nav-item-caption span {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 600;
}

/* Fadeable elements in navigation */
html[lang="km"] .fadeable,
html[lang="km"] .fadeinable {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Table content */
html[lang="km"] table,
html[lang="km"] .table,
html[lang="km"] th,
html[lang="km"] td {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Card and panel content */
html[lang="km"] .card,
html[lang="km"] .panel,
html[lang="km"] .card-body,
html[lang="km"] .card-title {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Alert and notification messages */
html[lang="km"] .alert,
html[lang="km"] .notification,
html[lang="km"] .toast {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Headings for Khmer */
html[lang="km"] h1,
html[lang="km"] h2,
html[lang="km"] h3,
html[lang="km"] h4,
html[lang="km"] h5,
html[lang="km"] h6,
html[lang="km"] .h1,
html[lang="km"] .h2,
html[lang="km"] .h3,
html[lang="km"] .h4,
html[lang="km"] .h5,
html[lang="km"] .h6 {
    font-family: 'Hanuman', serif;
    font-weight: 700;
    line-height: 1.5;
}

/* Badge and label styles */
html[lang="km"] .badge,
html[lang="km"] .label,
html[lang="km"] .tag {
    font-family: 'Kantumruy Pro', sans-serif;
    font-weight: 500;
}

/* Dropdown and select menus */
html[lang="km"] .dropdown-menu,
html[lang="km"] .dropdown-item,
html[lang="km"] select option {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Modal content */
html[lang="km"] .modal-content,
html[lang="km"] .modal-header,
html[lang="km"] .modal-body,
html[lang="km"] .modal-footer {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Tooltip and popover */
html[lang="km"] .tooltip,
html[lang="km"] .popover {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Breadcrumb */
html[lang="km"] .breadcrumb {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Pagination */
html[lang="km"] .pagination {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* List group */
html[lang="km"] .list-group-item {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Tabs and pills */
html[lang="km"] .nav-tabs,
html[lang="km"] .nav-pills,
html[lang="km"] .nav-item {
    font-family: 'Kantumruy Pro', sans-serif;
}

/* Ensure consistent font size for Khmer characters */
html[lang="km"] {
    font-size: 16px;
}

/* Responsive font sizes for Khmer */
@media (max-width: 576px) {
    html[lang="km"] {
        font-size: 14px;
    }
}

@media (min-width: 1200px) {
    html[lang="km"] {
        font-size: 17px;
    }
}
