/* ============================================================
 * MZ Cards Base Styles
 * CSS reset + base element styling (body, a, table, input, etc.)
 * Phase 3 of UI Modernization.
 *
 * Extracted from application.css + im_styles.css.
 * ============================================================ */

/* === Reset === */
* {
  box-sizing: border-box;
}

/* === Body === */
body {
  background: var(--bg);
  font-family: var(--font-sans);
  color: var(--text);
  margin: 0;
  overflow: hidden;
}

/* === Links === */
a:link,
a:visited {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 2px;
}

/* === Inline SVG icons (see ApplicationHelper#icon) === */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
a:has(> .icon:only-child) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === Tables === */
table {
  width: calc(100% - 30px);
  margin: 10px 15px;
  border-collapse: collapse;
  border: 1px solid var(--border);
  background: var(--surface);
}

table th,
table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
}

table th {
  background: var(--surface-2);
  font-weight: var(--font-semibold);
}

table tr:nth-child(even) {
  background: var(--surface-2);
}

table tr:hover {
  background: var(--accent-soft);
}

/* === Form inputs === */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
textarea,
select {
  width: 100%;
  font-size: 1em;
  padding: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* === Pagination === */
.pagy {
  margin: 15px;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.pagy a {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition-base), border-color var(--transition-base);
}

.pagy a:hover {
  background: var(--surface-2);
}

.pagy a.current {
  background: var(--accent-border);
  border-color: var(--border);
}

/* === Utility classes === */
.flex {
  display: flex;
}
.flex-1 {
  flex: 1;
}
.shrink {
  flex: 0 1 auto;
}
.space-between {
  justify-content: space-between;
}

/* === Columns Grid === */
.columns-horizontal {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--space-2);
}
.columns-horizontal > *:hover {
  background: var(--surface-3);
}

/* === Comment actions === */
.comment-show form {
  display: inline;
  opacity: 0.1;
}
.comment-show:hover form {
  opacity: 1;
}
.comment-show button {
  font-size: 0.5em;
}

/* === Search input === */
#search-input {
  border-radius: var(--radius-md);
  border-color: var(--border);
}

/* === Loading spinner === */
.loading-spinner {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
}

/* === Long action submitting state === */
.is-long-action-submitting {
  cursor: progress;
  opacity: 0.75;
}

/* === Code blocks === */
.card-content pre,
.ai-content pre,
.comment-content pre {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  overflow-x: auto;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.card-content code,
.ai-content code,
.comment-content code {
  background: var(--surface-3);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

/* === Blockquotes === */
.card-content blockquote,
.ai-content blockquote,
.comment-content blockquote {
  border-left: 3px solid var(--accent);
  margin: var(--space-3) 0;
  padding-left: var(--space-3);
  color: var(--text-muted);
}

/* === Lists === */
.card-content ul,
.card-content ol,
.comment-content ul,
.comment-content ol {
  margin: var(--space-3) 0;
  padding-left: 25px;
}

.card-content li,
.comment-content li {
  margin: var(--space-1) 0;
}

/* === Auto-resize textarea === */
textarea[data-auto-resize] {
  overflow: hidden;
}
