/* 1. GLOBAL IMPROVEMENTS
   -------------------------------------------------------------------------- */

/* Always use border-box so widths behave predictably everywhere */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Create one source of truth for the banner / search-bar height.
   If it ever changes you now edit only this line. */
:root {
  --header-offset: 130px;   /* previous hard-coded 130px */
}

/* Container progress bar */
#progress-container {
  width: 100%;
  background-color: #f3f3f3;
  margin-bottom: 20px;
  position: relative;
  padding: 5px;
}
#progress-bar {
  width: 0;
  height: 20px;
  background-color: #1de9b6;
  transition: width 0.3s ease;
}
#progress-text {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-weight: bold;
}

/* Marker pentru câmpuri obligatorii cu CSS implicit (poți și inline în HTML) */
label.required:after {
  content: " *";
  color: #f00;
  font-weight: bold;
}

.survey-instruction-text {
  max-width: 1200px;
  width: 100%;
  display: block;
  margin-bottom: 12px;
  text-align: justify;
}

.survey-main-grid{                 /* desktop / large tablet = default */
  display:flex;
  gap:28px;
  align-items:flex-start;
}
.survey-main-grid .survey-left{
  flex:1 1 0;                      /* cards grow / shrink */
  min-width:0;                     /* let long titles wrap */
}


.survey-status-card{
  width:300px;
  max-height:80vh;                 /* scroll inside on very long lists */
  overflow:auto;
  background:#fff;
  border-radius:12px;
  box-shadow:0 2px 20px rgba(40,80,140,.05);
  padding:20px 22px;
  position:sticky;                 /* sticks under blue banner */
  top:130px;                       /* Increased from 90px to 130px to account for search bar height */
  z-index: 20;                     /* Higher than search bar */
  font-size:.94rem;
}
.status-title{
  margin:0 0 10px;
  font-size:1.2rem;
  font-weight:700;
  text-align:center;
}
.status-list{
  list-style:none;
  margin:0;
  padding:0;
  line-height:1.44;
}
.status-list li+li{ margin-top:4px; }
.status-empty{
  color:#6c757d;
  font-style:italic;
}

/* Main survey background */
.survey-outer-center {
  width: 100%;
  min-height: 100vh;
  background: #f5f8fa;
  padding-top: 20px;    /* Reduced from 70px to 20px */
  box-sizing: border-box;
  display: block;
}

/* Main content wrapper - perfectly centered, max width */
.container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12px;   /* redus */
  padding-right: 12px;  /* redus */
  box-sizing: border-box;
  width: 100%;
  font-size: 1rem;      /* dimensiune baza text */
}

/* Info/alert box visually centered, nicely rounded and padded */
.info-centered-box {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 24px;
  font-size: 0.75rem;
  background: #d8f0f6 !important;
  color: #32606b !important;
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 2px 20px 0 rgba(40, 80, 140, 0.05);
}
.info-centered-box ul {
  margin-top: 1rem;
  margin-bottom: 0;
  padding-left: 1.5em;
}
.info-centered-box li {
  margin-bottom: 0.25em;
  font-size: 1.06em;
}

/* Form container and other blocks: full width of main container */
form, #progress-container, .card, fieldset, .feedback-container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Responsive headings */
h1, .survey-title {
  text-align: center;
  margin-bottom: 2.5rem;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1.12;
  font-size: 3rem;
}

/* Center everything else if needed */
.centered {
  text-align: center !important;
  display: block !important;
}

/* Fieldset-urile (paginile wizard) */
fieldset {
  display: none;
  border: 0;
}
fieldset.active {
  display: block;
}

/* Action buttons */
.action-button {
  padding: 13px 30px;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: linear-gradient(-135deg, #1de9b6 0%, #1dc4e9 100%);
  color: #fff;
  border: none;
  border-radius: 0.25rem;
  margin: 10px;
  cursor: pointer;
}
.action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.action-button-purple {
  background: linear-gradient(-135deg, #899FD4 0%, #A389D4 100%);
  box-shadow: 0 4px 12px rgba(163, 137, 212, 0.4);
}
.action-button-purple:hover {
  background: linear-gradient(-135deg, #7a8bd4 0%, #9671d9 100%);
}

/* Stil pentru bara de căutare CAEN */
#caen-search {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  position: sticky;
  border-radius: 0.25rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 0;
}

/* Fix the z-index conflict between search bar and status sidebar */
#search-row {
  position: sticky;
  top: 70px;  /* height of .main-page-banner-header */
  z-index: 10;  /* Lower than sidebar */
  background: #f5f8fa;
  padding-top: 0px;     /* Reduced from 12px to 0px */
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e4ea;
}


#search-results {
  display:none;
  max-height: 220px;
  overflow-y:auto;
  font-size:.9rem;
}


