/* Find a Tender Forms - UI Test Styles */
/* Matching the existing Blazor TPPFormsUI styling */

html, body {
  font-family: 'Poppins', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
}

#root {
  min-height: 100vh;
}

/* Links and buttons */
a, .btn-link {
  color: #006bb7;
}

.bulk-actions .btn-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
}
.bulk-actions .btn-link:hover {
  color: #004a80;
}

.btn-primary {
  color: #fff;
  background-color: #1b6ec2;
  border-color: #1861ac;
}

.btn:focus, .btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Content area */
.content {
  padding-top: 1.1rem;
}

h1:focus {
  outline: none;
}

/* Form validation */
.valid.modified:not([type=checkbox]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid #e50000 !important;
  border-color: #e50000 !important;
}

.validation-message {
  color: #e50000;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Sidebar */
.sidebar {
  background-color: #f8f9fa;
  min-height: 100vh;
}

.nav-logo {
  max-height: 40px;
  height: 40px;
  width: auto;
  display: block;
}

/* SD (SourceDogg) custom navigation style */
nav.sd-style {
  background-color: white;
  border-radius: 0.5rem;
  border-color: black;
  border-style: solid;
  border-width: 1px;
  padding: 10px;
}

.sticky-nav {
  position: sticky;
  top: 10px;
  z-index: 10;
}

.scrollable-nav {
  max-height: 85vh;
  overflow-y: auto;
}

.nav-item-indented {
  padding-left: 1.5rem;
}

/* SD style buttons */
button.sd-style,
a.sd-style {
  color: #000;
  background: transparent;
  border-radius: 0.5rem;
  border-color: black;
  border-style: solid;
  border-width: 1px;
  transition: background 0.3s, color 0.2s;
  margin-right: 0.5rem;
  font-size: 14px;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.sd-style.active,
button.sd-style:focus,
button.sd-style:hover,
a.sd-style.active,
a.sd-style:focus,
a.sd-style:hover {
  color: #fff !important;
  background: #000 !important;
  border-radius: 0.5rem;
  box-shadow: 0 2px 6px rgba(37, 140, 251, 0.10);
  border-color: #000;
}

button.sd-style:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Title styling */
.title {
  color: #000;
  font-weight: bold;
  font-size: 1.4rem;
  letter-spacing: 1px;
  margin-right: 2rem;
}

/* Form elements */
.form-check-input:checked {
  background-color: #000;
  border-color: #000;
}

.darker-border-checkbox.form-check-input {
  border-color: #929292;
}

/* Status messages */
.status-message {
  white-space: pre-line;
}

.status-message.success {
  color: #26b050;
}

.status-message.error {
  color: #e50000;
}

/* Navigation header */
.nav-header {
  background-color: white;
  border-bottom: 1px solid #dee2e6;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-header .title {
  margin: 0;
}

.nav-header .form-id-badge {
  background-color: #000;
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Form selector page */
.form-selector {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-align: center;
}

.form-selector h1 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.form-selector .subtitle {
  color: #666;
  margin-bottom: 2rem;
}

.form-cards {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.form-card {
  background: white;
  border: 2px solid #000;
  border-radius: 0.75rem;
  padding: 2rem;
  width: 320px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
}

.form-card:hover {
  background: #000;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-card h3 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-card p {
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.8;
}

/* Sidebar nav items */
.sidebar-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  color: #333;
  transition: all 0.2s;
  font-family: 'Poppins', Arial, sans-serif;
}

.sidebar-nav-item:hover {
  background-color: #f0f0f0;
  border-color: #ddd;
}

.sidebar-nav-item.active {
  background-color: #000;
  color: #fff;
  border-color: #000;
  font-weight: 500;
}

.sidebar-nav-item.nested {
  padding-left: 1.75rem;
  font-size: 0.8rem;
}

/* Question form groups */
.question-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.question-group:last-child {
  border-bottom: none;
}

.question-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: #333;
}

.question-hint {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

/* Page header */
.page-header {
  border-bottom: 2px solid #000;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0;
}

/* Page navigation buttons */
.page-nav-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 1.5rem 0;
  border-top: 1px solid #dee2e6;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.page-nav-buttons .spacer {
  flex: 1;
}

/* OCID question */
.ocid-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.ocid-input-group input {
  flex: 1;
}

.ocid-status {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.ocid-status.success {
  color: #26b050;
}

.ocid-status.error {
  color: #e50000;
}

/* Lookup list */
.lookup-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.lookup-list li {
  padding: 0.15rem 0;
  font-size: 0.9rem;
}

/* CPV / Region picker */
.picker-container {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  overflow: hidden;
}

.picker-search {
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.picker-search input {
  width: 100%;
  padding: 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  font-size: 0.9rem;
}

.picker-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem;
}

.picker-item {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.picker-item:hover {
  background-color: #f8f9fa;
}

.picker-item input[type="checkbox"] {
  margin-right: 0.5rem;
}

.picker-item .name {
  font-weight: 500;
  margin-right: 0.5rem;
  color: #000;
  flex: 1;
}

.picker-item .code {
  color: #888;
  font-size: 0.8rem;
  white-space: nowrap;
  margin-left: auto;
}

/* Region tree picker */
.region-picker {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  overflow: hidden;
}
.region-search {
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
}
.region-search input {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}
.region-tree {
  max-height: 350px;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.region-empty {
  padding: 0.75rem 1rem;
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
}

/* Region tree row */
.region-tree-row {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.75rem 0.35rem 0;
  cursor: pointer;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.1s;
}
.region-tree-row:hover {
  background-color: #f5f7fa;
}
.region-tree-row.region-selected {
  background-color: #e3f2fd;
}
.region-tree-row.region-match {
  background-color: #fff9e6;
}
.region-tree-row.region-selected.region-match {
  background-color: #d6ecfa;
}

/* Indent spacer - width set inline */
.region-indent {
  flex-shrink: 0;
}

/* Expand/collapse chevron */
.region-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.6rem;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  user-select: none;
}
.region-chevron:hover {
  background-color: #e0e0e0;
  color: #333;
}
.region-chevron-space {
  display: inline-block;
  width: 24px;
  flex-shrink: 0;
}

/* Checkbox */
.region-checkbox {
  margin-right: 0.5rem;
  flex-shrink: 0;
  cursor: pointer;
}

/* Region name (primary) */
.region-name {
  flex: 1;
  font-weight: 400;
  color: #212529;
}
.region-match .region-name {
  font-weight: 600;
  color: #000;
}

/* Region code (secondary, right-aligned) */
.region-code {
  color: #999;
  font-size: 0.78rem;
  margin-left: 0.75rem;
  white-space: nowrap;
  font-family: monospace;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  background: #e9ecef;
  border-radius: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

.selected-tag button {
  background: none;
  border: none;
  padding: 0 0 0 0.4rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #666;
}

.selected-tag button:hover {
  color: #e50000;
}

/* XML Preview */
.xml-preview {
  margin-top: 1rem;
}

.xml-preview pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.8rem;
  max-height: 500px;
  overflow-y: auto;
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  font-size: 1.2rem;
  color: #666;
}

.loading .spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid #dee2e6;
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .form-cards {
    flex-direction: column;
    align-items: center;
  }

  .sidebar {
    min-height: auto;
  }

  .sticky-nav {
    position: relative;
    top: 0;
  }

  .page-nav-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .page-nav-buttons .spacer {
    display: none;
  }
}

/* Main layout overrides */
.main-content {
  padding: 1.5rem;
  background: white;
  border-radius: 0.5rem;
  min-height: 80vh;
}

.sidebar-column {
  padding: 0.75rem;
}

/* Label question (read-only display) */
.label-question {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 0.375rem;
  border-left: 3px solid #000;
}

/* Form check spacing */
.form-check {
  margin-bottom: 0.375rem;
}

.form-check-label {
  font-size: 0.9rem;
}

/* Option hint */
.option-hint {
  display: block;
  color: #666;
  font-size: 0.8rem;
  margin-left: 1.5rem;
  margin-top: -0.125rem;
  margin-bottom: 0.25rem;
}

/* ============================================================
   SETUP PANEL
   ============================================================ */
.setup-section {
  max-width: 600px;
  margin: 1.5rem auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: left;
}

.setup-field {
  margin-bottom: 1.25rem;
}

.setup-field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: #333;
}

.optional-badge {
  font-weight: 400;
  font-size: 0.7rem;
  color: #999;
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 0.5rem;
}

.setup-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Poppins', Arial, sans-serif;
}

.setup-input:focus {
  outline: none;
  border-color: #006bb7;
  box-shadow: 0 0 0 2px rgba(0,107,183,0.15);
}

.setup-hint {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.25rem;
}

.env-toggle {
  display: flex;
  gap: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  width: fit-content;
}

.env-btn {
  padding: 0.4rem 1rem;
  border: none;
  background: #f8f8f8;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: 'Poppins', Arial, sans-serif;
  transition: all 0.15s;
}

.env-btn:not(:last-child) {
  border-right: 1px solid #ccc;
}

.env-btn.active {
  background: #006bb7;
  color: #fff;
  font-weight: 600;
}

.jwt-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #666;
}

