/**
 * Project Node Styling - Updated for CIF Full & WtE Short
 * Place this file in: themes/cif_theme/css/
 */

/* ----------------------- Base Container ----------------------- */
.project-detail {
  margin: 0 auto;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #333;
}

/* ----------------------- Action Buttons Bar ----------------------- */
.project-actions-bar {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  //margin-bottom: 30px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.actions-container {
  display: flex;
  justify-content: flex-end; /* move buttons to the right */
  gap: 8px;                  /* space between buttons */
  margin-top: 1rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

/* Edit Button */
.action-btn--edit {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
  border-color: #1976D2;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.action-btn--edit:hover {
  background: linear-gradient(135deg, #1976D2, #1565C0);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
  transform: translateY(-2px);
}

/* Delete Button */
.action-btn--delete {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
  border-color: #d32f2f;
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2);
}

.action-btn--delete:hover {
  background: linear-gradient(135deg, #d32f2f, #c62828);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
  transform: translateY(-2px);
}

/* Add Data Button */
.action-btn--add-data {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  color: white;
  border-color: #388E3C;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.action-btn--add-data:hover {
  background: linear-gradient(135deg, #388E3C, #2E7D32);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 16px;
  display: inline-block;
}

.btn-text {
  display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
  .project-actions-bar {
    //padding: 15px;
    margin-bottom: 20px;
  }

  .actions-container {
    gap: 10px;
  }

  .action-btn {
    padding: 9px 14px;
    font-size: 13px;
  }

  .btn-icon {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .action-btn {
    flex: 1;
    justify-content: center;
    min-width: 100px;
  }

  .btn-text {
    display: none;
  }

  .btn-icon {
    font-size: 18px;
  }
}

/* ----------------------- Banner ----------------------- */
.project-banner {
  background-color: #004080;
  color: #ffffff;
  padding: 1rem 2rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  //border-radius: 0;
  margin: 0 0 1.5rem 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
}

/* ----------------------- Header Top (Title + Badge) ----------------------- */
.project-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 20px;
  gap: 1rem;
}

.project-title-id {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.project-title-id .project-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: #212529;
}

.project-title-id .project-id {
  display: block;
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.3rem;
}

/* Questionnaire Badge */
.questionnaire-badge {
  display: inline-block;
  background: #0066cc;
  color: white;
  padding: 6px 16px;
  //border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ----------------------- Header Section ----------------------- */
.project-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
  padding: 30px;
  background: #f8f9fa;
  //border-radius: 8px;
}

.header-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #6c757d;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-value {
  font-size: 16px;
  font-weight: 600;
  color: #212529;
}

/* ----------------------- Section Styling ----------------------- */
.project-section {
  margin-bottom: 50px;
  padding: 30px;
  background: #ffffff;
  //border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: #212529;
  margin-bottom: 10px;
  padding-bottom: 15px;
  border-bottom: 3px solid #0066cc;
}

.section-subtitle {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 25px;
  font-style: italic;
}

.project-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: #212529;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e9ecef;
}

.project-section h4 {
  font-size: 16px;
  font-weight: 600;
  color: #495057;
  margin: 1rem 0 0.75rem 0;
}

/* ----------------------- Info Grid ----------------------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.info-item {
  padding: 0.75rem;
  background: #f8f9fa;
  //border-radius: 6px;
  //border-left: 3px solid #0066cc;
}

.info-item strong {
  display: block;
  color: #495057;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item span {
  display: block;
  color: #212529;
  font-size: 1rem;
  font-weight: 500;
}

/* ----------------------- Project Description ----------------------- */
.project-description,
.proponent-description {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  //border-radius: 6px;
  line-height: 1.8;
}

.project-description h3,
.proponent-description h4 {
  margin-top: 0;
  color: #0066cc;
}

/* ----------------------- Checkbox List (Eligibility) ----------------------- */
.checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: #f5f5f5;
  //border-radius: 6px;
  transition: all 0.2s ease;
}

.checkbox-item.checked {
  background: #e8f5e9;
  border-left: #4caf50;
}

.checkbox-icon {
  font-size: 1.4rem;
  font-weight: bold;
  min-width: 24px;
}

.checkbox-item.checked .checkbox-icon {
  color: #4caf50;
}

.checkbox-item:not(.checked) .checkbox-icon {
  color: #bbb;
}

.checkbox-label {
  flex: 1;
  color: #333;
  font-size: 0.95rem;
}