#caen-search:focus {
  outline: none;
  border-color: #1de9b6;
  box-shadow: 0 0 0 2px rgba(29,233,182,0.25);
}
#no-results-message {
  display: none;
  margin: 20px 0;
  font-style: italic;
  color: #666;
  text-align: center;
}
.highlight {
  background-color: #15e337 !important;
  color: #212121 !important;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}
.card {
  margin-bottom: 20px;
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.card .card-header {
  background-color: #e0e4ea;
  font-size: 1.25rem;
  font-weight: 700;
  color: #222;
  letter-spacing: 0.01em;
  border-bottom: 2px solid #b6b6c9;
  border-radius: 8px 8px 0 0;
  padding: 16px 44px 16px 18px;
  position: relative;
  box-shadow: 0 2px 4px rgba(39,60,117,0.04);
  transition: background 0.25s;
}
.card .card-header:hover {
  background-color: #d1d6e0;
}
.card .card-text {
  font-size: 0.9rem;
}
.feedback-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  margin-top: 20px;
}
.thanks-title {
  font-size: 42px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #111827;
}
.thanks-message {
  font-size: 18px;
  color: #4b5563;
  margin-bottom: 40px;
  max-width: 600px;
}
.widget {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}
.widget table {
  width: 100%;
  margin-top: 10px;
}
.widget table th,
.widget table td {
  padding: 8px;
  text-align: center;
}

#map {
  width: 100%;
  height: 600px;
  min-height: 400px;
  border: 1px solid #ddd;
  border-radius: 18px;
  margin-top: 20px;
  box-shadow: 0 2px 8px 0 rgba(69, 90, 100, 0.13);
  position: relative;
  z-index: 1;
}

.category-card {
  border-radius: 18px;
  box-shadow: 0 2px 20px 0 rgba(40, 80, 140, 0.05);
  overflow: hidden;
  margin-bottom: 24px;
  background: #fff;
}

/* Header */
.category-card .card-header {
  background-color: #e0e4ea;
  border-radius: 18px 18px 0 0;
  padding: 14px 20px 14px 14px;
  font-size: 1.23rem;
  font-weight: 600;
  border-bottom: 2px solid #b6b6c9;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  min-height: 58px;
}

/* Title font smaller, align left */
.category-card .header-title {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: left;
  color: #232323;
  padding-left: 8px;
  line-height: 1.25;
  /* Prevent overflow */
  white-space: normal;
  word-break: break-word;
}

.category-card .accordion-toggle-btn {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  padding: 0 2px;
  margin-right: 8px;
  color: #232323;
  outline: none;
}

.category-card .accordion-toggle-btn:focus {
  outline: 2px solid #1dc4e9;
}

.category-card.collapsed .accordion-toggle-btn i {
  transform: rotate(0deg);
}
.category-card:not(.collapsed) .accordion-toggle-btn i {
  transform: rotate(180deg);
}

