/* ==========================================================================
   PWA Grid Template - Custom Raw Vanilla CSS
   ========================================================================== */

/* Color Variables & System Customizations */
:root {
  --bg-color: #020617;          /* Slate 950 */
  --text-main: #f1f5f9;         /* Slate 100 */
  --text-muted: #94a3b8;        /* Slate 400 */
  --border-color: rgba(30, 41, 59, 0.6); /* Slate 800 with opacity */
  --bg-card: rgba(15, 23, 42, 0.4);      /* Slate 900 with low opacity */
  --accent-primary: #10b981;    /* Emerald 500 */
  --accent-primary-hover: #059669;
  --accent-secondary: #06b6d4;  /* Cyan 500 */
  --accent-secondary-hover: #0891b2;
  --accent-alert: #f59e0b;      /* Amber 500 */
  --accent-danger: #ef4444;     /* Rose 500 */
  --accent-danger-hover: #dc2626;

  --accent-cyan-glow: rgba(6, 182, 212, 0.1);
  --accent-emerald-glow: rgba(16, 185, 129, 0.1);
  --accent-amber-glow: rgba(245, 158, 11, 0.1);

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --container-max-width: 80rem; /* 1280px */
}

/* Document-level setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

/* Theme Options: Light Mode Styling overrides */
html.light {
  --bg-color: #f8fafc;          /* Slate 50 */
  --text-main: #0f172a;         /* Slate 900 */
  --text-muted: #475569;        /* Slate 600 */
  --border-color: rgba(203, 213, 225, 0.8); /* Slate 300 */
  --bg-card: rgba(255, 255, 255, 0.9);
  --accent-cyan-glow: rgba(6, 182, 212, 0.05);
  --accent-emerald-glow: rgba(16, 185, 129, 0.05);
  --accent-amber-glow: rgba(245, 158, 11, 0.05);
}

/* Accessible High Contrast Mode Styles (WCAG 2.1 AAA Compliance) */
html.high-contrast {
  --bg-color: #000000 !important;
  --text-main: #ffffff !important;
  --text-muted: #ffffff !important;
  --border-color: #ffffff !important;
  --bg-card: #000000 !important;
  --accent-primary: #00ffcc !important;
  --accent-primary-hover: #00e6b8 !important;
  --accent-secondary: #00ffcc !important;
  --accent-secondary-hover: #00e6b8 !important;
  --accent-alert: #facc15 !important;
  --accent-danger: #ff5555 !important;
  --accent-danger-hover: #ff3333 !important;
}

/* Body Styling classes */
body.pwa-body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.15s ease;
}

