/**
 * @file
 * Styles for CPV module.
 */

.cpv-main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.cpv-header {
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #0073aa;
}

.cpv-header h1 {
  color: #0073aa;
  font-size: 2em;
  margin: 0;
}

/* Tabs Navigation */
.cpv-tabs {
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 20px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
}

.cpv-tabs .nav-item {
  margin-bottom: -2px;
}

.cpv-tabs .nav-link {
  display: block;
  padding: 0.5rem 1rem;
  color: #495057;
  text-decoration: none;
  background-color: transparent;
  border: 1px solid transparent;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
  cursor: pointer;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.cpv-tabs .nav-link:hover {
  border-color: #e9ecef #e9ecef #dee2e6;
  color: #0073aa;
}

.cpv-tabs .nav-link.active {
  color: #0073aa;
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
  font-weight: 600;
}

.cpv-tabs .nav-link:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(0, 115, 170, 0.25);
}

.cpv-tab-content {
  margin-top: 20px;
}

.cpv-tab-content .tab-pane {
  display: none;
}

.cpv-tab-content .tab-pane.active,
.cpv-tab-content .tab-pane.show {
  display: block;
}

.cpv-tab-content .tab-pane.fade {
  transition: opacity 0.15s linear;
}

.cpv-tab-content .tab-pane.fade:not(.show) {
  opacity: 0;
}

.cpv-tab-content .tab-pane.fade.show {
  opacity: 1;
}

.cpv-intro-text {
  margin-bottom: 25px;
  padding: 15px;
  background-color: #f8f9fa;
  border-left: 4px solid #0073aa;
  border-radius: 4px;
}

.cpv-intro-text p {
  margin: 0 0 10px 0;
  color: #495057;
  line-height: 1.6;
}

.cpv-intro-text p:last-child {
  margin-bottom: 0;
}

/* Links στην περιγραφή - να έχουν underline */
.cpv-intro-text a {
  text-decoration: underline !important;
}

.cpv-hints {
  margin-bottom: 20px;
  padding: 10px 15px;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
}

.cpv-hint-text {
  margin: 5px 0;
  color: #856404;
  font-size: 0.9em;
  line-height: 1.5;
}

.cpv-search-wrapper .cpv-hint-text {
  margin-top: 5px;
  display: block;
  color: #6c757d;
  font-size: 0.85em;
}

.cpv-controls {
  margin-bottom: 30px;
}

.cpv-controls-row {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.cpv-dropdown-wrapper {
  flex: 0 0 auto;
}

/* Hide CPV Class F filter button */
#dropdownMenuButtonCpvClassF {
  display: none !important;
}

/* Hide the wrapper div containing CPV Class F button */
.cpv-dropdown-wrapper:has(#dropdownMenuButtonCpvClassF) {
  display: none !important;
}

/* Fallback for browsers that don't support :has() - hide parent wrapper */
.cpv-controls-row > .cpv-dropdown-wrapper:nth-of-type(2) {
  display: none !important;
}

.cpv-language-wrapper {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

#cpv-add-all-button {
  white-space: nowrap;
  padding: 8px 16px;
  min-width: auto;
  flex-shrink: 0;
}

.cpv-search-wrapper {
  flex: 1 1 300px;
  min-width: 250px;
}

.cpv-search-wrapper input,
.form-control {
  width: 100%;
  padding: 10px 15px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  display: block;
  line-height: 1.5;
  color: #212529;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cpv-search-wrapper input:focus,
.form-control:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  max-height: 300px;
  overflow-y: auto;
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  min-width: 200px;
  padding: 0.5rem 0;
  margin: 0.125rem 0 0;
  font-size: 1rem;
  color: #212529;
  text-align: left;
  list-style: none;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.25rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown.show .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.25rem 1rem;
  clear: both;
  font-weight: 400;
  color: #212529;
  text-align: inherit;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: #1e2125;
  background-color: #e9ecef;
}

.btn-primary {
  color: #fff;
  background-color: #0d6efd;
  border-color: #0d6efd;
}

