// gbmetareport.component.scss

// ============================================================================
// CONTAINER
// ============================================================================
.meta-report-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  box-sizing: border-box;
  background-color: #fafafa;

  // Custom Scrollbar (Webkit browsers)
  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
  }

  &::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;

    &:hover {
      background: #555;
    }
  }
}

// ============================================================================
// MAIN CONTENT
// ============================================================================
.meta-report-content {
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

// ============================================================================
// HEADER
// ============================================================================
.report-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;

  .report-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
  }

  .report-description {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.9;
  }
}

// ============================================================================
// FORM CONTAINER
// ============================================================================
.report-form {
  padding: 20px;
}

// ============================================================================
// FORM SECTIONS
// ============================================================================
.form-section {
  margin-bottom: 20px;

  &:last-child {
    margin-bottom: 0;
  }

  &.mandatory-section {
    position: relative;
    padding-inline-start: 12px;
    border-inline-start: 3px solid #1976d2;
  }
}

.aspects-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

// ============================================================================
// LABELS
// ============================================================================
.section-label {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.87);
  margin: 0 0 8px 0;

  .required {
    color: #f44336;
    margin-inline-start: 2px;
    font-weight: 600;
  }
}

.aspect-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;

  .info-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: rgba(0, 0, 0, 0.54);
    cursor: help;
    transition: color 0.2s;

    &:hover {
      color: rgba(0, 0, 0, 0.87);
    }
  }
}

// ============================================================================
// FORM CONTROLS
// ============================================================================
.full-width {
  width: 100%;
}

// Radio Group
.radio-group {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  padding: 4px 0;

  .radio-option {
    flex: 0 0 auto;
  }
}

// Button Group
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;

  mat-button-toggle {
    flex: 1 1 auto;
    min-width: 100px;
    max-width: 200px;
  }
}

// Checkbox Wrapper
.checkbox-wrapper {
  padding: 8px 0;
}

// ============================================================================
// SUMMARY SECTION
// ============================================================================
.summary-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;

  .summary-content {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    line-height: 1.6;

    .summary-label {
      font-weight: 500;
      color: rgba(0, 0, 0, 0.6);
    }

    .summary-value {
      font-weight: 500;
      color: rgba(0, 0, 0, 0.87);
      text-align: end;
      word-break: break-word;
    }
  }
}

// ============================================================================
// ACTION BUTTONS
// ============================================================================
.action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;

  button {
    min-width: 100px;
    font-weight: 500;
  }

  .btn-cancel,
  .btn-reset {
    color: rgba(0, 0, 0, 0.6);
    border-color: rgba(0, 0, 0, 0.23);

    &:hover {
      background-color: rgba(0, 0, 0, 0.04);
    }
  }

  .btn-apply {
    background-color: #1976d2;
    color: #fff;

    &:hover:not(:disabled) {
      background-color: #1565c0;
    }

    &:disabled {
      background-color: rgba(0, 0, 0, 0.12);
      color: rgba(0, 0, 0, 0.26);
      cursor: not-allowed;
    }
  }
}