/* Header & Navigation */
.pwa-header {
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(2, 6, 17, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 16px;
}

html.light .pwa-header {
  background-color: rgba(248, 250, 252, 0.8);
}

html.high-contrast .pwa-header {
  background-color: #000000;
  border-bottom: 3px solid #ffffff;
}

/* Alignment Container utilities */
.pwa-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 768px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Inner elements and widgets */
.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background-color: var(--accent-emerald-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  user-select: none;
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Controls Grid in Ribbon Header */
.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Badge for Offline/Online Network Connection */
.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.connection-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-checking {
  background-color: #64748b;
  animation: pulse-checking 1.5s infinite ease-in-out;
}

.dot-online {
  background-color: #10b981;
  animation: pulse-checking 2s infinite ease-in-out;
}

.dot-offline {
  background-color: #f59e0b;
}

@keyframes pulse-checking {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Controls panel grouping standard actions */
.action-panel-group {
  display: flex;
  align-items: center;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

html.light .action-panel-group {
  background-color: #e2e8f0;
}

/* Option Inputs */
.option-label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}

.option-label:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

html.light .option-label:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.option-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background-color: var(--bg-color);
  border: 1px solid var(--text-muted);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  outline: none;
}

.option-checkbox:checked {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.option-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 4px;
  height: 6px;
  border: solid rgba(2, 6, 17, 1);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

html.high-contrast .option-checkbox:checked::after {
  border-color: #000000 !important;
}

.option-text {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
}

.panel-separator {
  width: 1px;
  height: 12px;
  background-color: var(--border-color);
}

/* Core Main Layout Context */
.pwa-main {
  flex: 1;
  width: 100%;
  padding: 24px 16px;
}

/* Core Responsive CSS Grid layout */
.pwa-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .pwa-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .pwa-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Individual Grid Card design framework - pure CSS */
.grid-cell-block {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background-color: var(--bg-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 290px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.grid-cell-block.active {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}

.cell-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cell-meta-title {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cell-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: rgba(2, 6, 17, 0.4);
  color: var(--text-muted);
}

.badge-active {
  color: var(--accent-primary);
  border-color: rgba(16, 185, 129, 0.3);
  background-color: var(--accent-emerald-glow);
}

.badge-queue {
  color: var(--accent-alert);
  border-color: rgba(245, 158, 11, 0.3);
  background-color: var(--accent-amber-glow);
}

.badge-blue {
  color: var(--accent-secondary);
  border-color: rgba(6, 182, 212, 0.3);
  background-color: var(--accent-cyan-glow);
}

/* Card Content Typography Typography pairing styling */
.cell-heading {
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

html.light .cell-heading {
  color: #0f172a;
}

.cell-paragraph {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Forms & Controls Elements styles */
.pwa-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.pwa-form-row {
  position: relative;
}

.pwa-input,
.pwa-textarea {
  width: 100%;
  font-family: var(--font-family);
  font-size: 12px;
  background-color: rgba(2, 6, 17, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

html.light .pwa-input,
html.light .pwa-textarea {
  background-color: #ffffff;
  color: #0f172a;
}

.pwa-input:focus,
.pwa-textarea:focus {
  border-color: var(--accent-primary);
}

.pwa-textarea {
  resize: none;
}

.pwa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-btn-primary {
  background-color: var(--accent-primary);
  color: #020617;
}

.pwa-btn-primary:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.pwa-btn-muted {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.pwa-btn-muted:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

html.light .pwa-btn-muted:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.pwa-btn-alert {
  background-color: var(--accent-amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-alert);
}

.pwa-btn-alert:hover {
  background-color: rgba(245, 158, 11, 0.2);
}

.pwa-btn-cyan {
  background-color: var(--bg-card);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-secondary);
}

.pwa-btn-cyan:hover {
  background-color: var(--accent-cyan-glow);
  color: #ffffff;
}

.pwa-btn-cyan-active {
  background-color: var(--accent-secondary);
  color: #020617;
}

.pwa-btn-cyan-active:hover {
  background-color: var(--accent-secondary-hover);
}

/* List buffer queue container mapping */
.submissions-list {
  max-height: 144px;
  overflow-y: auto;
  gap: 8px;
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  padding-right: 4px;
}

.offline-dummy-notice {
  padding: 16px;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  text-align: center;
}

.dummy-notice-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.dummy-notice-sub {
  font-size: 10px;
  color: #556780;
  margin-top: 4px;
}

/* Custom terminal console design */
.terminal-hud {
  width: 100%;
}

.terminal-panel {
  width: 100%;
  height: 128px;
  background-color: rgba(2, 6, 17, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

html.light .terminal-panel {
  background-color: #0f172a;
}

/* Accessible focus overrides */
*:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* Popups & Biometric Custom dialog Simulator Overlay styles */
.simulator-overlay {
  display: none; /* hidden by default */
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 16px;
  animation: fade-in 0.2s ease-out;
}

.simulator-overlay.flex {
  display: flex;
}

.simulator-box {
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 24rem; /* 384px */
  padding: 24px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
}

html.light .simulator-box {
  background-color: #ffffff;
}

.simulator-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--accent-cyan-glow);
  border: 1px solid rgba(6, 182, 212, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 16px;
}

.simulator-icon-wrapper.pulse-emerald {
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
  }
}

.simulator-box-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

html.light .simulator-box-title {
  color: #0f172a;
}

.simulator-box-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.simulator-actions {
  display: flex;
  gap: 12px;
}

.simulator-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}

.btn-sim-cancel {
  background-color: rgba(2, 6, 17, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-sim-cancel:hover {
  background-color: rgba(2, 6, 17, 0.8);
}

.btn-sim-approve {
  background-color: var(--accent-secondary);
  color: #020617;
}

.btn-sim-approve:hover {
  background-color: var(--accent-secondary-hover);
}

/* Floating Offline Toast Notification system styling */
.offline-toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 50;
  padding: 16px;
  border-radius: 12px;
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fef3c7;
  max-width: 24rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  display: flex;
  gap: 12px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  animation: toast-slid-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.offline-toast.hidden {
  display: none !important;
}

.toast-body-heading {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.toast-body-text {
  font-size: 10px;
  color: rgba(254, 243, 199, 0.85);
  line-height: 1.4;
}

@keyframes toast-slid-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Landscape footer elements */
.pwa-footer {
  border-t: 1px solid var(--border-color);
  background-color: rgba(2, 6, 17, 0.9);
  padding: 16px 24px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
  }
}

.footer-text {
  font-size: 11px;
  color: #475569;
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  color: #475569;
  font-size: 11px;
  font-family: var(--font-mono);
  text-decoration: underline;
  text-decoration-style: dotted;
}

.footer-link:hover {
  color: var(--text-muted);
}

/* Screenreader 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-width: 0;
}