.btn-primary:hover {
  color: #fff;
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
  text-transform: none !important; /* Prevent automatic uppercase */
}

.btn, .dropdown-item {
  text-transform: none !important; /* Prevent automatic uppercase on buttons and dropdown items */
}

.rounded-card {
  border-radius: 0.375rem;
}

.dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.255em;
  vertical-align: 0.255em;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}

.cpv-categories {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.cpv-category {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 20px;
  transition: box-shadow 0.3s ease;
}

.cpv-category:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cpv-category-title {
  color: #333;
  font-size: 1.5em;
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
}

.cpv-category-content {
  margin-top: 15px;
}

/* GLOBAL RULE: ΑΠΑΓΟΡΕΥΕΤΑΙ ΠΛΗΡΩΣ Η ΔΗΜΙΟΥΡΓΙΑ COLUMNS ΣΕ ΟΛΑ ΤΑ CPV ELEMENTS */
.cpv-list,
.cpv-list *,
.cpv-children,
.cpv-children *,
.cpv-item,
.cpv-item *,
ul.cpv-list,
ul.cpv-children,
li.cpv-item {
  column-count: 1 !important;
  column-width: auto !important;
  column-gap: 0 !important;
  columns: 1 !important;
  -webkit-column-count: 1 !important;
  -moz-column-count: 1 !important;
  -ms-column-count: 1 !important;
  -o-column-count: 1 !important;
}

.cpv-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important; /* Ensure list displays as block (vertical, not horizontal) */
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  column-count: 1 !important; /* NO COLUMNS - force single column */
  column-width: auto !important; /* NO COLUMN WIDTH */
  column-gap: 0 !important; /* NO COLUMN GAP */
  columns: 1 !important; /* NO COLUMNS shorthand */
  -webkit-column-count: 1 !important;
  -moz-column-count: 1 !important;
  -ms-column-count: 1 !important;
  -o-column-count: 1 !important;
  float: none !important;
  clear: both !important;
  overflow-x: hidden !important; /* Prevent horizontal scrolling */
}

.cpv-item {
  display: flex !important; /* Flex for internal content (code, description, expand) */
  flex-direction: row !important; /* Internal content in row */
  flex-wrap: nowrap !important; /* No wrapping */
  align-items: center;
  justify-content: flex-start !important; /* Align items to start */
  padding-top: 10px;
  padding-bottom: 10px;
  padding-right: 15px;
  padding-left: 15px; /* Base padding for all items */
  margin-bottom: 5px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  width: 100% !important; /* Ensure full width - no columns */
  max-width: 100% !important; /* Prevent overflow */
  box-sizing: border-box !important; /* Include padding in width */
  float: none !important; /* No floating */
  clear: both !important; /* Clear any floats */
  position: relative !important; /* Ensure proper positioning */
  min-width: 0 !important; /* Allow flex items to shrink */
  overflow-x: visible !important; /* Allow expand icon to be visible */
  overflow-y: visible !important; /* Allow vertical overflow */
}

/* Ensure ALL items in children lists are block-level and constrained width - NO HORIZONTAL EXPANSION */
.cpv-children > .cpv-item,
.cpv-children .cpv-children > .cpv-item,
.cpv-children .cpv-children .cpv-children > .cpv-item {
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important; /* Allow flex items to shrink */
  float: none !important;
  clear: both !important;
  position: relative !important;
  box-sizing: border-box !important;
  overflow: visible !important; /* Allow vertical overflow */
  word-wrap: break-word !important; /* Break long words */
  overflow-wrap: break-word !important; /* Break long words */
}

.cpv-item:hover {
  background-color: #f0f0f0;
}

.cpv-code {
  font-weight: bold;
  color: #0073aa;
  min-width: 150px;
  margin-right: 15px;
}

