.FormOverView {
  padding: 20px;
  background-color: var(--bg-surface);
}

.filter-section {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
  align-items: flex-end;

  .filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;

    label {
      font-size: 12px;
      color: var(--text-tertiary);
      font-weight: 500;
    }
  }

  .refresh-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: #f3eaff;
    cursor: pointer;
    transition: background-color 0.2s;

    &:hover {
      background-color: #e0d4fa;
    }

    mat-icon {
      color: var(--action-primary-default);
      font-size: 20px;
    }
  }
}

.production-table-container {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.production-table {
  width: 100%;
  border-collapse: collapse;
  background: white;

  thead {
    tr {
      &.tilted-headers {
        height: 120px;
        
        th {
          vertical-align: bottom;
          padding: 0;
          
          .header-text {
            transform: rotate(-45deg);
            white-space: nowrap;
            display: block;
            width: 30px;
            font-size: 11px;
            font-weight: 600;
            color: var(--text-primary);
            margin-left: 20px;
            margin-bottom: 10px;
          }
        }
      }

      &.main-header {
        background-color: #ede2ff;
        
        th {
          padding: 12px;
          text-align: left;
          font-size: 12px;
          font-weight: 700;
          color: var(--text-primary);
          border-bottom: 1px solid var(--border-default);
        }
      }
    }
  }

  tbody {
    tr {
      border-bottom: 1px solid var(--border-subtle);

      td {
        padding: 10px 12px;
        font-size: 13px;
        color: var(--text-secondary);
        text-align: center;

        &:first-child {
          text-align: left;
          color: var(--text-primary);
          font-weight: 500;
        }

        &.remarks {
          text-align: left;
          color: var(--text-tertiary);
          font-size: 12px;
        }
      }

      &.total-row {
        background-color: #f7f2ff;
        font-weight: 700;
        td { color: var(--text-primary); }
      }

      &.adjustment-row {
        td {
          padding-top: 15px;
          padding-bottom: 15px;

          .value-pill {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 6px;
            background-color: #f2f2f2;
            color: var(--text-primary);
            font-weight: 600;
            min-width: 30px;
          }
        }
      }

      &:hover:not(.total-row) {
        background-color: #fcfaff;
      }
    }
  }
}

.action-header {
  position: relative;
  
  .add-circle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #333;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
  }
}


@media (max-width: 1199px) and (min-width: 600px) {
  .FormOverView {
    padding: 12px;
    overflow-x: hidden !important;
  }

  .filter-section {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px;
    margin-bottom: 24px;

    .filter-item {
      width: 100% !important;
      flex: unset !important;

      & > label {
        display: none !important;
      }
    }

    .refresh-btn {
      align-self: flex-start;
      margin-top: 8px;
    }
  }

  .production-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .production-table {
    min-width: 700px;

    thead tr.tilted-headers {
      height: 90px;

      th .header-text {
        font-size: 10px;
      }
    }

    thead tr.main-header th,
    tbody tr td {
      padding: 8px 10px;
      font-size: 12px;
    }
  }

  ::ng-deep {
    gb-combobox,
    gb-input,
    gb-newpicklist,
    gb-date {
      display: block !important;
      width: 100% !important;
    }

    .filter-item {
      gb-combobox .Mat_Form_Field,
      gb-input .Mat_Form_Field,
      gb-newpicklist .Mat_Form_Field,
      gb-date .Mat_Form_Field {
        width: 100% !important;
        max-width: 100% !important;
        min-width: unset !important;
      }

      .formlabel,
      .input_label {
        display: block !important;
        width: 100% !important;
        white-space: normal !important;
        overflow: visible !important;
        margin-bottom: 4px !important;
      }
    }

    .ExpandedViewWrapper {
      display: block !important;
      width: 100% !important;
      margin-right: 0 !important;
    }

    gb-combobox mat-select,
    gb-combobox .form_combobox {
      width: 100% !important;
      max-width: 100% !important;
    }

    gb-input input.form_input,
    gb-newpicklist input.form_input {
      width: 100% !important;
      max-width: 100% !important;
      min-width: 0 !important;
      box-sizing: border-box !important;
    }

    gb-combobox .mat-mdc-text-field-wrapper,
    gb-input .mat-mdc-text-field-wrapper,
    gb-newpicklist .mat-mdc-text-field-wrapper,
    gb-date .mat-mdc-text-field-wrapper {
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }

    gb-combobox .mat-mdc-form-field-infix,
    gb-input .mat-mdc-form-field-infix,
    gb-newpicklist .mat-mdc-form-field-infix,
    gb-date .mat-mdc-form-field-infix {
      width: 100% !important;
      min-width: 0 !important;
      flex: 1 1 auto !important;
    }

    gb-combobox div[style*="display: flex"],
    gb-input div[style*="display: flex"],
    gb-newpicklist div[style*="display: flex"],
    gb-date div[style*="display: flex"] {
      flex-direction: column !important;
      align-items: flex-start !important;
    }
  }
}


@media (max-width: 599px) {
  .FormOverView {
    padding: 8px;
    overflow-x: hidden !important;
  }

  .filter-section {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px;
    margin-bottom: 20px;

    .filter-item {
      width: 100% !important;
      flex: unset !important;

      & > label {
        display: none !important;
      }
    }

    .refresh-btn {
      width: 100% !important;
      border-radius: 8px;
      justify-content: center;
    }
  }

  .production-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
  }

  .production-table {
    min-width: 600px;

    thead tr.tilted-headers {
      height: 80px;

      th .header-text {
        font-size: 9px;
        margin-left: 12px;
      }
    }

    thead tr.main-header th {
      padding: 8px;
      font-size: 11px;
    }

    tbody tr td {
      padding: 8px;
      font-size: 11px;
    }
  }

  ::ng-deep {
    gb-combobox,
    gb-input,
    gb-newpicklist,
    gb-date {
      display: block !important;
      width: 100% !important;
    }

    .formlabel,
    .input_label {
      display: block !important;
      width: 100% !important;
      white-space: normal !important;
      overflow: visible !important;
      margin-bottom: 4px !important;
    }

    .ExpandedViewWrapper {
      display: block !important;
      width: 100% !important;
      margin-right: 0 !important;
    }

    gb-combobox .Mat_Form_Field,
    gb-input .Mat_Form_Field,
    gb-newpicklist .Mat_Form_Field,
    gb-date .Mat_Form_Field {
      width: 100% !important;
      max-width: 100% !important;
      min-width: unset !important;
    }

    gb-combobox mat-select,
    gb-combobox .form_combobox {
      width: 100% !important;
      max-width: 100% !important;
    }

    gb-input input.form_input,
    gb-newpicklist input.form_input {
      width: 100% !important;
      max-width: 100% !important;
      min-width: 0 !important;
      box-sizing: border-box !important;
    }

    gb-combobox .mat-mdc-text-field-wrapper,
    gb-input .mat-mdc-text-field-wrapper,
    gb-newpicklist .mat-mdc-text-field-wrapper,
    gb-date .mat-mdc-text-field-wrapper {
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }

    gb-combobox .mat-mdc-form-field-infix,
    gb-input .mat-mdc-form-field-infix,
    gb-newpicklist .mat-mdc-form-field-infix,
    gb-date .mat-mdc-form-field-infix {
      width: 100% !important;
      min-width: 0 !important;
      flex: 1 1 auto !important;
    }

    gb-combobox div[style*="display: flex"],
    gb-input div[style*="display: flex"],
    gb-newpicklist div[style*="display: flex"],
    gb-date div[style*="display: flex"] {
      flex-direction: column !important;
      align-items: flex-start !important;
    }
  }
}