/* Suggestions (info) button always right, only visible when expanded */
.category-card .suggestions-btn {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: #232323;
  margin-left: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.category-card:not(.collapsed) .suggestions-btn {
  opacity: 1;
  pointer-events: auto;
}

/* Suggestions box, always under header, hide by default */
.category-card .suggestions-box {
  display: none;
  padding: 8px 16px;
  background: #eef;
  border-top: 1px solid #ccc;
  border-radius: 0 0 10px 10px;
  margin-bottom: 2px;
}
.category-card .suggestions-box.active {
  display: block;
}

.category-card .card-body {
  background: #fff;
  border-radius: 0 0 18px 18px;
  max-height: 1000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.3s, padding 0.25s;
  padding: 24px 24px 18px 24px;
  box-sizing: border-box;
  border-top: none;
}

.category-card.collapsed .card-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.card-body-content {
  max-height: 2000px; /* or a value large enough for your content */
  overflow: hidden;
  transition: max-height 0.55s cubic-bezier(0.4,0,0.2,1);
}

.category-card.collapsed .card-body-content {
  max-height: 0;
  /* no opacity here! */
}

body, .survey-outer-center, .survey-main-grid, .survey-status-card, .info-centered-box {
  font-size: 1rem;
}

/*.survey-instruction-text {*/
/*  width: 100%;*/
/*  display: block;*/
/*  margin-bottom: 18px;*/
/*  text-align: justify;*/
/*}*/

.survey-instruction-text {
  max-width: 800px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
  text-align: center;
  background: #d8f0f6;
  color: #32606b;
  border-radius: 16px;
  padding: 1.25rem 1rem;
}



/* Always hide sidebar/nav in survey mode on all screen sizes */
body.survey-mode .pcoded-sidebar,
body.survey-mode .sidebar,
body.survey-mode .pcoded-navbar,
body.survey-mode .sidebar-overlay,
body.survey-mode .sidebar-toggle,
body.survey-mode .pcoded-navbar-header,
body.survey-mode .navbar,
body.survey-mode .side-nav,
body.survey-mode .navigation {
  display: none !important;
}

body.survey-mode .pcoded-main-container,
body.survey-mode .pcoded-wrapper,
body.survey-mode .pcoded-content,
body.survey-mode .pcoded-inner-content,
body.survey-mode .main-body,
body.survey-mode .page-wrapper {
  margin: 0 !important;         /* no sidebar gap            */
  padding: 0 !important;        /* no 15-30 px side gutters   */
  width: 100% !important;       /* take the full line         */
  max-width: 100% !important;
}

.main-page-banner-header {
  width: 100%;
  background: #3f4d67;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 2.5rem;
  letter-spacing: -1px;
  padding: 30px 0 22px 0;
  margin: 0;
  box-shadow: 0 2px 12px rgba(40,80,140,0.04);
  border-bottom: 2px solid #313d52;
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  height: 70px;
  min-height: 70px;
}


.main-page-banner-header span {
  display: block;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.1;
  word-break: break-word;
}

@media (max-width: 1300px) {
  .container {
    max-width: 98vw;
  }
}

@media (max-width: 700px) {
  .container {
    padding-left: 2vw !important;
    padding-right: 2vw !important;
    max-width: 100vw !important;
  }
    .info-centered-box {
    width: 98vw !important;
    max-width: 99vw !important;
    margin-left: 1vw !important;
    margin-right: 1vw !important;
    box-sizing: border-box !important;
    padding: 1.2rem 1rem !important;
    border-radius: 12px !important;
  }
  .card,
  .feedback-container {
    max-width: 99vw !important;
    padding: 1rem 0.4rem !important;
    border-radius: 10px !important;
  }
  h1, .survey-title {
    font-size: 2rem !important;
    line-height: 1.5 !important;
    word-break: break-word !important;
    letter-spacing: 0 !important;
    font-weight: 700 !important;
  }
  .info-centered-box,
  .card,
  .feedback-container,
  form {
    font-size: 1.02rem !important;
    word-break: break-word !important;
  }
  .category-card {
    border-radius: 14px;
    margin-bottom: 14px;
    box-shadow: none;
    background: #f6f7f9;
    border: 1.5px solid #e1e5eb;
    width: 100%;
    max-width: 100%;
  }
  .category-card .card-header {
    border-radius: 14px 14px 0 0;
    padding: 12px 12px 12px 12px;
    font-size: 1rem;
    font-weight: 600;
    background: #e5e8ee;
    min-height: 48px;
    border-bottom: 1px solid #e1e5eb;
  }
  .category-card .header-title {
    font-size: 0.97rem;
    line-height: 1.18;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding-left: 7px;
    padding-right: 7px;
    color: #222;
  }
  .category-card .accordion-toggle-btn {
    font-size: 1.1rem;
    margin-right: 5px;
  }
  .category-card .card-body {
    border-radius: 0 0 14px 14px;
    padding: 13px 8px 12px 14px;
    font-size: 0.96rem;
    background: #fff;
    border-top: none;
  }
  .category-card .suggestions-btn {
    font-size: 1rem;
    margin-left: 5px;
  }

  .main-page-banner-header {
    font-size: 1.35rem;
    padding: 15px 0 10px 0;
  }

  .survey-main-grid{               /* fall back to one column */
    display:block;
    align-items: flex-start;
  }

  .questions-scroll-area {
    max-height: none !important;
    overflow-y: visible !important;
  }

  /* Mobile sidebar: positioned at bottom, not sticky */
  .survey-status-card {
    position: static;        /* Remove sticky positioning */
    top: auto;               /* Reset top position */
    width: 100%;             /* Full width on mobile */
    max-width: 100%;
    margin-top: 24px;        /* Space above the sidebar */
    margin-bottom: 20px;     /* Space below the sidebar */
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
    font-size: .92rem;
    max-height: none;        /* Remove height restriction */
  }

  .status-title{
    font-size:1.05rem;
  }
}

@media (max-width: 420px) {
  .category-card {
    border-radius: 10px;
    margin-bottom: 9px;
  }
  .category-card .card-header,
  .category-card .card-body {
    border-radius: 10px;
    padding-left: 7px;
    padding-right: 7px;
  }
  .category-card .header-title {
    font-size: 0.85rem;
  }
}



/* Even smaller screens */
@media (max-width: 420px) {
  h1, .survey-title {
    font-size: 1.3rem !important;
    line-height: 1.13 !important;
  }
  .info-centered-box {
    padding: 0.8rem 0.4rem !important;
    font-size: 0.93rem !important;
  }

  .main-page-banner-header {
    font-size: 1rem;
    padding: 9px 0 5px 0;
  }
}
/* 2. PROGRESS BAR
   -------------------------------------------------------------------------- */
#progress-container {
  /* Let the bar itself decide the height, so text never overflows vertically */
  padding: 4px;                  /* slightly slimmer */
  display: flex;                 /* ensures text stays vertically centred   */
  align-items: center;
  justify-content: center;
  position: relative;
}