.cpv-description {
  flex: 1 1 0% !important; /* Allow flex item to shrink and grow */
  color: #333;
  min-width: 0 !important; /* Allow flex item to shrink */
  max-width: none !important; /* No max-width restriction */
  word-wrap: break-word !important; /* Break long words */
  overflow-wrap: break-word !important; /* Break long words */
  overflow: visible !important; /* Allow text to wrap */
  text-overflow: clip !important; /* Don't use ellipsis */
  margin-right: 120px !important; /* Reserve space for expand icon (104px + 16px buffer) */
  padding-right: 0 !important; /* No padding */
}

.cpv-expand {
  position: absolute !important; /* Absolute positioning for alignment */
  right: 104px !important; /* Fixed position from right edge - aligned for all levels */
  left: auto !important; /* Remove left positioning */
  top: 50% !important; /* Center vertically */
  transform: translateY(-50%) !important; /* Center vertically */
  margin-left: 0 !important; /* No left margin */
  margin-right: 0 !important; /* No right margin */
  font-size: 1.2em;
  color: #0073aa;
  font-weight: bold;
  display: inline-block !important; /* Ensure it's always visible if has-children */
  visibility: visible !important; /* Force visibility */
  opacity: 1 !important; /* Force opacity */
  width: 1.2em !important; /* Fixed width for + or - */
  height: 1.2em !important; /* Fixed height */
  min-width: 1.2em !important; /* Ensure minimum width for + or - */
  min-height: 1.2em !important; /* Ensure minimum height */
  text-align: center !important; /* Center the + or - */
  line-height: 1.2em !important; /* Match height for vertical centering */
  padding: 0 !important; /* No padding */
  white-space: nowrap !important; /* Don't wrap */
  z-index: 1 !important; /* Ensure it's above other content */
}

.cpv-item.has-children .cpv-expand {
  position: absolute !important; /* Absolute positioning for alignment */
  right: 104px !important; /* Fixed position from right edge - aligned for all levels */
  left: auto !important; /* Remove left positioning */
  top: 50% !important; /* Center vertically */
  transform: translateY(-50%) !important; /* Center vertically */
  margin-left: 0 !important; /* No left margin */
  margin-right: 0 !important; /* No right margin */
  display: inline-block !important; /* Force display for all items with children */
  visibility: visible !important; /* Force visibility */
  opacity: 1 !important; /* Force opacity */
  width: 1.2em !important; /* Fixed width for + or - */
  height: 1.2em !important; /* Fixed height */
  min-width: 1.2em !important; /* Ensure minimum width for + or - */
  min-height: 1.2em !important; /* Ensure minimum height */
  text-align: center !important; /* Center the + or - */
  line-height: 1.2em !important; /* Match height for vertical centering */
  padding: 0 !important; /* No padding */
  white-space: nowrap !important; /* Don't wrap */
  z-index: 1 !important; /* Ensure it's above other content */
}

.cpv-item:not(.has-children) .cpv-expand {
  display: none !important;
}

/* Adjust expand icon position based on level - deeper levels need more right offset to compensate for margin-left */
/* Base: 104px, then add the margin-left value for each level to keep alignment */
.cpv-item.cpv-item-level-0 .cpv-expand,
.cpv-item.cpv-item-level-0.has-children .cpv-expand {
  right: 104px !important; /* Base position for level 0 (margin-left: 0) */
}

.cpv-item.cpv-item-level-1 .cpv-expand,
.cpv-item.cpv-item-level-1.has-children .cpv-expand {
  right: 134px !important; /* 104px + 30px margin-left for level 1 */
}

.cpv-item.cpv-item-level-2 .cpv-expand,
.cpv-item.cpv-item-level-2.has-children .cpv-expand {
  right: 164px !important; /* 104px + 60px margin-left for level 2 */
}

.cpv-item.cpv-item-level-3 .cpv-expand,
.cpv-item.cpv-item-level-3.has-children .cpv-expand {
  right: 194px !important; /* 104px + 90px margin-left for level 3 */
}

.cpv-item.cpv-item-level-4 .cpv-expand,
.cpv-item.cpv-item-level-4.has-children .cpv-expand {
  right: 224px !important; /* 104px + 120px margin-left for level 4 */
}

