/* ==========================================================================
   Medyatek SaaS — Base Reset, Inter Optical Typography & Dark/Light Native Fixes
   File: frontend/css/reset.css
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  overflow-x: hidden;
}

h1, h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  line-height: 1.35;
}

p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: var(--font-sans);
  font-feature-settings: inherit;
  font-size: inherit;
  color: inherit;
}

/* Native Windows Chromium Dropdown Dark/Light Safety */
html:not([data-theme="light"]) select,
html:not([data-theme="light"]) option,
html:not([data-theme="light"]) optgroup {
  background-color: #141923;
  color: #F8FAFC;
}

html[data-theme="light"] select,
html[data-theme="light"] option,
html[data-theme="light"] optgroup {
  background-color: #FFFFFF;
  color: #0F172A;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-default);
  margin: 24px 0;
}

[hidden] {
  display: none !important;
}

/* Keyboard Focus Accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Inline SVG Icon Alignment */
.mtk-svg,
.mtk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.mtk-icon svg {
  width: 100%;
  height: 100%;
}

/* Quiet Theme-Aware Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Shared Micro-Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mtk-tabular {
  font-variant-numeric: tabular-nums;
}

.mtk-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mtk-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mtk-stack-sm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mtk-stack-lg {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mtk-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mtk-row-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.mtk-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.mtk-text-muted { color: var(--text-muted); }
.mtk-text-faint { color: var(--text-faint); }
.mtk-text-secondary { color: var(--text-secondary); }
.mtk-text-primary { color: var(--text-primary); }
.mtk-text-accent { color: var(--accent-primary); }
.mtk-text-success { color: var(--status-success-text); }
.mtk-text-warning { color: var(--status-warning-text); }
.mtk-text-danger { color: var(--status-danger-text); }
.mtk-text-info { color: var(--status-info-text); }

.mtk-text-xs { font-size: var(--text-xs); }
.mtk-text-sm { font-size: var(--text-sm); }
.mtk-font-medium { font-weight: 500; }
.mtk-font-semibold { font-weight: 600; }

/* Keyframes */
@keyframes mtk-spin {
  to { transform: rotate(360deg); }
}

@keyframes mtk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes mtk-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mtk-slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes mtk-pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.mtk-spin {
  animation: mtk-spin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