// ============================================================================
// ANGULAR MATERIAL CUSTOMIZATION
// ============================================================================
:host {
  ::ng-deep {
    // Form Field
    mat-form-field {
      .mat-mdc-text-field-wrapper {
        padding-bottom: 0;
      }

      .mat-mdc-form-field-subscript-wrapper {
        display: none;
      }

      .mat-mdc-form-field-bottom-align::before {
        display: none;
      }
    }

    // Radio Button
    mat-radio-button.mat-mdc-radio-button.mat-accent {
      --mdc-radio-selected-icon-color: #1976d2;
      --mdc-radio-selected-hover-icon-color: #1976d2;
      --mdc-radio-selected-pressed-icon-color: #1976d2;
    }

    mat-radio-button.mat-mdc-radio-button.mat-mdc-radio-disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    // Button Toggle Group
    mat-button-toggle-group {
      border: 1px solid rgba(0, 0, 0, 0.12);
      border-radius: 4px;
      overflow: hidden;

      mat-button-toggle {
        border: none;
        border-inline-end: 1px solid rgba(0, 0, 0, 0.12);

        &:last-child {
          border-inline-end: none;
        }

        &.mat-button-toggle-checked {
          background-color: #e3f2fd;
          color: #1976d2;
          font-weight: 500;
        }

        &.mat-button-toggle-disabled {
          opacity: 0.5;
          cursor: not-allowed;
        }

        .mat-button-toggle-label-content {
          padding: 0 12px;
          line-height: 36px;
        }
      }
    }

    // Checkbox
    mat-checkbox.mat-mdc-checkbox.mat-accent {
      --mdc-checkbox-selected-checkmark-color: #fff;
      --mdc-checkbox-selected-focus-icon-color: #1976d2;
      --mdc-checkbox-selected-hover-icon-color: #1976d2;
      --mdc-checkbox-selected-icon-color: #1976d2;
      --mdc-checkbox-selected-pressed-icon-color: #1976d2;
    }

    mat-checkbox.mat-mdc-checkbox-disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    // Select
    mat-select .mat-mdc-select-trigger {
      min-height: 40px;
    }
  }
}

// ============================================================================
// RESPONSIVE DESIGN - TABLET
// ============================================================================
@media (max-width: 768px) {
  .meta-report-container {
    padding: 12px;
  }

  .report-header {
    padding: 12px 16px;

    .report-title {
      font-size: 16px;
    }

    .report-description {
      font-size: 12px;
    }
  }

  .report-form {
    padding: 16px;
  }

  .form-section {
    margin-bottom: 16px;
  }

  .aspects-section {
    gap: 16px;
  }

  .radio-group {
    flex-direction: column;
    gap: 12px;

    .radio-option {
      flex: 1 0 auto;
    }
  }

  .button-group {
    flex-direction: column;

    mat-button-toggle {
      min-width: 100%;
      max-width: 100%;
    }
  }

  .action-buttons {
    flex-direction: column;
    gap: 8px;

    button {
      width: 100%;
      min-width: auto;
    }
  }

  .summary-section {
    .summary-item {
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;

      .summary-value {
        text-align: start;
      }
    }
  }
}

// ============================================================================
// RESPONSIVE DESIGN - MOBILE
// ============================================================================
@media (max-width: 480px) {
  .meta-report-container {
    padding: 8px;
  }

  .report-header {
    padding: 10px 12px;

    .report-title {
      font-size: 15px;
    }

    .report-description {
      font-size: 11px;
    }
  }

  .report-form {
    padding: 12px;
  }

  .form-section {
    margin-bottom: 14px;

    &.mandatory-section {
      padding-inline-start: 8px;
      border-inline-start-width: 2px;
    }
  }

  .section-label {
    font-size: 13px;
  }

  .radio-group {
    gap: 10px;
  }

  .button-group {
    gap: 6px;
  }

  .action-buttons {
    margin-top: 20px;
    padding-top: 16px;
  }

  .summary-section {
    margin-top: 20px;
    padding-top: 16px;

    .summary-content {
      padding: 10px 12px;
    }

    .summary-item {
      font-size: 12px;
    }
  }
}

// ============================================================================
// PRINT STYLES
// ============================================================================
@media print {
  .meta-report-container {
    background: #fff;
    padding: 0;
    overflow: visible;
  }

  .action-buttons {
    display: none;
  }

  .report-header {
    background: none !important;
    color: #000 !important;
    border-bottom: 2px solid #000;
  }

  .meta-report-content {
    box-shadow: none;
    border: 1px solid #000;
  }
}

// ============================================================================
// ACCESSIBILITY
// ============================================================================
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}

// ============================================================================
// UTILITIES
// ============================================================================
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
