:root {
  --main-background: #f8f9fa;
  --main-content: #2b4570;
  --secondary-color: #7b6b94;
  --accent-color: #daa520;

  /* Form specific variables - Light Theme */
  --form-background: #f9f9f9;
  --form-text-primary: #333;
  --form-text-secondary: #555;
  --form-input-background: #ffffff;
  --form-input-text: #495057;
  --form-input-border: #ced4da;

  /* Shared Design Tokens (used across task-detail, issue-list, issue-detail) */
  --td-primary: #2463eb;
  --td-primary-hover: #1d56d0;
  --td-primary-shadow: rgba(36, 99, 235, 0.3);
  --td-primary-shadow-light: rgba(36, 99, 235, 0.2);
  --td-bg: #f6f6f8;
  --td-surface: #ffffff;
  --td-border: #e2e8f0;
  --td-text: #0f172a;
  --td-text-secondary: #64748b;
  --td-text-muted: #94a3b8;
  --td-grid-line: rgba(0, 0, 0, 0.06);
  --td-grid-bg: #d4d8df;
  --td-nav-bg: rgba(255, 255, 255, 0.8);
  --td-label-bg: rgba(255, 255, 255, 0.9);
  --td-radius-xl: 0.75rem;
  --td-radius-lg: 0.5rem;
  --td-radius-full: 9999px;
  --td-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
    'Helvetica Neue', sans-serif;
  --td-green: #16a34a;
  --td-green-bg: #f0fdf4;
  --td-red: #dc2626;
  --td-red-bg: #fef2f2;
  --td-amber: #d97706;
  --td-amber-bg: #fffbeb;

  transition: all 0.3s ease;
}

:root[data-theme="dark"],
[data-theme='dark'] {
  /* Core Palette */
  --main-background: #1A201E;
  --main-content: #E2E2E2;
  --secondary-color: #607d6a;
  --accent-color: #B89B72;

  /* Form Specific Variables */
  --form-background: #252c29;
  --form-text-primary: #FFFFFF;
  --form-text-secondary: #C0C0C0;
  --form-input-background: #333d39;
  --form-input-text: #E2E2E2;
  --form-input-border: #607d6a;

  /* Shared Design Tokens – Dark */
  --td-bg: #111621;
  --td-surface: #1a202c;
  --td-border: #2d3748;
  --td-text: #f1f5f9;
  --td-text-secondary: #94a3b8;
  --td-text-muted: #64748b;
  --td-grid-line: rgba(255, 255, 255, 0.06);
  --td-grid-bg: #2d3748;
  --td-nav-bg: rgba(26, 32, 44, 0.8);
  --td-label-bg: rgba(26, 32, 44, 0.9);
  --td-green-bg: #052e16;
  --td-red-bg: #450a0a;
  --td-amber-bg: #451a03;
}

/* ── Universal Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
  /* Prevent rubber-band overscroll blur on iOS */
  overscroll-behavior-x: none;
}

body { /* Removed .uk-container from selector */
  background-image: url('/assets/bg-light.jpg');
  background-size: cover;
  background-attachment: fixed;
  color: var(--main-content);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Reduce tap highlight flash on mobile without changing appearance */
  -webkit-tap-highlight-color: transparent;
  /* Slight text-rendering tweak for clearer glyphs on high-DPI */
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] body { /* Removed .uk-container from selector */
  background-image: url('/assets/bg-dark.jpg'); /* Keep existing background image */
  color: var(--main-content); /* Ensure body text uses the high contrast color */
}

/* General heading styles, no longer tied to .uk-container */
h1, h2, h3, h4, h5, h6 {
  color: var(--main-content);
  /* Add some default margins for headings if desired, as UIkit might have provided them */
  margin-top: 1em;
  margin-bottom: 0.5em;
}


/* ================================================================
   Global date input – remove calendar icon, click anywhere to open
   ================================================================ */
input[type="date"] {
  position: relative;
  cursor: pointer;
}

/* Hide native calendar icon; expand hit area so click anywhere opens picker */
input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

/* Read-only date: no picker, default cursor */
input[type="date"]:read-only {
  cursor: default;
}
input[type="date"]:read-only::-webkit-calendar-picker-indicator {
  display: none;
  pointer-events: none;
}

/* Firefox: remove native dropdown arrow if present */
input[type="date"]::-moz-focus-inner {
  border: 0;
}

/* Keyboard and focus: visible focus ring for accessibility */
input[type="date"]:focus-visible {
  outline: 2px solid var(--td-primary);
  outline-offset: 2px;
}

/* ================================================================
   Workflow validation messages – theme-aligned, accessible
   Aligns with --td-red / --td-red-bg and existing validation system
   ================================================================ */
.app-workflow-message {
  font-family: var(--td-font);
  font-size: 0.75rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--td-red);
  background: var(--td-red-bg);
  padding: 8px 12px;
  border-radius: var(--td-radius-lg);
  border-left: 3px solid var(--td-red);
  margin: 0 0 12px;
}

[data-theme='dark'] .app-workflow-message {
  background: var(--td-red-bg);
}

.app-workflow-message:focus {
  outline: 2px solid var(--td-primary);
  outline-offset: 2px;
}

/* ================================================================
   Mobile rendering polish (iPhone / small viewports)
   Visual quality only – no layout or logic changes.
   ================================================================ */
/* Prevent iOS zoom on input focus (broken rendering when font-size < 16px) */
@media (max-width: 1024px) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: max(16px, 1em);
  }
}

/* Crisp images: prevent stretch and pixelation */
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}
img[width][height] {
  object-fit: contain;
}

/* Icon fonts: ensure sharp rendering on high-DPI */
.material-symbols-outlined {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Example of a generic container class you might want to add later if needed */
/*
.app-container {
  width: 90%;
  max-width: 1200px; 
  margin-left: auto;
  margin-right: auto;
  padding-left: 15px;
  padding-right: 15px;
  box-sizing: border-box;
}
*/
