﻿/* Global CSS variables for MudBlazor typography */
:root {
  --mud-font-family: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-default-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-h1-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-h2-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-h3-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-h4-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-h5-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-h6-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-body1-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-body2-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-button-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-caption-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-overline-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-subtitle1-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
  --mud-typography-subtitle2-fontfamily: "Noto Sans Thai", "Sarabun", sans-serif !important;
}

/* Force font loading - ensure Google Fonts are loaded before page renders */
@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-display: swap;
}

.navdrawer-fixed {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 166px) !important;
  min-height: 0;
}

.navmenu-root {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
html {
  font-family: "Noto Sans Thai", "Sarabun", sans-serif;
  font-size: 14px; /* Mobile base */
}

body {
  font-family: "Noto Sans Thai", "Sarabun", sans-serif !important;
  font-size: inherit;
}

/* Ensure all elements inherit the font */
* {
  font-family: "Noto Sans Thai", "Sarabun", sans-serif !important;
}

/* Force Noto Sans Thai for MudBlazor components */
.mud-typography,
.mud-typography *,
.mud-button,
.mud-button *,
.mud-card,
.mud-card *,
.mud-paper,
.mud-paper *,
.mud-list-item,
.mud-list-item *,
.mud-nav-item,
.mud-nav-item *,
.mud-menu-item,
.mud-menu-item *,
.mud-table,
.mud-table *,
.mud-data-grid,
.mud-data-grid *,
.mud-grid,
.mud-grid *,
.mud-item,
.mud-item *,
.mud-text,
.mud-text *,
.mud-input,
.mud-input *,
.mud-select,
.mud-select *,
.mud-chip,
.mud-chip *,
.mud-alert,
.mud-alert *,
.mud-snackbar,
.mud-snackbar *,
.mud-dialog,
.mud-dialog *,
.mud-tooltip,
.mud-tooltip *,
.mud-tabs,
.mud-tabs *,
.mud-divider,
.mud-divider *,
.mud-expand-panel,
.mud-expand-panel *,
.mud-badge,
.mud-badge * {
  font-family: "Noto Sans Thai", "Sarabun", sans-serif !important;
}

/* Remove default borders and outlines from images */
img {
  border: none;
  outline: none;
}

/* Responsive font sizes */
@media (min-width: 640px) {
  html {
    font-size: 15px; /* Small screens */
  }
}

@media (min-width: 768px) {
  html {
    font-size: 13px; /* Medium screens */
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 17px; /* Large screens */
  }
}

@media (min-width: 1280px) {
  html {
    font-size: 18px; /* Extra large screens */
  }
}

body {
  margin: 0;
  padding: 0;
}

.modal-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  color: wheat;
  background-color: rgba(169, 169, 169, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  --sk-color: white;
}

/* Responsive AppBar layout */
.appbar {
  --banner-h: 96px; /* default (mobile) banner height */
  --toolbar-h: 56px; /* toolbar height */
}

.appbar-banner {
  width: 100%;
  height: var(--banner-h);
  object-fit: contain;
  object-position: center;
  display: block;
}

.appbar-toolbar {
  min-height: var(--toolbar-h);
}

.brand-logo {
  height: 40px;
}

.nav-drawer {
  margin-top: calc(var(--banner-h) + var(--toolbar-h));
}

.main-content {
  padding-top: calc(var(--banner-h) + var(--toolbar-h));
}

/* NavMenu bottom align for auth section */
.mud-nav-menu {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.navmenu-bottom {
  margin-top: auto;
  padding-bottom: 1.5rem;
}

.navmenu-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.navmenu-fixed {
  height: 100%;
  min-height: 0;
}

.navdrawer-fixed {
  height: calc(100vh - 206px) !important;
  min-height: 0;
}

/* >= 600px (sm) */
@media (min-width: 600px) {
  .appbar {
    --banner-h: 120px;
    --toolbar-h: 56px;
  }
  .brand-logo {
    height: 56px;
  }
}

/* >= 960px (md) */
@media (min-width: 960px) {
  .appbar {
    --banner-h: 140px;
    --toolbar-h: 64px;
  }
  .brand-logo {
    height: 64px;
  }
}

/* >= 1280px (lg) */
@media (min-width: 1280px) {
  .appbar {
    --banner-h: 160px;
    --toolbar-h: 64px;
  }
  .brand-logo {
    height: 70px;
  }
}

.clickable-image {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

/* MudDataGrid Fixed Column Width Utility */
.mud-datagrid-fixed table {
  table-layout: fixed !important;
  width: 100% !important;
}

.mud-datagrid-fixed .mud-table-cell {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding: 8px !important;
}

.mud-datagrid-fixed .mud-table-container {
  overflow-x: auto !important;
}

/* Column width utility using data attributes */
.mud-datagrid-fixed[data-col-widths] th,
.mud-datagrid-fixed[data-col-widths] td {
  box-sizing: border-box;
}

/*.mud-simple-table.mud-table-sticky-header * table thead * th {
    background-color: var(--mud-palette-surface);
    position: sticky;
    z-index: 1;
    top: 0;
}
*/
