/*
 * RedmineFlux Testcase Management — shared component styles, values taken
 * directly from redmineflux_timesheet's own real stylesheets (not an
 * abstracted spec) so both plugins match exactly:
 *   - Sr. No. column        -> rf_teams_index.css .col-sno / .sno-cell
 *   - Status badges          -> timesheets_dashboard.css .ts-db-badge--*
 *   - Delete-confirmation    -> rf_teams_index.css .delete-modal*
 *   - Empty state            -> timesheets_index.css .empty-state / timesheets/index.html.erb
 *   - Search input           -> rf_teams_index.css .search-input
 * Loaded globally alongside rf_testcase_management_variables.css.
 */

/* Page header — matches redmineflux_helpdesk's own .rf_helpdesk_page_header
   (app/views/rf_products/index.html.erb etc.) exactly: white rounded bar,
   title/subtitle group on the left, actions on the right. */
.rf_testcase_management_page_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rf-space-4, 16px);
  padding: var(--rf-space-5, 20px) var(--rf-space-6, 24px);
  background: var(--rf-bg-surface, #fff);
  border: 1px solid var(--rf-border, #e5e7eb);
  border-radius: var(--rf-radius-md, 10px);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.rf_testcase_management_page_header_main {
  display: flex;
  align-items: center;
  gap: var(--rf-space-4, 16px);
  flex: 1;
  min-width: 0;
}
.rf_testcase_management_page_title {
  font-size: 20px;
  font-weight: 700;
  color: var(--rf-text-primary, #111827) !important;
  margin: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rf_testcase_management_page_subtitle {
  font-size: 13px;
  color: var(--rf-text-muted, #6b7280);
  margin: 3px 0 0 0;
}
.rf_testcase_management_page_actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 768px) {
  .rf_testcase_management_page_header {
    flex-direction: column;
    align-items: stretch;
  }
  .rf_testcase_management_page_actions {
    justify-content: flex-start;
  }
}

/* rtc-002: the Overview page keeps its .graph_filter class (testcase.js
   toggles a .expanded class on it, and .graph_filter.expanded has its own
   transition rule) alongside the new page-header classes — .graph_filter's
   own fixed `height: 39px` and tight padding would otherwise fight this
   component's sizing at equal specificity. Two classes here always beats
   .graph_filter's one, regardless of stylesheet load order. */
.graph_filter.rf_testcase_management_page_header {
  height: auto;
  padding: var(--rf-space-5, 20px) var(--rf-space-6, 24px);
}

/* Plain-page form actions (Environment New/Edit, and any future non-modal
   form) — the Create/Update submit button is left exactly as-is (its own
   `btn btn-primary` classes, untouched); this just gives the Cancel link a
   proper button look next to it. Not reusing
   .rf_testcase_management_modal_btn_confirm/_cancel (those are sized for
   the delete-modal's flex:1/44px row). */
.rf_testcase_management_form_actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--rf-space-4, 16px);
}
.rf_testcase_management_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--rf-radius-sm, 6px);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.rf_testcase_management_btn_secondary {
  background: var(--rf-bg-surface, #fff);
  border-color: var(--rf-border-input, #d1d5db);
  color: var(--rf-text-secondary, #374151) !important;
  text-decoration: none !important;
  height: 28px;
  padding: 0 7px;
  font-weight: 400;
}
.rf_testcase_management_btn_secondary:hover {
  background: var(--rf-bg-subtle, #f9fafb);
  text-decoration: none !important;
}

/* Admin > Plugins > Testcase Management > Run Types tab header row
   (moved out of app/views/settings/_testcase_run_types.html.erb's inline <style>) */
.rf_testcase_management_run_type_settings {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

/* Table shell — matches redmineflux_helpdesk's own .rf_helpdesk_table /
   .rf_helpdesk_table_section exactly (radius+border+shadow live on the
   wrapper, not the <table>; no-zebra rows; hover highlight; uppercase
   muted header). Wrap an existing `table.list` with
   `.rf_testcase_management_table_section` and add
   `.rf_testcase_management_table` to the `<table>` itself to opt in. */
.rf_testcase_management_table_section {
  background: var(--rf-bg-surface, #fff);
  border: 1px solid var(--rf-border, #e5e7eb);
  border-radius: var(--rf-radius-md, 10px);
  box-shadow: var(--rf-shadow-sm, 0 1px 2px rgba(0,0,0,.04));
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: var(--rf-space-4, 16px);
}
.rf_testcase_management_table {
  width: 100%;
  border-collapse: collapse;
  border: none;
  margin: 0;
  font-size: 14px;
  background: var(--rf-bg-surface, #fff);
}
.rf_testcase_management_table thead {
  background: var(--rf-bg-subtle, #f9fafb);
}
.rf_testcase_management_table thead th {
  padding: 12px var(--rf-space-4, 16px);
  background: var(--rf-bg-subtle, #f9fafb);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--rf-text-muted, #6b7280);
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--rf-border, #e5e7eb);
}
.rf_testcase_management_table tbody tr {
  border-bottom: 1px solid var(--rf-border, #e5e7eb);
  transition: background-color 0.15s;
}
.rf_testcase_management_table tbody tr:last-child {
  border-bottom: none;
}
.rf_testcase_management_table tbody tr:hover {
  background: var(--rf-bg-subtle, #f9fafb);
}
.rf_testcase_management_table tbody td {
  padding: 14px var(--rf-space-4, 16px);
  color: var(--rf-text-primary, #111827);
  vertical-align: middle;
  text-align: center;
}
.rf_testcase_management_table_actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
/* default_redmine.css's own `table.list, .table-list { border; border-radius:3px;
   overflow:hidden; margin-bottom:4px; }` rule sits directly on the <table>, not a
   wrapper, and default_redmine.css loads after this file (its stylesheet_link_tag
   calls sit inline in the view body, later in the DOM than the head-loaded
   components.css) — but `table.list` (element+class) already outranks a bare
   `.rf_testcase_management_table` (single class) on specificity alone, so it wins
   regardless of load order. Left in place, its border-radius fights this file's
   own border-collapse: collapse below (radius and collapsed borders don't render
   together correctly on <table>), which is what was producing the permanent
   sliver of horizontal overflow — and hence an always-visible scrollbar — on
   .rf_testcase_management_table_section even when nothing visibly overflowed.
   The border itself belongs on the wrapper only, matching redmineflux_helpdesk's
   own table shell, so cancel all four properties here with a selector specific
   enough (element + 2 classes) to always beat the single-class-on-element rule. */
table.list.rf_testcase_management_table,
table.list.rf_testcase_management_table.table_td_ellips {
  border: none;
  border-radius: 0;
  overflow: visible;
  margin-bottom: 0;
}

/* Sr. No. column — redmineflux_timesheet's rf_teams_index.css .col-sno/.sno-cell */
.rf_testcase_management_table_sno_header {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  text-align: center !important;
  font-weight: 600;
}
.rf_testcase_management_table_sno_cell {
  text-align: center;
  color: var(--rf-text-muted, #6b7280);
  font-size: 13px;
  font-weight: 500;
}

/* Empty state — redmineflux_timesheet's timesheets_index.css .empty-state */
.rf_testcase_management_empty_state {
  text-align: center;
  padding: 60px 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin: 20px 0;
}
.rf_testcase_management_empty_state_icon {
  margin-bottom: 20px;
  color: #bdc3c7;
}
.rf_testcase_management_empty_state_icon svg {
  width: 80px;
  height: 80px;
}
.rf_testcase_management_empty_state_title {
  margin-bottom: 10px;
  color: #34495e;
}
.rf_testcase_management_empty_state_description {
  color: #7f8c8d;
  margin-bottom: 20px;
  font-size: 14px;
}

/* Delete-confirmation modal shell — matches redmineflux_shift_management's own
   .sm-del-* pattern exactly (backdrop/window/close/icon-circle/title/text/actions),
   the most polished and most consistently-used of the RedmineFlux plugins' delete
   dialogs, per an explicit side-by-side comparison request. */
.rf_testcase_management_modal {
  background: #fff;
  width: 90%;
  max-width: 480px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  margin: 0 auto;
}
.rf_testcase_management_modal_close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 28px;
  width: 32px;
  height: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.rf_testcase_management_modal_close:hover {
  color: #374151;
  background: #f3f4f6;
}
.rf_testcase_management_modal_body {
  padding: 32px;
  text-align: center;
}
.rf_testcase_management_modal_icon_circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: #fef2f2;
  color: #dc2626;
  border-radius: 50%;
  margin-bottom: 16px;
}
.rf_testcase_management_modal_icon_circle svg {
  width: 32px;
  height: 32px;
}
.rf_testcase_management_modal_title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
}
.rf_testcase_management_modal_description {
  margin: 0 auto 24px;
  max-width: 380px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
  padding: 0px !important;
  margin-bottom: 15px !important;
}
.rf_testcase_management_modal_description strong {
  color: #111827;
}
.rf_testcase_management_modal_actions {
  display: flex;
  gap: 12px;
  flex-direction: row-reverse;
}
/* Most of these modals wrap their Cancel/Confirm buttons in a Rails
   form_for/form_with block, so the <form> tag — not the buttons — is the
   actual direct child of .rf_testcase_management_modal_actions above.
   flex:1 on the buttons did nothing because they weren't flex items at
   all (only direct children of a flex container are); the row rendered
   as the form's own normal block content instead of two evenly-sized
   buttons. Making the form itself a flex container with the same layout
   passes the flex context down to the buttons inside it. */
.rf_testcase_management_modal_actions form {
  display: flex;
  flex-direction: row-reverse;
  gap: 12px;
  width: 100%;
}
/* Targeted by class, not by element type: the confirm control is a Rails
   f.submit/submit_tag (<input type="submit">), not a <button> — a bare
   `button` element selector here would silently skip it and let it fall
   back to unstyled browser-default rendering (a tiny blank-looking box)
   while the <button type="button"> Cancel control renders fine, exactly
   the "empty confirm button" bug this replaces. */
.rf_testcase_management_modal_btn_cancel,
.rf_testcase_management_modal_btn_confirm {
  flex: 1;
  height: 44px !important;
  min-height: 44px;
  margin: 0 !important;
  padding: 0 16px !important;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 15px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  transition: background 0.2s, color 0.2s;
  font-family: inherit !important;
  box-sizing: border-box;
}
.rf_testcase_management_modal_btn_cancel {
  background: #fff;
  border: 1px solid #d1d5db !important;
  color: #374151;
}
.rf_testcase_management_modal_btn_cancel:hover {
  background: #f9fafb;
}
.rf_testcase_management_modal_btn_confirm {
  background: #dc2626 !important;
  color: #fff;
}
.rf_testcase_management_modal_btn_confirm:hover {
  background: #b91c1c !important;
}
@media (max-width: 768px) {
  .rf_testcase_management_modal {
    width: 95%;
  }
}
/* Some modals (e.g. requirements/index.html.erb's #delete-modal) also carry a
   pre-existing generic .delete-modal/.add-page-modal class for its own
   position:fixed/visibility toggle, which independently declares its own
   padding/border-radius/background. Since that CSS loads after this file, its
   same-specificity single-class rule would otherwise win in the cascade and
   double up the padding this shell already applies via `_modal_body`. Pin
   the two-class combination explicitly so this shell's own values win. */
.delete-modal.rf_testcase_management_modal,
.add-page-modal.rf_testcase_management_modal {
  padding: 0;
  border-radius: 12px;
}

/* Stat cards — design reference: redmineflux_helpdesk's own
   .rf_helpdesk_stats_grid / .rf_helpdesk_stat_card (app/views/rf_project_helpdesk/index.html.erb):
   white rounded card, tone-colored icon badge top-right, big number, muted
   label below. Reimplemented under this plugin's own class prefix/tokens
   (not the helpdesk classes themselves) so the two plugins stay decoupled.
   Currently used by traceability_rtms/index — Total Requirement / Total
   Linked Testcases / Total Defects (rtc UI improvement task). */
.rf_testcase_management_stats_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--rf-space-4, 16px);
  margin-bottom: var(--rf-space-4, 16px);
}
.rf_testcase_management_stats_grid_3 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 768px) {
  .rf_testcase_management_stats_grid_3 {
    grid-template-columns: 1fr;
  }
}
.rf_testcase_management_stat_card {
  position: relative;
  background: var(--rf-bg-surface, #fff);
  border: 1px solid var(--rf-border, #e5e7eb);
  border-radius: var(--rf-radius-md, 10px);
  box-shadow: var(--rf-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
  padding: var(--rf-space-4, 16px);
}
.rf_testcase_management_stat_icon {
  position: absolute;
  top: var(--rf-space-4, 16px);
  right: var(--rf-space-4, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--rf-radius-sm, 6px);
}
.rf_testcase_management_stat_icon_requirement { background: var(--rf-info-bg, #dbeafe); color: var(--rf-info-text, #1d4ed8); }
.rf_testcase_management_stat_icon_testcase    { background: var(--rf-success-bg, #dcfce7); color: var(--rf-success, #22c55e); }
.rf_testcase_management_stat_icon_defect      { background: var(--rf-danger-bg, #fee2e2); color: var(--rf-danger, #dc2626); }
.rf_testcase_management_stat_number {
  font-size: 24px;
  font-weight: 700;
  color: var(--rf-text-primary, #111827);
  line-height: 1.1;
  margin-bottom: 4px;
}
.rf_testcase_management_stat_label {
  font-size: 12px;
  font-weight: 500;
  color: var(--rf-text-muted, #6b7280);
}

/* Status badges — redmineflux_timesheet's timesheets_dashboard.css .ts-db-badge--* */
.rf_testcase_management_status_tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 12px;
  white-space: nowrap;
}
.rf_testcase_management_status_tag--neutral { background: var(--rf-neutral-bg, #f3f4f6); color: var(--rf-neutral-text, #374151); }
.rf_testcase_management_status_tag--info    { background: var(--rf-info-bg, #dbeafe); color: var(--rf-info-text, #1d4ed8); }
.rf_testcase_management_status_tag--success { background: var(--rf-success-bg, #dcfce7); color: var(--rf-success-text, #15803d); }
.rf_testcase_management_status_tag--danger  { background: var(--rf-danger-bg, #fee2e2); color: var(--rf-danger-text, #b91c1c); }
.rf_testcase_management_status_tag--warning { background: var(--rf-warning-bg, #fef3c7); color: var(--rf-warning-text, #92400e); }


/* rftc-029 — centered delete-confirmation modal positioning, matching
   Environment's own #delete-environment-modal rule (runactions.css) exactly:
   visual styling comes from the shared .rf_testcase_management_modal shell
   above, this is positioning only. */
#delete-session-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1060;
}
/* Environment's dark backdrop (runactions.css .milestone-overlay) isn't
   loaded on every page this modal shell is reused from -- defining it here
   too (identical rule, same class name so either stylesheet can supply it)
   means a page doesn't have to pull in runactions.css just for this one
   shared class. */
.milestone-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  transition: all 0.1s ease-in;
  display: none;
}

.controller-settings.action-plugin p.rf_testcase_management_modal_description {
    margin: 0 auto 24px;
    max-width: 380px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
    padding: 0;
}
