/* TGR Brand and UI Stylesheet / styles.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  /* Brandbook Color System */
  --color-big-stone: #173042;      /* Deep Navy (Primary / Card Header) */
  --color-mirage: #14202a;         /* Black-Blue (Global background shadow) */
  --color-racing-green: #070c0b;   /* Near-Black Forest Green (Text) */
  --color-electric-lime: #c8ff00;  /* Neon Lime Accent (Active glow) */
  --color-wild-sand: #f6f6f6;      /* Neutral Light Gray (Input backing) */
  --color-white: #ffffff;          /* Pure White */

  /* UI Tokens */
  --bg-app: #f6f6f6;
  --bg-card: #FFFFFF;
  --bg-card-hover: #fafafa;
  --border-color: rgba(23, 48, 66, 0.15);
  --border-glow: rgba(200, 255, 0, 0.8); /* High visibility lime glow */
  
  --primary: #173042;
  --primary-hover: #14202a;
  --secondary: #54606b;
  --accent: #c8ff00;
  
  --danger: #ba1a1a;
  --danger-hover: #93000a;
  --success: #10B981;
  --warning: #F59E0B;
  
  --text-primary: #070c0b; /* Deep racing green for maximum contrast */
  --text-muted: #54606b;
  --text-dark: #173042;
  
  --font-display: "Montserrat", "Arial Nova", "Arial", sans-serif;
  --font-body: "Inter", "Arial Nova", "Arial", sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  padding-bottom: 5rem;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-big-stone);
}

/* Header */
header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--primary);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand img {
  height: 40px;
  width: auto;
  border-radius: var(--radius-sm);
}

.brand-text-container {
  display: flex;
  flex-direction: column;
}

.brand-main {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  text-transform: lowercase;
  color: var(--primary);
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: var(--secondary);
}

.brand-group {
  letter-spacing: 0.15em;
}

#app-version {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: rgba(23, 48, 66, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 0.5rem;
}

.header-status-panel {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.sync-dot.offline {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.sync-text {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

#save-indicator {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--success);
}

/* Data Shielding Alert Banner */
#shielding-violation-banner {
  background-color: var(--danger);
  color: var(--color-white);
  padding: 10px 1.5rem;
  text-align: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 0.9rem;
  display: none;
  z-index: 999;
  position: relative;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

/* Container */
.container {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
  text-transform: uppercase;
}

.card-title svg {
  width: 20px;
  height: 20px;
  stroke: var(--primary);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  background: var(--color-wild-sand);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

/* High Contrast Focus State for Solar Glare */
input:focus, select:focus, textarea:focus {
  border-color: var(--color-electric-lime);
  box-shadow: 0 0 0 3px var(--border-glow);
  background: var(--color-white);
}

/* Radio Group */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-wild-sand);
  border: 2px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.radio-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.radio-option:hover {
  background: #eaeaea;
}

.radio-option.selected {
  border-color: var(--primary);
  background: rgba(23, 48, 66, 0.08);
}

/* Buttons */
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
  min-height: 48px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--color-white);
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 0 10px var(--border-glow);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-wild-sand);
}

.btn-success {
  background-color: var(--success);
  color: var(--color-white);
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  background-color: #0d9488;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--color-white);
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
  box-shadow: 0 0 8px rgba(186, 26, 26, 0.4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bent Hub */
.bent-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.bent-card {
  background: var(--color-wild-sand);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  text-align: center;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.bent-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--color-white);
}

.bent-card.active {
  border-color: var(--primary);
  background: rgba(23, 48, 66, 0.08);
  box-shadow: 0 0 10px rgba(23, 48, 66, 0.15);
}

.bent-card.completed {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.bent-card-progress {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Active Bent Workspace Area */
#active-bent-container {
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--color-white);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 6px 12px rgba(23,48,66,0.1);
}

.active-bent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.active-bent-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.active-bent-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.active-bent-close-btn {
  font-size: 0.8rem;
  padding: 6px 12px;
  min-height: auto;
}

/* Image Capture Layout */
.photo-slot-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--color-wild-sand);
  border: 2px dashed var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  position: relative;
}

.photo-thumbnail-wrapper {
  position: relative;
  width: 100%;
  max-width: 200px;
}

.photo-thumbnail-wrapper img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.photo-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: var(--color-white);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.photo-status-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  display: inline-block;
  font-weight: 700;
  text-transform: uppercase;
}

.photo-status-badge.pending {
  background: var(--warning);
  color: #78350f;
}

.photo-status-badge.synced {
  background: var(--success);
  color: var(--color-white);
}

/* Camera Overlay */
.camera-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 10000;
  display: none;
  flex-direction: column;
}

.camera-stream {
  width: 100%;
  height: 80%;
  object-fit: cover;
}

.camera-reticle {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 60%;
  border: 3px dashed var(--color-electric-lime);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.camera-controls {
  flex: 1;
  background: #000000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.camera-shutter-btn {
  background: var(--color-electric-lime);
  color: #000;
  border: 3px solid #000;
  font-weight: 900;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(255,255,255,0.2);
}

.camera-cancel-btn {
  color: #fff;
  background: #333;
  border: 1px solid #fff;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Dialog Modal */
.dialog-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.dialog-content {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
}

.dialog-actions button {
  flex: 1;
}

.signature-canvas-wrapper {
  border: 2px solid var(--border-color);
  background: #fff;
  border-radius: var(--radius-sm);
  width: 100%;
  height: 150px;
}

.signature-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Alert styles */
.alert-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--danger);
  margin-top: 4px;
}