#progress-bar {
  height: 20px;                  /* unchanged visual height  */
  flex: 1 1 0;                   /* use remaining width      */
  transition: width .3s ease;
}

/* Text is now centred with flexbox rather than translate magic */
#progress-text {
  position: absolute;
  inset: 0;                      /* stretch across container */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  white-space: nowrap;           /* prevents wrap at 100%    */
  pointer-events: none;          /* avoid accidental clicks  */
}

/* 3. MAIN LAYOUT – MOBILE FRIENDLY
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {       /* large tablet and down    */
  .survey-main-grid {
    flex-direction: column;
  }
  .survey-status-card {
    width: 100%;
    max-height: none;            /* don’t create double scroll on mobile */
    position: static;            /* sticky feels jumpy on very small viewports */
    margin-bottom: 32px;
  }
}

/* 4. STICKY ELEMENTS – single offset variable
   -------------------------------------------------------------------------- */
.survey-status-card {
  top: var(--header-offset);
}
#search-row {
  top: calc(var(--header-offset) - 60px); /* 60px = banner height in design */
}

/* 5. SEARCH FIELD – tiny usability tweaks
   -------------------------------------------------------------------------- */
#caen-search {
  width: 100%;                   /* prevents 1-px wiggle on mobile */
}
#search-results {
  overscroll-behavior: contain;  /* avoids body scrolling when list scrolls */
  -webkit-overflow-scrolling: touch;
}

/* 6. FIELDSET ACCESSIBILITY
   Screen readers handle `display:none` poorly; we move pages off-canvas
   until they are active, preserving wizard behaviour and semantics.
   -------------------------------------------------------------------------- */
fieldset {
  position: absolute;
  left: -9999px;                 /* off-canvas for SRs */
  width: 100%;
  visibility: hidden;
}
fieldset.active {
  position: static;
  visibility: visible;
}

fieldset .centered:last-child {
  margin-bottom: 48px;
}

/* 7. BUTTON FOCUS VISIBILITY (keyboard users)
   -------------------------------------------------------------------------- */
.action-button:focus-visible {
  outline: 3px solid #1dc4e9;
  outline-offset: 2px;
}

/* 8. CARD CONSISTENCY – avoid accidental double margins
   -------------------------------------------------------------------------- */
.card:last-child {
  margin-bottom: 0;
}
/* MOBILE LAYOUT FIX - Properly override desktop sidebar behavior
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .survey-main-grid {
    flex-direction: column !important;
    gap: 0 !important;
  }

  .survey-status-card {
    /* Completely remove sticky/fixed positioning */
    position: static !important;
    top: auto !important;
    z-index: auto !important;

    /* Remove scroll container behavior */
    max-height: none !important;
    overflow: visible !important;

    /* Make it behave like a normal card */
    width: 100% !important;
    margin: 20px auto !important;

    /* Keep the visual styling but remove positioning quirks */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(40,80,140,.05);
    padding: 20px 22px;
    font-size: .94rem;
  }

  .survey-left {
    flex: none !important;
    min-width: auto !important;
  }
}