/* ----------------------- Detail Blocks ----------------------- */
.detail-block {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: #f9f9f9;
  //border-left: 4px solid #0066cc;
  //border-radius: 4px;
}

.detail-block h4 {
  margin-top: 0;
  color: #0066cc;
  font-size: 1.1rem;
}

.detail-block p {
  margin: 0.5rem 0 0 0;
  line-height: 1.7;
  color: #495057;
}

/* ----------------------- Tag List ----------------------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.tag {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.35rem 0.9rem;
  //border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ----------------------- SDG Blocks ----------------------- */
.sdg-block {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 2px solid #e9ecef;
  //border-radius: 8px;
  background: #fff;
  transition: all 0.3s ease;
}

.sdg-block:hover {
  border-color: #0066cc;
  box-shadow: 0 4px 12px rgba(0,102,204,0.1);
}

.sdg-block h4 {
  margin-top: 0;
  color: #0066cc;
  font-size: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.sdg-block p {
  margin: 0.75rem 0;
  line-height: 1.6;
}

.sdg-block strong {
  color: #495057;
}

/* ----------------------- Financial Grid ----------------------- */
.financial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.financial-section {
  padding: 1.25rem;
  background: #f8f9fa;
  //border-radius: 8px;
  //border-top: 4px solid #28a745;
}

.financial-section h4 {
  margin-top: 0;
  color: #28a745;
  font-size: 1.1rem;
}

/* Details List */
.details-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.details-list li {
  padding: 12px 0;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
}

.details-list li:last-child {
  border-bottom: none;
}

.details-list li strong {
  font-weight: 600;
  color: #495057;
  min-width: 160px;
  flex-shrink: 0;
}

.details-list li span {
  flex: 1;
  text-align: right;
  font-weight: 500;
  color: #212529;
}

/* ----------------------- Support Needs Grid ----------------------- */
.support-needs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.support-item {
  padding: 1.25rem;
  background: #f5f5f5;
  //border-radius: 8px;
  //border-left: 4px solid #ff9800;
  transition: all 0.3s ease;
}

.support-item:hover {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.support-item h4 {
  margin-top: 0;
  color: #ff9800;
  font-size: 1rem;
}

.support-item p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

/* ----------------------- Timeline Section ----------------------- */
.timeline-container {
  position: relative;
  padding: 30px 0;
}

.timeline-item {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
  position: relative;
  padding-left: 40px;
  transition: all 0.3s ease;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: -40px;
  width: 2px;
  background: #dee2e6;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-marker {
  width: 40px;
  height: 40px;
  //border-radius: 50%;
  background: #e9ecef;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.timeline-item.active .timeline-marker {
  background: #007bff;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
}

.timeline-content {
  flex: 1;
  padding-top: 5px;
}

.timeline-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: #212529;
  margin: 0 0 8px 0;
}

.timeline-date {
  font-size: 14px;
  color: #007bff;
  font-weight: 500;
  margin: 5px 0;
}

.timeline-description {
  font-size: 14px;
  color: #6c757d;
  margin: 8px 0 0 0;
  line-height: 1.6;
}

/* ----------------------- Attachments Section ----------------------- */
.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8f9fa;
  //border-radius: 6px;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.attachment-item:hover {
  background: #e9ecef;
  border-color: #0066cc;
  transform: translateX(4px);
}

.file-icon {
  font-size: 1.5rem;
  min-width: 24px;
}

.attachment-item a {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
  flex: 1;
}

.attachment-item a:hover {
  text-decoration: underline;
}

.file-size {
  color: #999;
  font-size: 0.85rem;
  margin-left: auto;
}

/* ----------------------- Discussion Section ----------------------- */
.comments-wrapper {
  margin-top: 20px;
}

.comment {
  padding: 20px;
  background: #f8f9fa;
  //border-radius: 6px;
  margin-bottom: 15px;
  //border-left: 3px solid #007bff;
}

.comment__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #6c757d;
}

.comment__author {
  font-weight: 600;
  color: #212529;
}

.comment__time {
  font-size: 13px;
}

.comment__content {
  line-height: 1.6;
  color: #495057;
}

/* ----------------------- Form Elements ----------------------- */
.comment-form {
  margin-top: 30px;
  padding: 25px;
  background: #f8f9fa;
  //border-radius: 8px;
}

.comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ced4da;
  //border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #203266;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.comment-form .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 15px;
}

