/* Shared Components & Utilities */

[hidden] {
  display: none !important;
}

/* Checkbox Customization */
input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--checkbox-border, rgba(148, 163, 184, 0.55));
  background: var(--checkbox-bg, rgba(15, 23, 42, 0.45));
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="checkbox"]::after {
  content: "";
  display: block;
  width: 6px;
  height: 10px;
  border: 2px solid transparent;
  border-bottom-color: var(--checkbox-icon, #ffffff);
  border-right-color: var(--checkbox-icon, #ffffff);
  transform: rotate(45deg) scale(0);
  transform-origin: center;
  transition: transform 0.12s ease;
}

input[type="checkbox"]:checked {
  background: var(--checkbox-checked, #38bdf8);
  border-color: var(--checkbox-checked, #38bdf8);
}

input[type="checkbox"]:checked::after {
  transform: rotate(45deg) scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent, #38bdf8);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop[hidden] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal {
  background: var(--bg-alt, #111827);
  border: 1px solid var(--border, #1f2937);
  border-radius: var(--radius-lg, 16px);
  width: min(720px, 92vw);
  max-height: 85vh;
  overflow: auto;
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(0, 0, 0, 0.5));
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border, #1f2937);
  font-weight: 700;
  background: var(--surface, rgba(17, 24, 39, 0.95));
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-body {
  padding: 24px;
  color: var(--text, #e5e7eb);
}

.modal-body pre {
  margin: 16px 0;
  padding: 16px;
  background: var(--bg, #050a18);
  border: 1px solid var(--border, #1f2937);
  border-radius: var(--radius-md, 8px);
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Markdown Content in Modals */
.markdown-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  line-height: 1.7;
  font-size: 15px;
  word-break: break-word;
}

.modal-body .markdown-body p {
  margin: 0;
}

.modal-body .markdown-body ul {
  margin: 0;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-body .markdown-body li {
  margin: 0;
}

.modal-body .markdown-body blockquote {
  margin: 0;
  padding-left: 16px;
  border-left: 4px solid var(--border-strong, rgba(148, 163, 184, 0.35));
  color: var(--text-muted, rgba(226, 232, 240, 0.7));
  font-style: italic;
}

.modal-body .markdown-body code {
  background: var(--surface-emphasis, rgba(148, 163, 184, 0.1));
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, SFMono-Regular, "Menlo", Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  color: var(--accent, #38bdf8);
}

/* Theme Specific Overrides for Modals handled via variables */
/* The variables --bg-alt, --border, --text etc. are defined in dashboard.css 
   and will update automatically when data-theme changes */
