/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ---- DevOps Dashboard styles ---- */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #2563eb;
  --danger: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 20px 64px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.topbar__brand:hover { text-decoration: none; }
.topbar__logo { width: 28px; height: 28px; display: block; }
.topbar__nav { display: flex; align-items: center; gap: 16px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-header h1 { margin: 4px 0 0; font-size: 1.6rem; }
.page-header__actions { display: flex; gap: 8px; }
.breadcrumb { color: var(--muted); font-size: 0.85rem; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.org-group { margin-bottom: 32px; }
.org-group__header {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.org-group__title { margin: 0; font-size: 1.2rem; }
.org-group__title a { color: inherit; text-decoration: none; }
.org-group__title a:hover { text-decoration: underline; }
.org-group__actions { display: flex; align-items: center; gap: 8px; }
.org-group__add { margin-left: auto; }
.org-group__empty { margin: 0; }

.app-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.app-card__title { font-weight: 600; font-size: 1.05rem; }
.app-card__org { color: var(--muted); font-size: 0.85rem; }
.app-card__error { color: var(--danger); font-size: 0.9rem; }

.tech-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tech-list__counts { color: var(--muted); font-size: 0.85rem; margin-left: 6px; }

/* Dashboard card: per-directory technology breakdown */
.card-component + .card-component { margin-top: 12px; }
.card-component__path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px;
}
.tech-pill { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.tech-pill__counts { color: var(--muted); }
/* Same brand colors as the per-technology blocks on the application show page,
   applied to the logo only (the SVG fills with currentColor). */
.tech-pill--ruby .tech-logo { color: #9b1c17; }
.tech-pill--javascript .tech-logo { color: #f7df1e; background: #1f2933; }
.tech-pill--docker .tech-logo { color: #2496ed; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #eef2f7; color: #374151; }
.badge--tech { background: #e0edff; color: #1d4ed8; }
.badge--completed { background: #dcfce7; color: #166534; }
.badge--failed { background: #fee2e2; color: #991b1b; }
.badge--pending, .badge--fetching, .badge--parsing, .badge--enriching { background: #fef9c3; color: #854d0e; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 0.9rem; cursor: pointer; }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn--ghost { background: transparent; }
.btn--icon { display: inline-flex; align-items: center; justify-content: center; padding: 10px 14px; line-height: 0; }
.btn__icon { width: 14px; height: 14px; display: block; }

.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash--notice { background: #dcfce7; color: #166534; }
.flash--alert { background: #fee2e2; color: #991b1b; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field input, .field textarea, .auth-card input {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; width: 100%;
}
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--border); }

.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.muted { color: var(--muted); }

.detail__status { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
/* Component (path) box */
.component-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin: 20px 0; overflow: hidden; }
.component-box__path { padding: 12px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; background: #f0f2f5; border-bottom: 1px solid var(--border); }

/* Per-technology block, tinted with the brand color */
.tech-block { margin: 0; }
.tech-block + .tech-block { border-top: 1px solid var(--border); }
/* The header is a <summary>: clickable, folds the body. Strip the native
   disclosure marker so only our caret shows. */
.tech-block__header { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer; list-style: none; }
.tech-block__header::-webkit-details-marker { display: none; }
.tech-block__header::marker { content: ""; }
.tech-logo { width: 20px; height: 20px; flex: none; }

/* Counts + caret, pushed to the right of the header. */
.tech-block__meta { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tech-block__counts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 400; font-size: 0.85rem; opacity: 0.9; }
.tech-block__count-line { white-space: nowrap; }
.tech-block__outdated { cursor: default; }
.tech-block__caret { display: inline-flex; flex: none; transition: transform 0.15s ease; }
.tech-block__caret .btn__icon { width: 18px; height: 18px; }
/* Chevron points down by default; rotate to point up while the block is folded. */
.tech-block:not([open]) .tech-block__caret { transform: rotate(180deg); }

.tech-block--ruby .tech-block__header { background: #9b1c17; color: #fff; }
.tech-block--ruby .tech-block__body { background: rgba(155, 28, 23, 0.06); }
.tech-block--javascript .tech-block__header { background: #f7df1e; color: #1f2933; }
.tech-block--javascript .tech-block__body { background: rgba(247, 223, 30, 0.14); }
.tech-block--docker .tech-block__header { background: #2496ed; color: #fff; }
.tech-block--docker .tech-block__body { background: rgba(36, 150, 237, 0.07); }

.tech-block__body { padding: 4px 16px 12px; }

/* Two columns: primary on the left, transitive on the right */
.dep-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.dep-row:last-child { border-bottom: none; }
.dep-row--head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 8px 0; }
.dep-row__primary { align-self: start; }
.dep-row__count { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.dep-row__children { list-style: none; padding: 0; margin: 0; }
.dep-row__children li { padding: 1px 0; }
.dep__version { cursor: default; font-weight: 400; color: var(--muted); }
/* Required (declared) version range on a transitive dep: hint that hovering
   reveals the resolved version. */
.dep__version--required { text-decoration: underline dotted; text-underline-offset: 2px; }

/* Clickable name+version that opens the package metadata popover. The pointer
   cursor also overrides .dep__version's default cursor so hovering the version
   shows the hand too. */
.dep__pkg { position: relative; }
.dep__trigger, .dep__trigger .dep__version { cursor: pointer; }
.dep__trigger:hover strong { text-decoration: underline; text-underline-offset: 2px; }

/* Click-to-open package metadata popover (see the popover Stimulus controller).
   The controller moves it to <body> and positions it in page coordinates so it
   isn't clipped by the component box's overflow and scrolls with the page. */
.popover {
  position: absolute; z-index: 1090; width: 260px; max-width: calc(100vw - 16px);
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  font-size: 0.8rem; line-height: 1.45; text-align: left;
}
.popover[hidden] { display: none; }
.popover__header {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.popover__header strong { font-weight: 600; }
.popover__version { color: var(--muted); font-weight: 400; }
.popover__body { padding: 10px 12px; }
.popover__description { margin: 0 0 10px; }
.popover__versions { margin: 0 0 10px; }
.popover__versions:last-child { margin-bottom: 0; }
.popover__version-row { display: flex; justify-content: space-between; gap: 12px; }
.popover__version-row dt { color: var(--muted); margin: 0; }
.popover__version-row dd { margin: 0; font-weight: 600; }
.popover__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.popover__links a { color: var(--primary); text-decoration: none; }
.popover__links a:hover { text-decoration: underline; }

/* Bootstrap 5.3-style tooltip (see the tooltip Stimulus controller). */
.tooltip {
  position: absolute; z-index: 1080; display: block;
  margin: 0; font-size: 0.75rem; line-height: 1.5;
  opacity: 0; transition: opacity 0.15s linear; pointer-events: none;
}
.tooltip.show { opacity: 0.9; }
.tooltip .tooltip-inner {
  max-width: 200px; padding: 4px 8px;
  color: #fff; text-align: center; background: #000; border-radius: 6px;
}
.tooltip .tooltip-arrow {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 6px solid #000;
}

.auth-card { max-width: 360px; margin: 64px auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.auth-card h1 { margin-top: 0; }
.auth-card input { margin-bottom: 12px; }
.auth-card__alt { margin-top: 16px; font-size: 0.9rem; color: var(--muted); }