.comment-form button[type="submit"],
.comment-form input[type="submit"] {
  background: #203266;
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  //border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.comment-form button[type="submit"]:hover,
.comment-form input[type="submit"]:hover {
  background: #203266;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* ----------------------- Responsive Design ----------------------- */
@media (max-width: 768px) {
  .project-header {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .info-grid,
  .financial-grid,
  .support-needs-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .timeline-item {
    padding-left: 30px;
  }
  
  .project-section {
    padding: 20px;
  }
  
  .details-list li {
    flex-direction: column;
    gap: 5px;
  }
  
  .details-list li span {
    text-align: left;
  }
  
  .details-list li strong {
    min-width: auto;
  }

  .project-title-id {
    flex-direction: column;
    align-items: flex-start;
  }

  .questionnaire-badge {
    margin-top: 0.5rem;
  }
}

/* ----------------------- Hide Drupal Field Labels ----------------------- */
.project-detail .field__label {
  display: none !important;
}

.project-detail .field > div:first-child {
  display: none !important;
}

.project-detail .field {
  display: inline;
  margin: 0;
}

.project-detail .field > div:last-child {
  display: inline;
}

/* Specific overrides */
.project-header .field,
.project-header .field > div,
.details-list .field,
.details-list .field > div,
.timeline-section .field,
.timeline-section .field > div {
  display: inline;
}

/* Block-level fields */
.project-description .field,
.project-description .field > div,
.proponent-description .field,
.proponent-description .field > div,
.detail-block .field,
.detail-block .field > div,
.attachments-list .field,
.attachments-list .field > div {
  display: block !important;
}

/* Links in fields */
.project-detail .field a {
  color: inherit;
  text-decoration: none;
}

.details-list .field a:hover {
  text-decoration: underline;
}

/* ----------------------- Tab Styles (if using tabs) ----------------------- */
.project-main-tabs .main-tab-nav {
  display: flex;
  //gap: 1rem;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 2rem;
  //padding: 0 20px;
}

.main-tab-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  //gap: 0.5rem;
}

.main-tab-btn:hover {
  //color: #0066cc;
  //background: #f8f9fa
}

.main-tab-btn.active {
  color: #ffffff;
  //border-bottom-color: #0066cc;
  background: #203266;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.tab-icon {
  font-size: 1.2rem;
}

/**
 * Categorized Documents Styling
 */

/* Category Upload Wrapper (Form) */
.documents-upload-wrapper details {
  margin-bottom: 1.5rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.documents-upload-wrapper details[open] {
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.documents-upload-wrapper details summary {
  padding: 1rem 1.25rem;
  background: #f9fafb;
  font-weight: 600;
  font-size: 1rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.3s ease;
}

.documents-upload-wrapper details[open] summary {
  background: #eef2ff;
  color: #4f46e5;
  border-bottom: 2px solid #e5e7eb;
}

.documents-upload-wrapper details .form-item {
  padding: 0 1.25rem;
  margin-bottom: 1rem;
}

.documents-upload-wrapper details .form-item:first-of-type {
  padding-top: 1.25rem;
}

/* Category Display (View) */
.categorized-documents {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.5rem;
}

.document-category-block {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.document-category-block:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.category-title {
  margin: 0;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.category-icon {
  font-size: 1.5rem;
}

.category-description {
  padding: 1rem 1.5rem;
  background: #f9fafb;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.6;
  border-bottom: 1px solid #e5e7eb;
}

.category-files-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.file-item:hover {
  background: #ffffff;
  border-color: #3b82f6;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.file-item .file-icon {
  font-size: 1.75rem;
  min-width: 32px;
  text-align: center;
}

.file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.file-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.file-size {
  font-weight: 500;
}

.file-date {
  color: #9ca3af;
}

.download-btn {
  font-size: 1.5rem;
  padding: 0.5rem;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.download-btn:hover {
  background: #e5e7eb;
  color: #2563eb;
  transform: scale(1.1);
}

/* Category Count Badge */
.category-title::after {
  content: attr(data-count);
  margin-left: auto;
  background: rgba(255, 255, 255, 0.25);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Empty State */
.category-files-list:empty::before {
  content: "No documents uploaded in this category";
  display: block;
  padding: 2rem;
  text-align: center;
  color: #9ca3af;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .file-item {
    flex-wrap: wrap;
  }
  
  .file-info {
    width: 100%;
  }
  
  .download-btn {
    margin-left: auto;
  }
  
  .category-title {
    font-size: 1rem;
    padding: 0.875rem 1rem;
  }
  
  .file-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Print Styles */
@media print {
  .download-btn {
    display: none;
  }
  
  .document-category-block {
    page-break-inside: avoid;
  }
}