.jwt-valid {
  background: #d4edda;
  color: #155724;
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: 600;
}

/* ============================================================
   OCID DETAILS
   ============================================================ */
.ocid-details {
  background: #f0f7ff;
  border: 1px solid #b8d4f0;
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.ocid-detail-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.ocid-detail-row strong {
  color: #444;
  min-width: 120px;
}

/* ============================================================
   SAVE / PUBLISH BUTTONS
   ============================================================ */
.save-btn {
  background: #28a745 !important;
  color: #fff !important;
  border-color: #28a745 !important;
}

.save-btn:hover {
  background: #218838 !important;
}

.publish-btn {
  background: #dc3545 !important;
  color: #fff !important;
  border-color: #dc3545 !important;
  font-weight: 600 !important;
}

.publish-btn:hover {
  background: #c82333 !important;
}

.env-badge {
  background: #ffc107;
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ============================================================
   PUBLISH RESULT PANEL
   ============================================================ */
.publish-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid;
}

.publish-result.success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.publish-result.error {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.publish-result h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.validation-errors-list h5 {
  font-size: 0.85rem;
  margin: 0.5rem 0 0.25rem;
  font-weight: 600;
}

.validation-errors-list ul {
  margin: 0;
  padding-left: 1.25rem;
}

.validation-errors-list li {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.action-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 6px;
  margin-top: 1rem;
  color: #856404;
  font-size: 0.9rem;
}

.status-message.info {
  color: #856404;
}

/* ============================================================
   SIRSI SEARCH DROPDOWN
   ============================================================ */
.sirsi-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1050;
}

.sirsi-dropdown-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.sirsi-dropdown-item:hover {
  background: #e9f5ff;
}

.sirsi-dropdown-item:last-child {
  border-bottom: none;
}