.cpv-item.cpv-item-level-5 .cpv-expand,
.cpv-item.cpv-item-level-5.has-children .cpv-expand {
  right: 254px !important; /* 104px + 150px margin-left for level 5 */
}

/* Indentation based on level - όλα τα items στο ίδιο list, με tab indentation */
.cpv-item-level-0 {
  margin-left: 0 !important;
  padding-left: 15px !important;
}

.cpv-item-level-1 {
  margin-left: 30px !important;
  padding-left: 15px !important;
}

.cpv-item-level-2 {
  margin-left: 60px !important;
  padding-left: 15px !important;
}

.cpv-item-level-3 {
  margin-left: 90px !important;
  padding-left: 15px !important;
}

.cpv-item-level-4 {
  margin-left: 120px !important;
  padding-left: 15px !important;
}

.cpv-item-level-5 {
  margin-left: 150px !important;
  padding-left: 15px !important;
}

/* Legacy support - αν υπάρχουν ακόμα cpv-children lists, να μην εμφανίζονται */
.cpv-children {
  display: none !important;
}

.cpv-item.expanded .cpv-children {
  display: block !important; /* Display as block - vertical layout */
  column-count: 1 !important; /* NO COLUMNS - force single column */
  column-width: auto !important; /* NO COLUMN WIDTH */
  column-gap: 0 !important; /* NO COLUMN GAP */
  columns: 1 !important; /* NO COLUMNS shorthand */
}

/* Progressive indentation - κάθε nested children list έχει +30px margin-left */
/* Αυτό δημιουργεί cumulative indentation: 30px, 60px, 90px, 120px... */
/* Κάθε επίπεδο επεκτείνεται προς τα κάτω (vertical), όχι προς τα δεξιά (horizontal) */
/* ΑΠΑΓΟΡΕΥΕΤΑΙ ΠΛΗΡΩΣ Η ΔΗΜΙΟΥΡΓΙΑ COLUMNS - όλα τα nested lists είναι block display */
.cpv-children .cpv-children,
.cpv-children .cpv-children .cpv-children,
.cpv-children .cpv-children .cpv-children .cpv-children {
  margin-left: 30px !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  width: auto !important; /* Auto width - constrained by parent */
  max-width: 100% !important; /* Never exceed parent width - NO HORIZONTAL EXPANSION */
  box-sizing: border-box !important;
  list-style: none !important;
  display: block !important; /* Force block display - NO COLUMNS */
  column-count: 1 !important; /* NO COLUMNS - force single column */
  column-width: auto !important; /* NO COLUMN WIDTH */
  column-gap: 0 !important; /* NO COLUMN GAP */
  columns: 1 !important; /* NO COLUMNS shorthand */
  float: none !important; /* NO FLOATING */
  clear: both !important; /* Clear any floats */
  overflow: visible !important; /* Allow vertical overflow only */
  position: relative !important;
}

/* Expand icon content is handled by JavaScript (text content: + or -) */
/* CSS only ensures visibility */

.cpv-item[style*="display: none"] {
  display: none !important;
}

/* Detail Dialog Modal Styles - matching reference site */
.cpv-detail-dialog.ui-dialog {
  z-index: 1001;
}

.cpv-detail-dialog .ui-dialog-content {
  padding: 20px;
}

.cpv-detail-dialog .content.card {
  margin: 0;
  border: none;
  box-shadow: none;
}

.cpv-detail-dialog .card-body {
  padding: 1rem;
}

.cpv-detail-dialog .card-title {
  margin-bottom: 0.75rem;
  color: #0073aa;
  font-size: 1.25rem;
  font-weight: 500;
}

.cpv-detail-dialog .card-text {
  margin-bottom: 0.5rem;
  color: #212529;
  line-height: 1.5;
}

.cpv-detail-dialog .card-text strong {
  color: #495057;
}

.cpv-detail-dialog .text-muted {
  color: #6c757d !important;
  font-size: 0.875rem;
}

.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.mt-1 {
  margin-top: 0.25rem !important;
}

/* Selected CPV Codes Table */
.cpv-selected-container {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #0073aa;
}

.cpv-selected-title {
  color: #0073aa;
  font-size: 1.5em;
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
}

.cpv-selected-table-wrapper {
  overflow-x: auto;
  margin-bottom: 15px;
}

.cpv-selected-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  overflow: hidden;
}

.cpv-selected-table thead {
  background-color: #0073aa;
  color: #fff;
}

.cpv-selected-table th {
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #005a8a;
}

.cpv-selected-table td {
  padding: 10px 15px;
  border-bottom: 1px solid #e0e0e0;
}

.cpv-selected-table tbody tr:hover {
  background-color: #f5f5f5;
}

.cpv-selected-table tbody tr:last-child td {
  border-bottom: none;
}

.cpv-table-code {
  font-weight: bold;
  color: #0073aa;
  min-width: 150px;
}

.cpv-table-description {
  color: #333;
}

.cpv-table-category {
  color: #6c757d;
  font-size: 0.9em;
  font-style: italic;
}

.cpv-table-actions {
  text-align: center;
  width: 80px;
}

.cpv-remove-item {
  background-color: #dc3545;
  color: #fff;
  border: none;
  border-radius: 3px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background-color 0.2s ease;
  font-weight: normal;
  line-height: 1 !important;
  text-align: center !important;
}

.cpv-remove-item i {
  display: block !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 14px !important;
  width: auto !important;
  height: auto !important;
  vertical-align: middle !important;
}

.cpv-remove-item:hover {
  background-color: #c82333;
}

.cpv-empty-row {
  background-color: #f9f9f9;
}

.cpv-empty-message {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 30px !important;
}

.cpv-row-new {
  background-color: #d4edda !important;
  animation: fadeIn 0.5s ease;
}

.cpv-row-highlight {
  background-color: #fff3cd !important;
  animation: pulse 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    background-color: #fff3cd;
  }
  50% {
    background-color: #ffe69c;
  }
}

.cpv-selected-actions {
  text-align: right;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cpv-selected-actions .btn {
  min-width: 120px;
}

/* DataTables Buttons Styling */
.dt-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dt-buttons .btn {
  margin: 0;
  padding: 6px 12px;
  font-size: 0.875rem;
}

.dt-button {
  padding: 6px 12px !important;
  margin: 0 5px 5px 0 !important;
  border-radius: 4px !important;
  font-size: 0.875rem !important;
}

.dt-button:hover {
  opacity: 0.9;
}

/* DataTables Custom Styling */
#cpv-selected-table_wrapper {
  margin-top: 15px;
}

#cpv-selected-table_wrapper .dataTables_filter {
  margin-bottom: 15px;
}

#cpv-selected-table_wrapper .dataTables_filter input {
  margin-left: 10px;
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#cpv-selected-table_wrapper .dataTables_length {
  margin-bottom: 15px;
}

#cpv-selected-table_wrapper .dataTables_length select {
  margin: 0 5px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#cpv-selected-table_wrapper .dataTables_info {
  padding-top: 10px;
  color: #6c757d;
}

#cpv-selected-table_wrapper .dataTables_paginate {
  padding-top: 10px;
}

#cpv-selected-table_wrapper .dataTables_paginate .paginate_button {
  padding: 5px 10px;
  margin: 0 2px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

#cpv-selected-table_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: #f0f0f0;
}

#cpv-selected-table_wrapper .dataTables_paginate .paginate_button.current {
  background-color: #0073aa;
  color: #fff;
  border-color: #0073aa;
}

@media (max-width: 768px) {
  .cpv-controls-row {
    flex-direction: column;
  }
  
  .cpv-search-wrapper {
    width: 100%;
  }
  
  .cpv-selected-table {
    font-size: 0.9em;
  }
  
  .cpv-selected-table th,
  .cpv-selected-table td {
    padding: 8px 10px;
  }
}

